Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<title> Highlight type attribute tests </title>
<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>