Skip to content

Commit 444024c

Browse files
committed
Resync the-audio-element from WPT Upstream
https://bugs.webkit.org/show_bug.cgi?id=308568 rdar://171098707 Reviewed by NOBODY (OOPS!). Upstream commit: web-platform-tests/wpt@77daedd * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/WEB_FEATURES.yml: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-attr-default.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-attr-default.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-attr-lazy.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-attr-lazy.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-attr-reflect.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-attr-reflect.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-autoplay-deferred.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-autoplay-deferred.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-eager.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-eager.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-autoplay-when-visible.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-autoplay-when-visible.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-disconnected.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-disconnected.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-in-scroller.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-in-scroller.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-in-viewport.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-in-viewport.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-not-rendered.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-not-rendered.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-to-eager.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-to-eager.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-window-onload.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-lazy-window-onload.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-deferred.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-deferred.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-preload-auto-deferred.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-preload-auto-deferred.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-preload-metadata-deferred.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-loading-load-preload-metadata-deferred.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/audio-with-replaced-after-pseudo-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/video-loading-attr-lazy.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/video-loading-attr-lazy.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/video-loading-attr-reflect.tentative-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/video-loading-attr-reflect.tentative.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-audio-element/w3c-import.log:
1 parent d062fdd commit 444024c

File tree

37 files changed

+744
-0
lines changed

37 files changed

