Skip to content

Commit

Permalink
Rename initiallyopen to defaultopen for popup
Browse files Browse the repository at this point in the history
See the resolution below, but we've decided that `defaultopen` is a
better name for this feature. No functional changes.

openui/open-ui#500

Bug: 1307772
Change-Id: I9e11739a34d5180df889c9f93622bbddbd9bf982
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3615796
Auto-Submit: Mason Freed <[email protected]>
Reviewed-by: Joey Arhar <[email protected]>
Commit-Queue: Joey Arhar <[email protected]>
Commit-Queue: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#997905}
  • Loading branch information
mfreed7 authored and chromium-wpt-export-bot committed Apr 29, 2022
1 parent dd1250a commit 69f8eb7
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 52 deletions.
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.

0 comments on commit 69f8eb7

Please sign in to comment.