Update web-platform-tests to revision 289272c280086dda4bce0d31f2ce0fc1e7a08fa8

This commit is contained in:
WPT Sync Bot 2021-02-03 08:20:34 +00:00
parent 6f93950bf2
commit 78cf1982a2
230 changed files with 1832 additions and 1867 deletions

View file

@ -16,31 +16,35 @@
const popup1 = document.getElementById('p1');
const popup2 = document.getElementById('p2');
function popupVisible(popup) {
return !!(popup.offsetWidth || popup.offsetHeight || popup.getClientRects().length);
}
test(function(){
assert_false(popup1.open);
assert_false(popup2.open);
assert_equals(getComputedStyle(popup2).display,"none");
}, 'The IDL "open" content attribute must have no effect, and must not be reflected to the WebIDL.');
test(function(){
assert_false(popup1.open);
assert_false(popup1.hasAttribute("open"));
assert_equals(getComputedStyle(popup1).display,"none");
assert_false(popupVisible(popup1));
popup1.open = true; // Should have no effect
assert_false(popup1.open);
assert_false(popupVisible(popup1));
popup1.show();
assert_true(popup1.open);
assert_false(popup1.hasAttribute("open"));
assert_not_equals(getComputedStyle(popup1).display,"none");
assert_true(popupVisible(popup1));
popup1.open = false; // Should have no effect
assert_true(popup1.open);
popup1.hide();
assert_false(popup1.open);
assert_false(popup1.hasAttribute("open"));
assert_equals(getComputedStyle(popup1).display,"none");
assert_false(popupVisible(popup1));
popup1.setAttribute("open","");
assert_false(popup1.open,'Setting open attribute should not reflect to the WebIDL');
assert_true(popup1.hasAttribute("open"));
assert_equals(getComputedStyle(popup1).display,"none");
assert_false(popupVisible(popup1));
}, "The only visibility control for <popup> is through .show() and .hide().");
</script>

View file

@ -36,9 +36,7 @@
return findPopups(testRoot);
}
function popupVisible(popup) {
const style = getComputedStyle(popup);
return !!(style.display !== "none" && style.visibility !== "hidden" &&
(popup.offsetWidth || popup.offsetHeight || popup.getClientRects().length));
return !!(popup.offsetWidth || popup.offsetHeight || popup.getClientRects().length);
}
function showPopup(testId,popupNum) {
getPopupReferences(testId)[popupNum].show();

View file

@ -14,9 +14,11 @@
</popup>
<popup id=p3 anchor=b3><p>This is popup #3</p></popup>
<popup id=p4 anchor=b4><p>This is popup #4</p></popup>
<button id=b1 onclick='p1.show()'>Popup 1</button>
<dialog id=d1>This is a dialog<button onclick='this.parentElement.close()'>Close</button></dialog>
<button id=b5 onclick='d1.show()'>Dialog</button>
<script>
const popups = [p1, p2, p3, p4];
@ -45,6 +47,34 @@
p1.hide();
assertState(false,false,false,false);
}, "popup stacking behavior")
test(function() {
function openManyPopups() {
p1.show();
p2.show();
p3.show();
assertState(true,true,true,false);
}
openManyPopups();
d1.show(); // Dialog.show() should hide all popups.
assertState(false,false,false,false);
d1.close();
openManyPopups();
d1.showModal(); // Dialog.showModal() should also hide all popups.
assertState(false,false,false,false);
d1.close();
}, "popups should be closed by dialogs")
test(function() {
d1.show();
assert_true(d1.open);
p1.show();
assertState(true,false,false,false);
assert_true(d1.open);
p1.hide();
assert_true(d1.open);
d1.close();
}, "dialogs should not be closed by popups")
</script>
<style>