Skip to content

Commit

Permalink
Address concerns about CSSStyleSheet-constructable-concat.html
Browse files Browse the repository at this point in the history
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] #43310

Bug: 1236777
Change-Id: I849284eafdd0afb630a11b0a9e6b73bc0264fd6b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5062333
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Commit-Queue: Mason Freed <masonf@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Auto-Submit: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1229509}
  • Loading branch information
Mason Freed authored and chromium-wpt-export-bot committed Nov 27, 2023
1 parent e570039 commit 2f79845
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions css/cssom/CSSStyleSheet-constructable-concat-ref.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@

<span>This should be green</span><br>
<span>This should be green</span>
<pre>Tests:
PASS
PASS
PASS
PASS
</pre>

<style>
span {
background-color:green;
Expand Down
12 changes: 6 additions & 6 deletions css/cssom/CSSStyleSheet-constructable-concat.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<title>Adoptedstylesheets.concat should work when starting empty</title>
<link rel="author" href="mailto:masonf@chromium.org">
Expand All @@ -7,15 +8,13 @@

<span>This should be green</span>
<div id=host></div>
<pre id=errors></pre>
<pre id=tests>Tests:
</pre>

<script>
function assert_equals(val1,val2) {
if (val1 === val2) {
return;
}
const t = document.createTextNode(`FAIL! ${val1} should be equal to ${val2}\n`);
errors.appendChild(t);
const t = val1 === val2 ? 'PASS' : `FAIL! ${val1} !== ${val2}`;
tests.appendChild(document.createTextNode(`${t}\n`));
}
window.onload = () => {
const sheet = new CSSStyleSheet();
Expand All @@ -30,5 +29,6 @@
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>

0 comments on commit 2f79845

Please sign in to comment.