Skip to content

Commit

Permalink
Use clearer variable names in grid WPT to avoid spurious MISSING test…
Browse files Browse the repository at this point in the history
… results.

Fixes web-platform-tests/interop#646

This patch improves WPT grid-shorthand-serialization.html to better distinguish
between the `cssText` function-param vs. the serialization of that string that
the test reads back from the style system.

As of this patch, we'll now use the function-param (not its serialization) when
generating the subtest "name" value that we pass to the test(...) function.
This makes for more consistent output and removes the possibility for
browser-specific serialization-quirks to influence the subtest-name, as
discussed in web-platform-tests/interop#646

The test continues to use the serialized value (under a new/clearer variable
name) in the assert_true() expression, though; this way, if the test fails, it
remains easy to see the actual strings that are involved in the `indexOf`
operation that's causing the test-failure.
  • Loading branch information
dholbert committed Mar 13, 2024
1 parent cc99c62 commit 70f365c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions css/css-grid/parsing/grid-shorthand-serialization.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@
}

if (declarations) {
let cssText = div.style.cssText;
let cssTextSerialization = div.style.cssText;
declarations.forEach(decl => {
test(function(){
assert_true(cssText.indexOf(decl) !== -1, `cssText ('${cssText}') must contain '${decl}'`);
}, `cssText ('${cssText}') must contain '${decl}'`);
assert_true(cssTextSerialization.indexOf(decl) !== -1,
`cssText serialization ('${cssTextSerialization}') must contain contain '${decl}'`);
}, `cssText ('${cssText}') must contain '${decl}' in its serialization`);
});
}
}
Expand Down

0 comments on commit 70f365c

Please sign in to comment.