Skip to content

Commit

Permalink
Add ::search-text getComputedStyle subtests
Browse files Browse the repository at this point in the history
Add various ::search-text getComputedStyle subtests to match similar
tests for other highlight pseudos.

Change-Id: I5c8fbc6742167e5832d69208dddd9746f75365ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5899323
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Rob Buis <rbuis@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1362666}
  • Loading branch information
rwlbuis authored and chromium-wpt-export-bot committed Oct 1, 2024
1 parent 2bf79d5 commit 260920b
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
color: currentcolor;
background-color: currentcolor;
}
#target::search-text {
color: currentcolor;
background-color: currentcolor;
}
#target::search-text:current {
color: red;
background-color: red;
}
#target::spelling-error {
color: currentcolor;
background-color: currentcolor;
Expand All @@ -33,7 +41,7 @@
</style>
<div id="target"><span id="child"></span></div>
<script>
for (const pseudo of ["::selection", "::target-text", "::spelling-error", "::grammar-error", "::highlight(foo)"]) {
for (const pseudo of ["::selection", "::target-text", "::search-text", "::spelling-error", "::grammar-error", "::highlight(foo)"]) {
test(() => {
let style = getComputedStyle(child, pseudo);
assert_equals(style.backgroundColor, "rgb(0, 255, 0)", "Background color is lime.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
a:visited::target-text {
color: currentcolor;
}
a:visited::search-text {
color: currentcolor;
}
a:visited::search-text:current {
color: red;
}
a:visited::spelling-error {
color: currentcolor;
}
Expand All @@ -31,7 +37,7 @@
<a id="target1" class="target" href=""></a>
<a id="target2" class="target" href="unvisited"></a>
<script>
for (const pseudo of ["::selection", "::target-text", "::spelling-error", "::grammar-error", "::highlight(foo)"]) {
for (const pseudo of ["::selection", "::target-text", "::search-text", "::spelling-error", "::grammar-error", "::highlight(foo)"]) {
for (const target of [target1, target2]) {
test(() => {
let style = getComputedStyle(target, pseudo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
color: currentcolor;
background-color: currentcolor;
}
.target::search-text {
color: currentcolor;
background-color: currentcolor;
}
.target::search-text:current {
color: red;
background-color: red;
}
.target::spelling-error {
color: currentcolor;
background-color: currentcolor;
Expand All @@ -56,7 +64,7 @@
<span id="target2" class="target"></span>
</div>
<script>
for (const pseudo of ["::selection", "::target-text", "::spelling-error", "::grammar-error", "::highlight(foo)"]) {
for (const pseudo of ["::selection", "::target-text", "::search-text", "::spelling-error", "::grammar-error", "::highlight(foo)"]) {
for (const target of [target1, target2]) {
test(() => {
let style = getComputedStyle(target, pseudo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
background-color: green;
color: lime;
}
.target::search-text {
background-color: green;
color: lime;
}
.target::search-text:current {
background-color: red;
color: red;
}
.target::spelling-error {
background-color: green;
color: lime;
Expand All @@ -30,7 +38,7 @@
<div class="target"><span id="child1"></span></div>
<div class="target" style="display: contents;"><span id="child2"></span></div>
<script>
for (const pseudo of ["::selection", "::target-text", "::spelling-error", "::grammar-error", "::highlight(foo)"]) {
for (const pseudo of ["::selection", "::target-text", "::search-text", "::spelling-error", "::grammar-error", "::highlight(foo)"]) {
for (const child of [child1, child2]) {
test(() => {
let style = getComputedStyle(child, pseudo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
a::target-text {
color: lime;
}
a::search-text {
color: lime;
}
a::search-text:current {
color: red;
}
a::spelling-error {
color: lime;
}
Expand All @@ -26,6 +32,12 @@
a:visited::target-text {
color: yellow;
}
a:visited::search-text {
color: yellow;
}
a:visited::search-text:current {
color: red;
}
a:visited::spelling-error {
color: yellow;
}
Expand All @@ -39,7 +51,7 @@
<a id="target1" class="target" href=""></a>
<a id="target2" class="target" href="unvisited"></a>
<script>
for (const pseudo of ["::selection", "::target-text", "::spelling-error", "::grammar-error", "::highlight(foo)"]) {
for (const pseudo of ["::selection", "::target-text", "::search-text", "::spelling-error", "::grammar-error", "::highlight(foo)"]) {
for (const target of [target1, target2]) {
test(() => {
let style = getComputedStyle(target, pseudo);
Expand Down

0 comments on commit 260920b

Please sign in to comment.