-
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.
Enable constructing Page{Reveal|Swap}Event
As per spec https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-pagerevealevent-interface https://html.spec.whatwg.org/multipage/nav-history-apis.html#pageswapevent Bug: 354588516 Change-Id: I108e5a16af2fc4da3d5030589c820c9fd309bf65 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5724461 Reviewed-by: Khushal Sagar <[email protected]> Commit-Queue: Noam Rosenthal <[email protected]> Cr-Commit-Position: refs/heads/main@{#1331321}
- Loading branch information
1 parent
cbf74ff
commit 95d7dbe
Showing
2 changed files
with
96 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!doctype html> | ||
<title>ßPageRevelEvent constructor</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-pagerevealevent-interface"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
test(function() { | ||
var e = new PageRevealEvent("something"); | ||
assert_true(e instanceof PageRevealEvent); | ||
assert_equals(e.type, "something"); | ||
assert_equals(e.viewTransition, null); | ||
}, "Constructing pagereveal event"); | ||
|
||
test(function() { | ||
var e = new PageRevealEvent("pagereveal"); | ||
assert_true(e instanceof PageRevealEvent); | ||
assert_equals(e.type, "pagereveal"); | ||
assert_equals(e.viewTransition, null); | ||
}, "Constructing pagereveal event with a custom name"); | ||
|
||
test(function() { | ||
var e = new PageRevealEvent("pagereveal", {}); | ||
assert_true(e instanceof PageRevealEvent); | ||
assert_equals(e.type, "pagereveal"); | ||
assert_equals(e.viewTransition, null); | ||
}, "Constructing pagereveal event with empty dictionary"); | ||
|
||
test(function() { | ||
var e = new PageRevealEvent("pagereveal", {viewTransition: null}); | ||
assert_true(e instanceof PageRevealEvent); | ||
assert_equals(e.type, "pagereveal"); | ||
assert_equals(e.viewTransition, null); | ||
}, "Constructing pagereveal event with a null viewTransition"); | ||
test(function() { | ||
const viewTransition = document.startViewTransition(); | ||
var e = new PageRevealEvent("pagereveal", {viewTransition}); | ||
assert_true(e instanceof PageRevealEvent); | ||
assert_equals(e.type, "pagereveal"); | ||
assert_equals(e.viewTransition, viewTransition); | ||
}, "Constructing pagereveal event with a viewTransition"); | ||
</script> |
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,54 @@ | ||
<!doctype html> | ||
<title> PageSwapEvent constructor</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-pageswapevent-interface"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
test(function() { | ||
var e = new PageSwapEvent("something"); | ||
assert_true(e instanceof PageSwapEvent); | ||
assert_equals(e.type, "something"); | ||
assert_equals(e.viewTransition, null); | ||
assert_equals(e.activation, null); | ||
}, "Constructing pageswap event"); | ||
|
||
test(function() { | ||
var e = new PageSwapEvent("pageswap"); | ||
assert_true(e instanceof PageSwapEvent); | ||
assert_equals(e.type, "pageswap"); | ||
assert_equals(e.viewTransition, null); | ||
assert_equals(e.activation, null); | ||
}, "Constructing pageswap event with a custom name"); | ||
|
||
test(function() { | ||
var e = new PageSwapEvent("pageswap", {}); | ||
assert_true(e instanceof PageSwapEvent); | ||
assert_equals(e.type, "pageswap"); | ||
assert_equals(e.viewTransition, null); | ||
assert_equals(e.activation, null); | ||
}, "Constructing pageswap event with empty dictionary"); | ||
|
||
test(function() { | ||
var e = new PageSwapEvent("pageswap", {viewTransition: null}); | ||
assert_true(e instanceof PageSwapEvent); | ||
assert_equals(e.type, "pageswap"); | ||
assert_equals(e.viewTransition, null); | ||
assert_equals(e.activation, null); | ||
}, "Constructing pageswap event with a null viewTransition"); | ||
test(function() { | ||
const viewTransition = document.startViewTransition(); | ||
var e = new PageSwapEvent("pageswap", {viewTransition}); | ||
assert_true(e instanceof PageSwapEvent); | ||
assert_equals(e.type, "pageswap"); | ||
assert_equals(e.viewTransition, viewTransition); | ||
}, "Constructing pageswap event with a viewTransition"); | ||
test(function() { | ||
const viewTransition = document.startViewTransition(); | ||
var e = new PageSwapEvent("pageswap", {viewTransition, activation: navigation.activation}); | ||
assert_true(e instanceof PageSwapEvent); | ||
assert_equals(e.type, "pageswap"); | ||
assert_equals(e.viewTransition, viewTransition); | ||
assert_equals(e.activation, navigation.activation); | ||
}, "Constructing pageswap event with a viewTransition and activation"); | ||
</script> |