Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

  • This test has a WPT meta file that expects 1 subtest issues.
  • This WPT test may be referenced by the following Test IDs:
    • /html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-source-media-env-change.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>the &lt;source> media attribute: no reaction to environment change</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<iframe src="resources/media-min-width.html" width="300"></iframe>
<script>
// promises for the iframed test to resolve
let beforeEnvChange = new Promise((resolve, reject) => {
window[0].resolveBeforeEnvChange = resolve;
});
let afterEnvChange = new Promise((resolve, reject) => {
window[0].resolveAfterEnvChange = resolve;
});
let afterLoadCalled = new Promise((resolve, reject) => {
window[0].resolveAfterLoadCalled = resolve;
});
const t = promise_test(async () => {
[beforeEnvChange, afterEnvChange, afterLoadCalled] = await Promise.all([ beforeEnvChange, afterEnvChange, afterLoadCalled ]);
assert_equals(beforeEnvChange, '#a', 'beforeEnvChange');
assert_equals(afterEnvChange, '#a', 'afterEnvChange');
assert_equals(afterLoadCalled, '#b', 'afterLoadCalled');
});
</script>