summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/portals/history/history-manipulation-inside-portal.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/portals/history/history-manipulation-inside-portal.html')
-rw-r--r--testing/web-platform/tests/portals/history/history-manipulation-inside-portal.html60
1 files changed, 60 insertions, 0 deletions
diff --git a/testing/web-platform/tests/portals/history/history-manipulation-inside-portal.html b/testing/web-platform/tests/portals/history/history-manipulation-inside-portal.html
new file mode 100644
index 0000000000..d4b0cf4db9
--- /dev/null
+++ b/testing/web-platform/tests/portals/history/history-manipulation-inside-portal.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/run-test-in-portal.js"></script>
+<body>
+<script>
+ var portalSrc =
+ 'resources/portal-manipulate-history.html';
+
+ // Runs before and after the history manipulation in the portal to confirm
+ // that the session history of the portal host is not affected by any history
+ // changes in the portal.
+ function assertInitialHistoryState() {
+ assert_equals(history.length, 1);
+ assert_false(!!history.state);
+ }
+
+ promise_test(async () => {
+ assert_implements("HTMLPortalElement" in self);
+ assertInitialHistoryState();
+ await runTestInPortal(portalSrc, 'testHistoryPushStateInPortal');
+ assertInitialHistoryState();
+ }, 'history.pushState navigates independently with replacement in a portal');
+
+ promise_test(async () => {
+ assert_implements("HTMLPortalElement" in self);
+ assertInitialHistoryState();
+ await runTestInPortal(portalSrc, 'testHistoryReplaceStateInPortal');
+ assertInitialHistoryState();
+ }, 'history.replaceState navigates independently in a portal');
+
+ promise_test(async () => {
+ assert_implements("HTMLPortalElement" in self);
+ assertInitialHistoryState();
+ await runTestInPortal(portalSrc, 'testLocationAssignInPortal');
+ assertInitialHistoryState();
+ }, 'location.assign navigates independently with replacement in a portal');
+
+ promise_test(async () => {
+ assert_implements("HTMLPortalElement" in self);
+ assertInitialHistoryState();
+ await runTestInPortal(portalSrc, 'testLocationReplaceInPortal');
+ assertInitialHistoryState();
+ }, 'location.replace navigates independently in a portal');
+
+ promise_test(async () => {
+ assert_implements("HTMLPortalElement" in self);
+ assertInitialHistoryState();
+ await runTestInPortal(portalSrc, 'testSetLocationHrefInPortal');
+ assertInitialHistoryState();
+ }, 'Setting location.href navigates independently with replacement in a portal');
+
+ promise_test(async () => {
+ assert_implements("HTMLPortalElement" in self);
+ assertInitialHistoryState();
+ await runTestInPortal(portalSrc, 'testSyntheticAnchorClickInPortal');
+ assertInitialHistoryState();
+ }, 'Synthetic anchor click navigates independently with replacement in a portal');
+</script>
+</body>