-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename initiallyopen to defaultopen for popup
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
1 parent
dd1250a
commit 69f8eb7
Showing
5 changed files
with
52 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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] { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file was deleted.
Oops, something went wrong.