mirror of
https://github.com/servo/servo.git
synced 2025-09-14 17:08:22 +01:00
Update web-platform-tests to revision 2d68590d46a990bf28a08d6384a59962d2e56bf6
This commit is contained in:
parent
bc03d32142
commit
ad4cc3691e
135 changed files with 1613 additions and 341 deletions
|
@ -1,4 +1,3 @@
|
|||
spec: https://w3c.github.io/screen-orientation/
|
||||
suggested_reviewers:
|
||||
- haoxli
|
||||
- marcoscaceres
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script>
|
||||
import { getOppositeOrientation } from "/screen-orientation/resources/orientation-utils.js";
|
||||
promise_test(async t => {
|
||||
await test_driver.bless("request full screen", () => {
|
||||
return document.documentElement.requestFullscreen();
|
||||
});
|
||||
const newOrientation = getOppositeOrientation();
|
||||
// This will reject, because the event will call lock() again.
|
||||
const pMustReject = screen.orientation.lock(newOrientation);
|
||||
// This one resolves, because we are re-locking.
|
||||
const pMustResolve = new Promise(r => {
|
||||
screen.orientation.onchange = () => {
|
||||
r(orientation.lock("any"));
|
||||
};
|
||||
});
|
||||
await promise_rejects(t, new TypeError(), pMustReject);
|
||||
await pMustResolve;
|
||||
screen.orientation.unlock();
|
||||
return document.exitFullscreen();
|
||||
}, "Re-locking orientation during event dispatch must reject existing orientationPendingPromise");
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
export async function loadIframe(src = "/screen-orientation/resources/blank.html") {
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.src = src;
|
||||
document.body.appendChild(iframe);
|
||||
return new Promise(r => {
|
||||
if (iframe.contentDocument.readyState === "complete") {
|
||||
return r(iframe);
|
||||
}
|
||||
iframe.onload = () => r(iframe);
|
||||
});
|
||||
}
|
||||
|
||||
export function getOppositeOrientation() {
|
||||
const { type: currentOrientation } = screen.orientation;
|
||||
const isPortrait = currentOrientation.includes("portrait");
|
||||
return (newOrientation = `${isPortrait ? "landscape" : "portrait"}`);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue