summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-highlight-api
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-highlight-api')
-rw-r--r--testing/web-platform/tests/css/css-highlight-api/HighlightRegistry-maplike-tampered-Map-prototype.html38
-rw-r--r--testing/web-platform/tests/css/css-highlight-api/historical.window.js7
-rw-r--r--testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001-ref.html16
-rw-r--r--testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001.html39
4 files changed, 81 insertions, 19 deletions
diff --git a/testing/web-platform/tests/css/css-highlight-api/HighlightRegistry-maplike-tampered-Map-prototype.html b/testing/web-platform/tests/css/css-highlight-api/HighlightRegistry-maplike-tampered-Map-prototype.html
index 3b38bd8f16..367ebfa8e0 100644
--- a/testing/web-platform/tests/css/css-highlight-api/HighlightRegistry-maplike-tampered-Map-prototype.html
+++ b/testing/web-platform/tests/css/css-highlight-api/HighlightRegistry-maplike-tampered-Map-prototype.html
@@ -29,33 +29,33 @@ test(() => {
tamperMapPrototype();
const highlight = new Highlight(new StaticRange({startContainer: document.body, endContainer: document.body, startOffset: 0, endOffset: 0}));
- const highlightRegister = new HighlightRegister();
+ const highlightRegistry = new HighlightRegistry();
- assert_equals(highlightRegister.size, 0);
- highlightRegister.set("foo", highlight);
- assert_equals(highlightRegister.size, 1);
+ assert_equals(highlightRegistry.size, 0);
+ highlightRegistry.set("foo", highlight);
+ assert_equals(highlightRegistry.size, 1);
- assert_true(highlightRegister.has("foo"));
- assert_equals([...highlightRegister.entries()][0][0], "foo");
+ assert_true(highlightRegistry.has("foo"));
+ assert_equals([...highlightRegistry.entries()][0][0], "foo");
- highlightRegister.clear();
- assert_equals(highlightRegister.size, 0);
- assert_equals(highlightRegister.get("foo"), undefined);
+ highlightRegistry.clear();
+ assert_equals(highlightRegistry.size, 0);
+ assert_equals(highlightRegistry.get("foo"), undefined);
- highlightRegister.set("bar", highlight);
- assert_equals(highlightRegister.get("bar"), highlight);
- assert_equals([...highlightRegister][0][1], highlight);
+ highlightRegistry.set("bar", highlight);
+ assert_equals(highlightRegistry.get("bar"), highlight);
+ assert_equals([...highlightRegistry][0][1], highlight);
- highlightRegister.delete("bar");
- assert_equals(highlightRegister.size, 0);
- assert_false(highlightRegister.has("bar"));
+ highlightRegistry.delete("bar");
+ assert_equals(highlightRegistry.size, 0);
+ assert_false(highlightRegistry.has("bar"));
- highlightRegister.set("baz", highlight);
- assert_equals([...highlightRegister.keys()][0], "baz");
- assert_equals([...highlightRegister.values()][0], highlight);
+ highlightRegistry.set("baz", highlight);
+ assert_equals([...highlightRegistry.keys()][0], "baz");
+ assert_equals([...highlightRegistry.values()][0], highlight);
let callbackCalled = false;
- highlightRegister.forEach(() => { callbackCalled = true; });
+ highlightRegistry.forEach(() => { callbackCalled = true; });
assert_true(callbackCalled);
}, "HighlightRegistry is a maplike interface that works as expected even if Map.prototype is tampered.");
</script>
diff --git a/testing/web-platform/tests/css/css-highlight-api/historical.window.js b/testing/web-platform/tests/css/css-highlight-api/historical.window.js
new file mode 100644
index 0000000000..9b735f855d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-highlight-api/historical.window.js
@@ -0,0 +1,7 @@
+// https://drafts.csswg.org/css-highlight-api-1/
+
+"use strict";
+
+test(() => {
+ assert_equals(self.HighlightRegister, undefined);
+}, "HighlightRegister was renamed");
diff --git a/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001-ref.html b/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001-ref.html
new file mode 100644
index 0000000000..aa76cf08b4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>CSS Highlight API Test: ::highlight text-decoration paints over higher priority when not clashing</title>
+ <style>
+ #yellow-highlight {
+ background-color: yellow;
+ text-decoration: underline;
+ text-decoration-color: red;
+ }
+ </style>
+</head>
+<body>
+ <span id="yellow-highlight">Yellow</span>
+</body>
+</html> \ No newline at end of file
diff --git a/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001.html b/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001.html
new file mode 100644
index 0000000000..7ab318b5a1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>CSS Highlight API Test: ::highlight text-decoration paints over higher priority when not clashing</title>
+ <link rel="help" href="https://www.w3.org/TR/css-highlight-api-1/#priorities">
+ <link rel="match" href="custom-highlight-painting-priority-text-decoration-001-ref.html">
+ <style>
+ ::highlight(yellow-highlight) {
+ background-color: yellow;
+ }
+ ::highlight(underline-highlight) {
+ text-decoration: underline;
+ text-decoration-color: red;
+ }
+ </style>
+</head>
+<body>
+ <span id="yellow-highlight">Yellow</span>
+
+ <script>
+ let yellow = document.getElementById("yellow-highlight");
+ let highlightYellow = new Highlight(new StaticRange({
+ startContainer: yellow.childNodes[0],
+ startOffset: 0,
+ endContainer: yellow.childNodes[0],
+ endOffset: 6
+ }));
+ let highlightUnderline = new Highlight(new StaticRange({
+ startContainer: yellow.childNodes[0],
+ startOffset: 0,
+ endContainer: yellow.childNodes[0],
+ endOffset: 6
+ }));
+ CSS.highlights.set("yellow-highlight", highlightYellow);
+ CSS.highlights.set("underline-highlight", highlightUnderline);
+ highlightYellow.priority = 10;
+ </script>
+</body>
+</html> \ No newline at end of file