Skip to content

Commit 1357573

Browse files
pxlcoderpull[bot]
authored andcommitted
Avoid asserting default sizes in {progress,meter}-native-computed-style.optional.html writing mode tests (#41997)
These tests currently assume that the default inline and block sizes of <progress> and <meter> are the same across all browsers. That is not the case, and is irrelevant to the purpose of the test, which is to assert that the block size should match height/width and inline size should match width/height depending on the writing mode. Replace the exact value assertions with assertions that test for an appropriate aspect ratio (inline size greater than block size).
1 parent fe17cf7 commit 1357573

2 files changed

+20
-8
lines changed

css/css-writing-modes/forms/meter-appearance-native-computed-style.optional.html

+10-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
test(() => {
1414
const meter = document.querySelector(`meter[style="writing-mode: horizontal-tb"]`);
1515
const style = getComputedStyle(meter);
16-
assert_equals(style.blockSize, "16px");
17-
assert_equals(style.inlineSize, "80px");
16+
const blockSize = parseInt(style.blockSize, 10);
17+
const inlineSize = parseInt(style.inlineSize, 10);
18+
assert_not_equals(blockSize, 0);
19+
assert_not_equals(inlineSize, 0);
20+
assert_greater_than(inlineSize, blockSize);
1821
assert_equals(style.blockSize, style.height);
1922
assert_equals(style.inlineSize, style.width);
2023
}, `meter[style="writing-mode: horizontal-tb"] block size should match height and inline size should match width`);
@@ -23,8 +26,11 @@
2326
test(() => {
2427
const meter = document.querySelector(`meter[style="writing-mode: ${writingMode}"]`);
2528
const style = getComputedStyle(meter);
26-
assert_equals(style.blockSize, "16px");
27-
assert_equals(style.inlineSize, "80px");
29+
const blockSize = parseInt(style.blockSize, 10);
30+
const inlineSize = parseInt(style.inlineSize, 10);
31+
assert_not_equals(blockSize, 0);
32+
assert_not_equals(inlineSize, 0);
33+
assert_greater_than(inlineSize, blockSize);
2834
assert_equals(style.blockSize, style.width);
2935
assert_equals(style.inlineSize, style.height);
3036
}, `meter[style="writing-mode: ${writingMode}"] block size should match width and inline size should match height`);

css/css-writing-modes/forms/progress-appearance-native-computed-style.optional.html

+10-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
test(() => {
1414
const progress = document.querySelector(`progress[style="writing-mode: horizontal-tb"]`);
1515
const style = getComputedStyle(progress);
16-
assert_equals(style.blockSize, "16px");
17-
assert_equals(style.inlineSize, "160px");
16+
const blockSize = parseInt(style.blockSize, 10);
17+
const inlineSize = parseInt(style.inlineSize, 10);
18+
assert_not_equals(blockSize, 0);
19+
assert_not_equals(inlineSize, 0);
20+
assert_greater_than(inlineSize, blockSize);
1821
assert_equals(style.blockSize, style.height);
1922
assert_equals(style.inlineSize, style.width);
2023
}, `progress[style="writing-mode: horizontal-tb"] block size should match height and inline size should match width`);
@@ -23,8 +26,11 @@
2326
test(() => {
2427
const progress = document.querySelector(`progress[style="writing-mode: ${writingMode}"]`);
2528
const style = getComputedStyle(progress);
26-
assert_equals(style.blockSize, "16px");
27-
assert_equals(style.inlineSize, "160px");
29+
const blockSize = parseInt(style.blockSize, 10);
30+
const inlineSize = parseInt(style.inlineSize, 10);
31+
assert_not_equals(blockSize, 0);
32+
assert_not_equals(inlineSize, 0);
33+
assert_greater_than(inlineSize, blockSize);
2834
assert_equals(style.blockSize, style.width);
2935
assert_equals(style.inlineSize, style.height);
3036
}, `progress[style="writing-mode: ${writingMode}"] block size should match width and inline size should match height`);

0 commit comments

Comments
 (0)