Skip to content

Commit

Permalink
Highlight API: Implement devtools support
Browse files Browse the repository at this point in the history
Bug: 1195196
Change-Id: I8ecc4b63e1502e2555c65ca324450ab1ffe16cc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2998242
Reviewed-by: Dan Clark <daniec@microsoft.com>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Commit-Queue: Fernando Fiori <ffiori@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#898375}
  • Loading branch information
ffiori authored and chromium-wpt-export-bot committed Jul 2, 2021
1 parent 80a4176 commit aebba15
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions css/css-pseudo/highlight-pseudos-computed.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@
#target::selection,
#target::target-text,
#target::spelling-error,
#target::grammar-error {
#target::grammar-error,
#target::highlight(foo) {
background-color: green;
color: lime;
}
#target::highlight(bar) {
background-color: blue;
color: yellow;
}
</style>
<div id="target"></div>
<script>
for (const pseudo of ["::selection", "::target-text", "::spelling-error", "::grammar-error"]) {
for (const pseudo of ["::selection", "::target-text", "::spelling-error", "::grammar-error", "::highlight(foo)"]) {
test(() => {
let style = getComputedStyle(target, pseudo);
assert_equals(style.backgroundColor, "rgb(0, 128, 0)", "Background color is green.");
Expand All @@ -31,4 +36,11 @@
}, `getComputedStyle() for ${illFormedPseudo} should be element's default`);
}
}

const pseudo = "::highlight(bar)";
test(() => {
let style = getComputedStyle(target, pseudo);
assert_equals(style.backgroundColor, "rgb(0, 0, 255)", "Background color is blue.");
assert_equals(style.color, "rgb(255, 255, 0)", "Color is yellow.");
}, `Different getComputedStyle() for ${pseudo} and same element`);
</script>

0 comments on commit aebba15

Please sign in to comment.