-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine the popoverhide/popovershow events into one toggle event
See [1] for context. This eliminates the "popoverhide" and "popovershow" events, and re-uses the "toggle" event for both of these transitions. The event in this case is a ToggleEvent, which has a `state` that is either "opening" or "closing". [1] openui/open-ui#607 (comment) Bug: 1307772 Change-Id: I404861a10579365b56e6e8eae7c29f88a5aac166
- Loading branch information
1 parent
dbcd308
commit 2ff182f
Showing
8 changed files
with
182 additions
and
39 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
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
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
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
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
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
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
121 changes: 121 additions & 0 deletions
121
html/semantics/popovers/toggleevent-interface.tentative.html
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,121 @@ | ||
<!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> | ||
|
||
<script> | ||
test(function() { | ||
var event = new ToggleEvent(""); | ||
assert_true(event instanceof window.ToggleEvent); | ||
}, "the event is an instance of ToggleEvent"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent(""); | ||
assert_true(event instanceof window.Event); | ||
}, "the event inherts from Event"); | ||
|
||
test(function() { | ||
assert_throws_js(TypeError, function() { | ||
new ToggleEvent(); | ||
}, 'First argument is required, so was expecting a TypeError.'); | ||
}, 'Missing type argument'); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test"); | ||
assert_equals(event.type, "test"); | ||
}, "type argument is string"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent(null); | ||
assert_equals(event.type, "null"); | ||
}, "type argument is null"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent(undefined); | ||
assert_equals(event.type, "undefined"); | ||
}, "event type set to undefined"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test"); | ||
assert_equals(event.state, ""); | ||
}, "state has default value of empty string"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test"); | ||
assert_readonly(event, "state", "readonly attribute value"); | ||
}, "state is readonly"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", null); | ||
assert_equals(event.state, ""); | ||
}, "toggleEventInit argument is null"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", undefined); | ||
assert_equals(event.state, ""); | ||
}, "toggleEventInit argument is undefined"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", {}); | ||
assert_equals(event.state, ""); | ||
}, "toggleEventInit argument is empty dictionary"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", {state: "sample"}); | ||
assert_equals(event.state, "sample"); | ||
}, "state set to 'sample'"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", {state: undefined}); | ||
assert_equals(event.state, ""); | ||
}, "state set to undefined"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", {state: null}); | ||
assert_equals(event.state, "null"); | ||
}, "state set to null"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", {state: false}); | ||
assert_equals(event.state, "false"); | ||
}, "state set to false"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", {state: true}); | ||
assert_equals(event.state, "true"); | ||
}, "state set to true"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", {state: 0.5}); | ||
assert_equals(event.state, "0.5"); | ||
}, "state set to a number"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", {state: []}); | ||
assert_equals(event.state, ""); | ||
}, "state set to []"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", {state: [1, 2, 3]}); | ||
assert_equals(event.state, "1,2,3"); | ||
}, "state set to [1, 2, 3]"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", {state: {sample: 0.5}}); | ||
assert_equals(event.state, "[object Object]"); | ||
}, "state set to an object"); | ||
|
||
test(function() { | ||
var event = new ToggleEvent("test", | ||
{state: {valueOf: function () { return 'sample'; }}}); | ||
assert_equals(event.state, "[object Object]"); | ||
}, "state set to an object with a valueOf function"); | ||
|
||
test(function() { | ||
var eventInit = {state: "sample"}; | ||
var event = new ToggleEvent("test", eventInit); | ||
assert_equals(event.state, "sample"); | ||
}, "ToggleEventInit properties set value"); | ||
</script> |