Skip to content

Commit 99906dc

Browse files
Add rustdoc GUI test to check click on code examples
1 parent a7cb1a5 commit 99906dc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// This test ensures that code blocks buttons are displayed on hover and when you click on them.
2+
go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
3+
4+
// First we check we "hover".
5+
move-cursor-to: ".example-wrap"
6+
assert-css: (".example-wrap .copy-button", { "visibility": "visible" })
7+
move-cursor-to: ".search-input"
8+
assert-css: (".example-wrap .copy-button", { "visibility": "hidden" })
9+
10+
// Now we check the click.
11+
assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0)
12+
click: ".example-wrap"
13+
move-cursor-to: ".search-input"
14+
// It should have a new class and be visible.
15+
wait-for-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 1)
16+
wait-for-css: (".example-wrap:not(:hover) .button-holder.keep-visible", { "visibility": "visible" })
17+
// Clicking again will remove the class.
18+
click: ".example-wrap"
19+
move-cursor-to: ".search-input"
20+
assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0)
21+
assert-css: (".example-wrap .copy-button", { "visibility": "hidden" })

0 commit comments

Comments
 (0)