Skip to content

Commit 149ab45

Browse files
Add GUI test for :target
1 parent 384059a commit 149ab45

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/test/rustdoc-gui/target.goml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Check that the targetted element has the expected styles.
2+
goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html#method.a_method"
3+
show-text: true
4+
5+
// Confirming that the method is the target.
6+
assert: "#method\.a_method:target"
7+
8+
define-function: (
9+
"check-style",
10+
(theme, background, border),
11+
[
12+
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
13+
("reload"),
14+
("assert-css", ("#method\.a_method:target", {
15+
"background-color": |background|,
16+
"border-right": "3px solid " + |border|,
17+
})),
18+
],
19+
)
20+
21+
call-function: ("check-style", {
22+
"theme": "ayu",
23+
"background": "rgba(255, 236, 164, 0.06)",
24+
"border": "rgba(255, 180, 76, 0.85)",
25+
})
26+
call-function: ("check-style", {
27+
"theme": "dark",
28+
"background": "rgb(73, 74, 61)",
29+
"border": "rgb(187, 116, 16)",
30+
})
31+
call-function: ("check-style", {
32+
"theme": "light",
33+
"background": "rgb(253, 255, 211)",
34+
"border": "rgb(173, 124, 55)",
35+
})

0 commit comments

Comments
 (0)