Bug 1526700 [wpt PR 15267] - Add screen orientation test: fire event before promise is resolved, a=testonly

Automatic update from web-platform-tests
Add screen orientation test: fire event before promise is resolved (#15267)

--

wpt-commits: 8ed64687560332642c7b34ebd16011ae5b01d99a
wpt-pr: 15267
This commit is contained in:
Johanna 2019-02-19 14:39:38 +00:00 коммит произвёл moz-wptsync-bot
Родитель 53e22d355b
Коммит 8fa076c265
1 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,23 @@
<!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>
promise_test(async t => {
await test_driver.bless("request full screen", () => {
return document.documentElement.requestFullscreen();
});
const promiseToChange = new Promise(resolve => {
screen.orientation.addEventListener("change", resolve);
});
const result = await Promise.race([
screen.orientation.lock("landscape"),
promiseToChange
]);
assert_true(result instanceof Event, "Expected an instance of Event");
}, "The 'change' event must fire before the [[orientationPendingPromise]] is resolved.");
</script>