Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 79e9a16

Browse files
committed
Safari expands shorthand properties in CSSOM.
Check individually for both font-family and font-size in Safari, rather than font in the host_node_test.
1 parent 0ea2d0a commit 79e9a16

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

lib/web_ui/test/engine/host_node_test.dart

+13-5
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ void testMain() {
1515
domDocument.body!.append(rootNode);
1616

1717
group('ShadowDomHostNode', () {
18-
final HostNode hostNode =
19-
ShadowDomHostNode(rootNode, '14px font_family_for_testing');
18+
final HostNode hostNode = ShadowDomHostNode(rootNode, '14px monospace');
2019

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

66-
final bool hasFont = hasCssRule(style,
67-
selector: 'flt-scene-host',
68-
declaration: 'font: 14px font_family_for_testing');
65+
bool hasFont = false;
66+
if (isSafari) {
67+
// Safari expands the shorthand rules, so we check for all we've set (separately).
68+
hasFont = hasCssRule(style,
69+
selector: 'flt-scene-host',
70+
declaration: 'font-family: monospace') &&
71+
hasCssRule(style,
72+
selector: 'flt-scene-host', declaration: 'font-size: 14px');
73+
} else {
74+
hasFont = hasCssRule(style,
75+
selector: 'flt-scene-host', declaration: 'font: 14px monospace');
76+
}
6977

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

0 commit comments

Comments
 (0)