Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename initiallyopen to defaultopen for popup #33876

Merged
merged 1 commit into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<div popup=popup id=p1 initiallyopen>
<div popup=popup id=p1 defaultopen>
Outer popup
<div popup=popup id=p2 initiallyopen>
<div popup=popup id=p2 defaultopen>
Inner popup
</div>
</div>
Expand All @@ -18,7 +18,7 @@
test(function(){
assert_true(p1.matches(':popup-open'),'The first (outermost) popup should be the one that opens in this case');
assert_false(p2.matches(':popup-open'),'The inner popup should not be open');
}, "The initiallyopen attribute should cause only the first popup to open");
}, "The defaultopen attribute should cause only the first popup to open");
});
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<meta charset="utf-8">
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<link rel=match href="popup-initiallyopen-display-ref.tentative.html">
<link rel=match href="popup-defaultopen-display-ref.tentative.html">

<div popup=popup id=p1 initiallyopen>This is a popup, which should be open upon load</div>
<div popup=popup id=p2 initiallyopen>This is a second popup with initiallyopen, which should NOT be open upon load</div>
<div popup=popup id=p1 defaultopen>This is a popup, which should be open upon load</div>
<div popup=popup id=p2 defaultopen>This is a second popup with defaultopen, which should NOT be open upon load</div>

<style>
[popup] {
Expand Down
46 changes: 46 additions & 0 deletions html/semantics/popups/popup-defaultopen.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<div popup=popup id=p1 defaultopen>This is a popup, which should be open upon load</div>
<script></script> <!-- Possibly yield the parser, just to double-check -->
<div popup=popup id=p2 defaultopen>This is a second popup with defaultopen, which should NOT be open upon load</div>
<div popup=hint id=p2b defaultopen>This is a hint popup with defaultopen, which should NOT be open upon load</div>
<div popup=popup id=p3>Also not visible</div>

<div popup=async id=p4 defaultopen>This is an async popup with defaultopen, which should be open upon load</div>
<div popup=async id=p5 defaultopen>This is an async popup with defaultopen, which should be open upon load</div>

<script>
requestAnimationFrame(() => {
requestAnimationFrame(() => {
test(function(){
assert_true(p1.matches(':popup-open'),'defaultopen should open the popup');
assert_true(p1.hasAttribute('defaultopen'));
assert_true(p1.defaultOpen,'defaultopen should be reflected in the IDL attribute');
assert_false(p2.matches(':popup-open'), 'Only the first popup with defaultopen should be open on load');
assert_true(p2.hasAttribute('defaultopen'),'defaultopen should be present/true, even if not opened');
assert_true(p2.defaultOpen,'defaultopen should be present/true, even if not opened');

assert_false(p2b.matches(':popup-open'),'Only the first popup/hint with defaultopen should be open on load');
assert_true(p4.matches(':popup-open'),'defaultopen should open all async popups');
assert_true(p5.matches(':popup-open'),'defaultopen should open all async popups');

assert_false(p3.matches(':popup-open'));
p3.setAttribute('defaultopen','');
assert_false(p3.matches(':popup-open'), 'Changing defaultopen should not affect open status');
assert_true(p3.hasAttribute('defaultopen'));
assert_true(p3.defaultOpen,'defaultopen should still reflect to IDL');

p1.removeAttribute('defaultopen');
assert_true(p1.matches(':popup-open'),'removing defaultopen should not close the popup');
assert_false(p1.hasAttribute('defaultopen'),'...but it should reflect to IDL');

p1.hidePopup();
}, "The defaultopen attribute should affect page load only");
});
});
</script>
46 changes: 0 additions & 46 deletions html/semantics/popups/popup-initiallyopen.tentative.html

This file was deleted.