diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/html/semantics/document-metadata/styling | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/semantics/document-metadata/styling')
6 files changed, 112 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/document-metadata/styling/LinkStyle.html b/testing/web-platform/tests/html/semantics/document-metadata/styling/LinkStyle.html new file mode 100644 index 0000000000..d1bb433520 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/document-metadata/styling/LinkStyle.html @@ -0,0 +1,88 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>HTML Test: Styling</title> + <link rel="author" title="Intel" href="http://www.intel.com/"> + <link rel="help" href="https://html.spec.whatwg.org/multipage/#styling"> + <link id="style1" rel="text" title="Intel" href="./support/unmatch.css"> + <link id="style2" rel="alternate stylesheet" type="text/css" title="" href="./support/emptytitle.css"> + <link id="style3" rel="alternate stylesheet" type="text/css" href="./support/notitle.css"> + <link id="style5" rel="stylesheet" type="text/css" href="./support/normal.css"> + <link id="style6" rel="alternate stylesheet" type="text/css" href="./support/normal.css" title="./support/alternate.css"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <style id="style4" type="text/html"> + #test { + height: 100px; + width: 100px; + } + </style> + <style id="style7" type="text/css" media="all" title="./support/alternate.css"> + #test { + background-color: green; + } + </style> + </head> + <body> + <div id="log"></div> + <div id="test" style="display:none">STYLING TEST</div> + + <script> + /** + * Browsers may incorrectly issue requests for these resources and defer + * definition of the `sheet` attribute until after loading is complete. + * In such cases, synchronous assertions regarding the absence of + * attributes will spuriously pass. + * + * In order to account for this incorrect behavior (exhibited at the time + * of this writing most notably by the Chromium browser), defer the + * assertions until the "load" event has been triggered. + */ + async_test(function(t) { + window.addEventListener("load", t.step_func(function() { + var style = null, + i; + for (i = 1; i < 5; i++) { + style = document.getElementById("style" + i); + assert_equals(style.sheet, null, "The sheet attribute of style" + i + " should be null."); + assert_false(style.disabled, "The disabled attribute of style" + i + " should be false."); + } + t.done(); + })); + }, "The LinkStyle interface's sheet attribute must return null; the disabled attribute must be false"); + + test(function() { + var style = document.createElement("style"), + link = document.createElement("link"); + assert_equals(style.sheet, null, "The sheet attribute of the style element not in a document should be null."); + assert_equals(link.sheet, null, "The sheet attribute of the link element not in a document should be null."); + }, "The LinkStyle interface's sheet attribute must return null if the corresponding element is not in a Document"); + + async_test(function(t) { + window.addEventListener("load", t.step_func(function() { + var style = null, + i; + for (i = 5; i < 8; i++) { + style = document.getElementById("style" + i); + assert_true(style.sheet instanceof StyleSheet, "The sheet attribute of style" + i + " should be a StyleSheet object."); + assert_equals(style.disabled, style.sheet.disabled, "The disabled attribute of style" + i + " should equal to the same attribute of StyleSheet."); + } + t.done(); + })); + }, "The LinkStyle interface's sheet attribute must return StyleSheet object; the disabled attribute must be same as the StyleSheet's disabled attribute"); + + test(function() { + assert_equals(document.getElementById("style2").title, "", "The title attribute of style2 is incorrect."); + assert_equals(document.getElementById("style5").title, "", "The title attribute of style5 is incorrect."); + assert_equals(document.getElementById("style6").title, "./support/alternate.css", "The title attribute of style6 is incorrect."); + assert_equals(document.getElementById("style7").title, "./support/alternate.css", "The title attribute of style7 is incorrect."); + }, "The title must be the same as the value of the element's title content attribute"); + + test(function() { + assert_equals(document.getElementById("style5").media, "", "The media attribute of style5 is incorrect."); + assert_equals(document.getElementById("style7").media, "all", "The media attribute of style7 is incorrect."); + }, "The media must be the same as the value of the element's media content attribute, or the empty string if it is omitted"); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/semantics/document-metadata/styling/support/alternate.css b/testing/web-platform/tests/html/semantics/document-metadata/styling/support/alternate.css new file mode 100644 index 0000000000..b8deb07b0a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/document-metadata/styling/support/alternate.css @@ -0,0 +1,7 @@ +#test { + color: yellow; + background-color: blue; + width: 100px; + height: 50px; + font-size: .5em; +} diff --git a/testing/web-platform/tests/html/semantics/document-metadata/styling/support/emptytitle.css b/testing/web-platform/tests/html/semantics/document-metadata/styling/support/emptytitle.css new file mode 100644 index 0000000000..e62fe701b3 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/document-metadata/styling/support/emptytitle.css @@ -0,0 +1,4 @@ +#test { + width: 100px; + height: 100px; +} diff --git a/testing/web-platform/tests/html/semantics/document-metadata/styling/support/normal.css b/testing/web-platform/tests/html/semantics/document-metadata/styling/support/normal.css new file mode 100644 index 0000000000..a803c22112 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/document-metadata/styling/support/normal.css @@ -0,0 +1,5 @@ +#test { + width: 100px; + height: 50px; + font-size: 10px; +} diff --git a/testing/web-platform/tests/html/semantics/document-metadata/styling/support/notitle.css b/testing/web-platform/tests/html/semantics/document-metadata/styling/support/notitle.css new file mode 100644 index 0000000000..e62fe701b3 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/document-metadata/styling/support/notitle.css @@ -0,0 +1,4 @@ +#test { + width: 100px; + height: 100px; +} diff --git a/testing/web-platform/tests/html/semantics/document-metadata/styling/support/unmatch.css b/testing/web-platform/tests/html/semantics/document-metadata/styling/support/unmatch.css new file mode 100644 index 0000000000..e62fe701b3 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/document-metadata/styling/support/unmatch.css @@ -0,0 +1,4 @@ +#test { + width: 100px; + height: 100px; +} |