+744
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
features:
2+
- name: audio
3+
files: "**"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
FAIL Audio loading attribute default should be eager when not set assert_equals: Audio loading property should be 'eager' when attribute is not set expected (string) "eager" but got (undefined) undefined
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<link rel="author" title="Squarespace" href="https://www.squarespace.com/">
3+
<script src="/resources/testharness.js"></script>
4+
<script src="/resources/testharnessreport.js"></script>
5+
6+
<audio id="target"></audio>
7+
8+
<script>
9+
const audio = document.getElementById("target");
10+
11+
test(() => {
12+
assert_equals(
13+
audio.loading,
14+
"eager",
15+
"Audio loading property should be 'eager' when attribute is not set"
16+
);
17+
}, "Audio loading attribute default should be eager when not set");
18+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
3+
FAIL Audio loading attribute should reflect the loading content attribute assert_equals: Audio loading attribute should be 'lazy' when set to 'lazy' expected (string) "lazy" but got (undefined) undefined
4+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<!-- Note: this is a reflection test that will ultimately be removed in favor of using the
3+
html/dom/elements-embedded.js file instead, once not tentative. -->
4+
<link rel="author" title="Squarespace" href="https://www.squarespace.com/">
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
8+
<audio id="target" loading="lazy" controls></audio>
9+
10+
<script>
11+
const audio = document.getElementById("target");
12+
13+
test(() => {
14+
assert_equals(
15+
audio.loading,
16+
"lazy",
17+
"Audio loading attribute should be 'lazy' when set to 'lazy'"
18+
);
19+
}, "Audio loading attribute should reflect the loading content attribute");
20+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
FAIL Audio loading attribute default value is 'eager' assert_equals: Default value should be 'eager' expected (string) "eager" but got (undefined) undefined
3+
FAIL Audio loading attribute reflects 'lazy' assert_equals: loading='lazy' should reflect as 'lazy' expected (string) "lazy" but got (undefined) undefined
4+
FAIL Audio loading attribute reflects 'eager' assert_equals: loading='eager' should reflect as 'eager' expected (string) "eager" but got (undefined) undefined
5+
FAIL Audio loading attribute with invalid value reflects as 'eager' assert_equals: Invalid value should reflect as 'eager' expected (string) "eager" but got (undefined) undefined
6+
FAIL Audio loading attribute with empty string reflects as 'eager' assert_equals: Empty string should reflect as 'eager' expected (string) "eager" but got (undefined) undefined
7+
FAIL Audio loading attribute is case-insensitive for 'lazy' assert_equals: Uppercase 'LAZY' should reflect as 'lazy' expected (string) "lazy" but got (undefined) undefined
8+
FAIL Audio loading attribute is case-insensitive for 'eager' assert_equals: Uppercase 'EAGER' should reflect as 'eager' expected (string) "eager" but got (undefined) undefined
9+
FAIL Setting audio.loading IDL attribute to 'lazy' assert_equals: Setting IDL to 'lazy' should set content attribute expected "lazy" but got "EAGER"
10+
FAIL Setting audio.loading IDL attribute to 'eager' assert_equals: Setting IDL to 'eager' should set content attribute expected "eager" but got "EAGER"
11+
FAIL Setting audio.loading IDL attribute to invalid value assert_equals: Setting IDL to 'invalid' should set content attribute expected "invalid" but got "EAGER"
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<!DOCTYPE html>
2+
<!-- Note: this is a reflection test that will ultimately be removed in favor of using the
3+
html/dom/elements-embedded.js file instead, once not tentative. -->
4+
<link rel="author" title="Squarespace" href="https://www.squarespace.com/">
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
8+
<audio id="target"></audio>
9+
10+
<script>
11+
const audio = document.getElementById("target");
12+
13+
test(() => {
14+
audio.removeAttribute("loading");
15+
assert_equals(audio.loading, "eager", "Default value should be 'eager'");
16+
}, "Audio loading attribute default value is 'eager'");
17+
18+
test(() => {
19+
audio.setAttribute("loading", "lazy");
20+
assert_equals(audio.loading, "lazy", "loading='lazy' should reflect as 'lazy'");
21+
}, "Audio loading attribute reflects 'lazy'");
22+
23+
test(() => {
24+
audio.setAttribute("loading", "eager");
25+
assert_equals(audio.loading, "eager", "loading='eager' should reflect as 'eager'");
26+
}, "Audio loading attribute reflects 'eager'");
27+
28+
test(() => {
29+
audio.setAttribute("loading", "invalid");
30+
assert_equals(audio.loading, "eager", "Invalid value should reflect as 'eager'");
31+
}, "Audio loading attribute with invalid value reflects as 'eager'");
32+
33+
test(() => {
34+
audio.setAttribute("loading", "");
35+
assert_equals(audio.loading, "eager", "Empty string should reflect as 'eager'");
36+
}, "Audio loading attribute with empty string reflects as 'eager'");
37+
38+
test(() => {
39+
audio.setAttribute("loading", "LAZY");
40+
assert_equals(audio.loading, "lazy", "Uppercase 'LAZY' should reflect as 'lazy'");
41+
}, "Audio loading attribute is case-insensitive for 'lazy'");
42+
43+
test(() => {
44+
audio.setAttribute("loading", "EAGER");
45+
assert_equals(audio.loading, "eager", "Uppercase 'EAGER' should reflect as 'eager'");
46+
}, "Audio loading attribute is case-insensitive for 'eager'");
47+
48+
test(() => {
49+
audio.loading = "lazy";
50+
assert_equals(audio.getAttribute("loading"), "lazy", "Setting IDL to 'lazy' should set content attribute");
51+
assert_equals(audio.loading, "lazy", "IDL should reflect 'lazy'");
52+
}, "Setting audio.loading IDL attribute to 'lazy'");
53+
54+
test(() => {
55+
audio.loading = "eager";
56+
assert_equals(audio.getAttribute("loading"), "eager", "Setting IDL to 'eager' should set content attribute");
57+
assert_equals(audio.loading, "eager", "IDL should reflect 'eager'");
58+
}, "Setting audio.loading IDL attribute to 'eager'");
59+
60+
test(() => {
61+
audio.loading = "invalid";
62+
assert_equals(audio.getAttribute("loading"), "invalid", "Setting IDL to 'invalid' should set content attribute");
63+
assert_equals(audio.loading, "eager", "IDL should reflect 'eager' for invalid content attribute");
64+
}, "Setting audio.loading IDL attribute to invalid value");
65+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
Harness Error (FAIL), message = Error: assert_unreached: Audio should not fire loadstart event when not visible in viewport Reached unreachable code
4+
5+
FAIL Audio with loading=lazy and autoplay that is not visible in viewport does not load audio data or autoplay assert_equals: expected 0 but got 4
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<link rel="author" title="Squarespace" href="https://www.squarespace.com/">
3+
<script src="/resources/testharness.js"></script>
4+
<script src="/resources/testharnessreport.js"></script>
5+
6+
<style>
7+
.below-viewport {
8+
margin-top: 1000vh;
9+
}
10+
</style>
11+
<body>
12+
13+
<script>
14+
const t = async_test(
15+
"Audio with loading=lazy and autoplay that is not visible in viewport does not load audio data or autoplay"
16+
);
17+
18+
const audio = document.createElement("audio");
19+
audio.loading = "lazy";
20+
audio.src = "/media/sine440.mp3";
21+
audio.className = "below-viewport";
22+
audio.autoplay = true;
23+
audio.controls = true;
24+
25+
audio.addEventListener("loadstart", () => {
26+
assert_unreached("Audio should not fire loadstart event when not visible in viewport");
27+
});
28+
29+
document.body.appendChild(audio);
30+
31+
t.step_timeout(() => {
32+
assert_equals(audio.readyState, HTMLMediaElement.HAVE_NOTHING);
33+
assert_true(audio.paused, "Audio should not autoplay when not visible in viewport");
34+
t.done();
35+
}, 2000);
36+
</script>
37+
</body>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
3+
PASS Audio with loading='eager' loads immediately regardless of viewport position
4+

0 commit comments

Comments
 (0)