Files
firefox/testing/web-platform/tests/css/cssom/CSSStyleSheet-constructable-concat.html
Mason Freed 6a33dab804 Bug 1866874 [wpt PR 43377] - Address concerns about CSSStyleSheet-constructable-concat.html, a=testonly
Automatic update from web-platform-tests
Address concerns about CSSStyleSheet-constructable-concat.html

See [1] for comments, but this CL adds reftest-wait to ensure
the test finishes before the image capture, and adds PASS lines
for all passed tests.

This makes no difference in Chromium, but ensures this test
works correctly in other browsers.

[1] https://github.com/web-platform-tests/wpt/pull/43310

Bug: 1236777
Change-Id: I849284eafdd0afb630a11b0a9e6b73bc0264fd6b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5062333
Reviewed-by: Joey Arhar <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Commit-Queue: Joey Arhar <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1229509}

--

wpt-commits: 2f79845b3d3e3a0244c8512df9b6c430e5a1d2f7
wpt-pr: 43377
2023-12-01 09:23:29 +00:00

35 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<title>Adoptedstylesheets.concat should work when starting empty</title>
<link rel="author" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/cssom/#extensions-to-the-document-or-shadow-root-interface">
<link rel="match" href="CSSStyleSheet-constructable-concat-ref.html">
<span>This should be green</span>
<div id=host></div>
<pre id=tests>Tests:
</pre>
<script>
function assert_equals(val1,val2) {
const t = val1 === val2 ? 'PASS' : `FAIL! ${val1} !== ${val2}`;
tests.appendChild(document.createTextNode(`${t}\n`));
}
window.onload = () => {
const sheet = new CSSStyleSheet();
sheet.replaceSync('span {background-color:green;}');
assert_equals(document.adoptedStyleSheets.length,0);
document.adoptedStyleSheets = document.adoptedStyleSheets.concat([sheet]);
assert_equals(document.adoptedStyleSheets.length,1);
const host = document.getElementById('host');
const shadow = host.attachShadow({mode: 'open'});
shadow.innerHTML = '<span>This should be green</span>';
assert_equals(shadow.adoptedStyleSheets.length,0);
shadow.adoptedStyleSheets = shadow.adoptedStyleSheets.concat([sheet]);
assert_equals(shadow.adoptedStyleSheets.length,1);
document.documentElement.classList.remove("reftest-wait");
};
</script>