diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/semantics/scripting-1/the-script-element/nomodule-reflect.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/semantics/scripting-1/the-script-element/nomodule-reflect.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/scripting-1/the-script-element/nomodule-reflect.html | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/nomodule-reflect.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/nomodule-reflect.html new file mode 100644 index 0000000000..d6a850f58f --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/nomodule-reflect.html @@ -0,0 +1,75 @@ +<!DOCTYPE html> +<html> +<head> +<title>noModule IDL attribute must reflect nomodule content attribute</title> +<link rel="author" title="Yusuke Suzuki" href="mailto:utatane.tea@gmail.com"> +<link rel="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<script id="classicWithoutNomodule"></script> +<script id="classicWithNomodule" nomodule></script> +<script id="moduleWithoutNomodule" type=module></script> +<script id="moduleWithNomodule" type=module nomodule></script> +<script> + +test(() => { + assert_false(document.getElementById('classicWithoutNomodule').noModule); +}, 'noModule IDL attribute on a parser created classic script element without nomodule content attribute'); + +test(() => { + assert_true(document.getElementById('classicWithNomodule').noModule); +}, 'noModule IDL attribute on a parser created classic script element with nomodule content attribute'); + +test(() => { + assert_false(document.getElementById('moduleWithoutNomodule').noModule); +}, 'noModule IDL attribute on a parser created module script element without nomodule content attribute'); + +test(() => { + assert_true(document.getElementById('moduleWithNomodule').noModule); +}, 'noModule IDL attribute on a parser created module script element with nomodule content attribute'); + + +test(() => { + const script = document.createElement('script'); + assert_false(script.noModule); +}, 'noModule IDL attribute on a dynamically created script element without nomodule content attribute'); + +test(() => { + const script = document.createElement('script'); + script.setAttribute('nomodule', 'nomodule'); + assert_true(script.noModule); +}, 'noModule IDL attribute on a dynamically created script element after nomodule content attribute is set to "nomodule"'); + +test(() => { + const script = document.createElement('script'); + script.setAttribute('nomodule', ''); + assert_true(script.noModule); +}, 'noModule IDL attribute on a dynamically created script element after nomodule content attribute is set to ""'); + +test(() => { + const script = document.createElement('script'); + script.setAttribute('nomodule', 'nomodule'); + assert_true(script.noModule); + script.removeAttribute('nomodule'); + assert_false(script.noModule); +}, 'noModule IDL attribute on a dynamically created script element after nomodule content attribute had been removed'); + +test(() => { + const script = document.createElement('script'); + assert_false(script.hasAttribute('nomodule')); + script.noModule = true; + assert_true(script.hasAttribute('nomodule')); +}, 'noModule IDL attribute must add nomodule content attribute on setting to true'); + +test(() => { + const script = document.createElement('script'); + script.setAttribute('nomodule', 'nomodule'); + script.noModule = false; + assert_false(script.hasAttribute('nomodule')); +}, 'noModule IDL attribute must remove nomodule content attribute on setting to false'); + +</script> +</body> +</html> |