Skip to content

Commit

Permalink
Highlight API: Add 'type' attribute to Highlight
Browse files Browse the repository at this point in the history
As resolved in w3c/csswg-drafts#6498, this CL
adds a new attribute to Highlight which will be used for a more precise
Accessibility interpretation of the highlights.

(Exposure to ATs to be done in a following up CL)

Change-Id: I7a84a11e5f52b5b950d807ceb276b74395b1b164
  • Loading branch information
ffiori authored and chromium-wpt-export-bot committed Oct 12, 2021
1 parent 9c62f76 commit a5ea1db
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions css/css-highlight-api/Highlight-type-attribute.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!doctype html>
<title> Highlight type attribute tests </title>
<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
let customHighlight = new Highlight();
assert_equals(customHighlight.type, "highlight", 'Highlight uses \"highlight\" as default type.');

customHighlight.type = "type-not-listed-in-HighlightType-enum";
assert_equals(customHighlight.type, "highlight", 'Highlight type doesn\'t change after assigning an invalid value.');

customHighlight.type = "spelling-error";
assert_equals(customHighlight.type, "spelling-error", 'Highlight type changes to the assigned value if it\'s part of the HighlightType enum (\"spelling-error\"").');

customHighlight.type = "grammar-error";
assert_equals(customHighlight.type, "grammar-error", 'Highlight type changes to the assigned value if it\'s part of the HighlightType enum (\"grammar-error\").');
}, 'Highlight has a mutable \'type\' attribute that is a HighlightType enum.');
</script>

0 comments on commit a5ea1db

Please sign in to comment.