-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test snapshotting of allowfullscreen attribute
Test for whatwg/html#2187
- Loading branch information
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
fullscreen/api/document-fullscreen-enabled-removing-allowfullscreen.sub.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,36 @@ | ||
<!DOCTYPE html> | ||
<title>Document#fullscreenEnabled removing allowfullscreen after load and then navigating</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
async_test((t) => { | ||
const iframe = document.createElement('iframe'); | ||
iframe.allowFullscreen = true; | ||
|
||
let i = 0; | ||
|
||
iframe.src = "http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/echo-fullscreenEnabled.html"; | ||
iframe.onload = t.step_func(() => { | ||
if (i === 0) { | ||
iframe.allowFullscreen = false; | ||
} | ||
iframe.contentWindow.postMessage('What is document.fullscreenEnabled?', '*'); | ||
}); | ||
|
||
window.onmessage = t.step_func((e) => { | ||
i++; | ||
if (i === 1) { | ||
assert_true(e.data, 'document.fullscreenEnabled in the iframe, before navigation'); | ||
|
||
// Navigate the iframe. This will fire a second 'load' event on the iframe. | ||
iframe.contentWindow.location.href = iframe.src + '?2'; | ||
} else { | ||
assert_false(e.data, 'document.fullscreenEnabled in the iframe, after navigation'); | ||
t.done(); | ||
} | ||
}); | ||
|
||
document.body.appendChild(iframe); | ||
}); | ||
</script> |
36 changes: 36 additions & 0 deletions
36
fullscreen/api/document-fullscreen-enabled-setting-allowfullscreen.sub.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,36 @@ | ||
<!DOCTYPE html> | ||
<title>Document#fullscreenEnabled setting allowfullscreen after load and then navigating</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
async_test((t) => { | ||
const iframe = document.createElement('iframe'); | ||
// no allowfullscreen attribute | ||
|
||
let i = 0; | ||
|
||
iframe.src = "http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/echo-fullscreenEnabled.html"; | ||
iframe.onload = t.step_func(() => { | ||
if (i === 0) { | ||
iframe.allowFullscreen = true; | ||
} | ||
iframe.contentWindow.postMessage('What is document.fullscreenEnabled?', '*'); | ||
}); | ||
|
||
window.onmessage = t.step_func((e) => { | ||
i++; | ||
if (i === 1) { | ||
assert_false(e.data, 'document.fullscreenEnabled in the iframe, before navigation'); | ||
|
||
// Navigate the iframe. This will fire a second 'load' event on the iframe. | ||
iframe.contentWindow.location.href = iframe.src + '?2'; | ||
} else { | ||
assert_true(e.data, 'document.fullscreenEnabled in the iframe, after navigation'); | ||
t.done(); | ||
} | ||
}); | ||
|
||
document.body.appendChild(iframe); | ||
}); | ||
</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,11 @@ | ||
<!doctype html> | ||
<script> | ||
window.onmessage = (e) => { | ||
if (e.data === 'What is document.fullscreenEnabled?') { | ||
e.source.postMessage(document.fullscreenEnabled, '*'); | ||
} else { | ||
e.source.postMessage('Incorrect message', '*'); | ||
} | ||
} | ||
</script> | ||
<p>This page echos document.fullscreenEnabled.</p> |