https://github.com/web-platform-tests/wpt
Raw File
Tip revision: a967a92aba4c779546abfb51de01e29972f9a82a authored by Anne van Kesteren on 05 February 2018, 09:22:44 UTC
add some tests (don't address all lint nits just yet)
Tip revision: a967a92
document-exit-fullscreen-active-document.html
<!DOCTYPE html>
<title>Document#exitFullscreen() when the document is not the active document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe allowfullscreen></iframe>
<script>
var t = async_test();

onload = t.step_func(() => {
  var iframe = document.querySelector("iframe");
  var documentBeforeNav = iframe.contentDocument;

  iframe.onload = t.step_func(() => {
    var p = documentBeforeNav.exitFullscreen();
    assert_true(p instanceof Promise, 'exitFullscreen() returns promise');
    // The promise should already be rejected, so its reject callback should be
    // invoked before a second promise's callback.
    p.catch(t.step_func_done());
    Promise.resolve().then(t.unreached_func('new promise resolved before exitFullscreen() promise rejected'));
  });

  // Navigate the iframe
  window[0].location.href = '/common/blank.html';
});
</script>
back to top