Skip to content

Commit

Permalink
Bug 1935777 [wpt PR 49576] - Remove :closed pseudo-class, a=testonly
Browse files Browse the repository at this point in the history
Automatic update from web-platform-tests
Remove :closed pseudo-class

This was resolved here:
w3c/csswg-drafts#11039 (comment)

Change-Id: Icfe2bbf5a7b87c50a52cedae98021425a5121429
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6049400
Reviewed-by: Tommy Nyquist <[email protected]>
Auto-Submit: Joey Arhar <[email protected]>
Commit-Queue: Joey Arhar <[email protected]>
Reviewed-by: David Baron <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1393165}

--

wpt-commits: cebbe649f588028ec15cf314acc425d77f45da81
wpt-pr: 49576
  • Loading branch information
josepharhar authored and moz-wptsync-bot committed Dec 11, 2024
1 parent 78b0d0e commit 871742c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
test_valid_selector("::part(mypart):any-link");
test_valid_selector("::part(mypart):autofill");
test_valid_selector("::part(mypart):checked");
test_valid_selector("::part(mypart):closed");
test_valid_selector("::part(mypart):default");
test_valid_selector("::part(mypart):defined");
test_valid_selector("::part(mypart):dir(ltr)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,53 +17,39 @@
<script>
test(() => {
const dialog = document.querySelector('dialog');
assert_true(dialog.matches(':closed'),
':closed should match when the dialog is closed.');
assert_false(dialog.matches(':open'),
':open should not match when the dialog is closed.');

dialog.show();
assert_false(dialog.matches(':closed'),
':closed should not match after dialog.open().');
assert_true(dialog.matches(':open'),
':open should match after dialog.open().');

dialog.close();
dialog.showModal();
assert_false(dialog.matches(':closed'),
':closed should not match after dialog.showModal().');
assert_true(dialog.matches(':open'),
':open should match after dialog.showModal().');

dialog.close();
}, 'The dialog element should support :open and :closed.');
}, 'The dialog element should support :open.');

test(() => {
const details = document.querySelector('details');
assert_true(details.matches(':closed'),
':closed should match when the details is closed.');
assert_false(details.matches(':open'),
':open should not match when the details is closed.');

details.open = true;
assert_false(details.matches(':closed'),
':closed should not match when the details is open.');
assert_true(details.matches(':open'),
':open should match when the details is open.');
}, 'The details element should support :open and :closed.');
}, 'The details element should support :open.');

promise_test(async () => {
const select = document.querySelector('select');
assert_true(select.matches(':closed'),
':closed should match when the select is closed.');
assert_false(select.matches(':open'),
':open should not match when the select is closed.');

await test_driver.click(select);
await new Promise(requestAnimationFrame);
assert_false(select.matches(':closed'),
':closed should not match when the select is open.');
assert_true(select.matches(':open'),
':open should match when the select is open.');
}, 'The select element should support :open and :closed.');
}, 'The select element should support :open.');
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
select {
background-color: rgb(0, 0, 255);
}
select:closed {
select:not(:open) {
background-color: rgb(0, 255, 0);
}
select:open {
Expand All @@ -29,22 +29,22 @@
<script>
promise_test(async () => {
assert_equals(getComputedStyle(select).backgroundColor, 'rgb(0, 255, 0)',
'The select should match :closed at the start of the test.');
'The select should match :not(:open) at the start of the test.');

await test_driver.click(select);
assert_equals(getComputedStyle(select).backgroundColor, 'rgb(255, 0, 0)',
'The select should match :open when opened.');

await test_driver.click(opttwo);
assert_equals(getComputedStyle(select).backgroundColor, 'rgb(0, 255, 0)',
'The select should match :closed after clicking an option.');
'The select should match :not(:open) after clicking an option.');

await test_driver.click(select);
assert_equals(getComputedStyle(select).backgroundColor, 'rgb(255, 0, 0)',
'The select should match :open when reopened.');

await test_driver.click(button);
assert_equals(getComputedStyle(select).backgroundColor, 'rgb(0, 255, 0)',
'The select should match :closed after light dismiss.');
'The select should match :not(:open) after light dismiss.');
}, 'select should not match :open when light dismissed.');
</script>

0 comments on commit 871742c

Please sign in to comment.