diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/embedded-content/media-elements/location-of-the-media-resource/currentSrc.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/embedded-content/media-elements/location-of-the-media-resource/currentSrc.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/location-of-the-media-resource/currentSrc.html b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/location-of-the-media-resource/currentSrc.html new file mode 100644 index 0000000000..be4d09f739 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/location-of-the-media-resource/currentSrc.html @@ -0,0 +1,48 @@ +<!doctype html> +<title>currentSrc</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +['audio', 'video'].forEach(function(tagName) { + test(function() { + assert_equals(document.createElement(tagName).currentSrc, ''); + }, tagName + '.currentSrc initial value'); + + ['', '.', ' ', 'data:,'].forEach(function(src) { + async_test(function(t) { + var e = document.createElement(tagName); + e.src = src; + assert_equals(e.currentSrc, ''); + e.addEventListener('loadstart', function () { + t.step_timeout(function () { + if (src == '') { + assert_equals(e.currentSrc, ''); + } else { + assert_equals(e.currentSrc, e.src); + } + t.done(); + }, 0); + }) + }, tagName + '.currentSrc after setting src attribute "' + src + '"'); + + async_test(function(t) { + var e = document.createElement(tagName); + var s = document.createElement('source'); + s.src = src; + e.appendChild(s); + assert_equals(e.currentSrc, ''); + e.addEventListener('loadstart', function() { + t.step_timeout(function () { + if (src == '') { + assert_equals(e.currentSrc, ''); + } else { + assert_equals(e.currentSrc, s.src); + } + t.done(); + }, 0); + }); + }, tagName + '.currentSrc after adding source element with src attribute "' + src + '"'); + }); +}); +</script> |