Skip to content

Commit

Permalink
Safari expands shorthand properties in CSSOM.
Browse files Browse the repository at this point in the history
Check individually for both font-family and font-size in Safari, rather
than font in the host_node_test.
  • Loading branch information
ditman committed Dec 8, 2022
1 parent 0ea2d0a commit 79e9a16
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/web_ui/test/engine/host_node_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ void testMain() {
domDocument.body!.append(rootNode);

group('ShadowDomHostNode', () {
final HostNode hostNode =
ShadowDomHostNode(rootNode, '14px font_family_for_testing');
final HostNode hostNode = ShadowDomHostNode(rootNode, '14px monospace');

test('Initializes and attaches a shadow root', () {
expect(domInstanceOfString(hostNode.node, 'ShadowRoot'), isTrue);
Expand Down Expand Up @@ -63,9 +62,18 @@ void testMain() {
final bool hasColorRed = hasCssRule(style,
selector: 'flt-scene-host', declaration: 'color: red');

final bool hasFont = hasCssRule(style,
selector: 'flt-scene-host',
declaration: 'font: 14px font_family_for_testing');
bool hasFont = false;
if (isSafari) {
// Safari expands the shorthand rules, so we check for all we've set (separately).
hasFont = hasCssRule(style,
selector: 'flt-scene-host',
declaration: 'font-family: monospace') &&
hasCssRule(style,
selector: 'flt-scene-host', declaration: 'font-size: 14px');
} else {
hasFont = hasCssRule(style,
selector: 'flt-scene-host', declaration: 'font: 14px monospace');
}

expect(hasColorRed, isTrue,
reason: 'Should make foreground color red within scene host.');
Expand Down

0 comments on commit 79e9a16

Please sign in to comment.