summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-gui/run-on-hover.goml
blob: 1f87febcec6b6ac39c510eb407c7f2e465accc4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Example code blocks sometimes have a "Run" button to run them on the
// Playground. That button is hidden until the user hovers over the code block.
// This test checks that it is hidden, and that it shows on hover. It also
// checks for its color.
go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
show-text: true

define-function: (
    "check-run-button",
    (theme, color, background, hover_color, hover_background),
    block {
        set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
        reload:
        assert-css: (".test-arrow", {"visibility": "hidden"})
        move-cursor-to: ".example-wrap"
        assert-css: (".test-arrow", {
            "visibility": "visible",
            "color": |color|,
            "background-color": |background|,
            "font-size": "22px",
            "border-radius": "5px",
        })
        move-cursor-to: ".test-arrow"
        assert-css: (".test-arrow:hover", {
            "visibility": "visible",
            "color": |hover_color|,
            "background-color": |hover_background|,
            "font-size": "22px",
            "border-radius": "5px",
        })
    },
)

call-function: ("check-run-button", {
    "theme": "ayu",
    "color": "#788797",
    "background": "rgba(57, 175, 215, 0.09)",
    "hover_color": "#c5c5c5",
    "hover_background": "rgba(57, 175, 215, 0.37)",
})
call-function: ("check-run-button", {
    "theme": "dark",
    "color": "#dedede",
    "background": "rgba(78, 139, 202, 0.2)",
    "hover_color": "#dedede",
    "hover_background": "rgb(78, 139, 202)",
})
call-function: ("check-run-button", {
    "theme": "light",
    "color": "#f5f5f5",
    "background": "rgba(78, 139, 202, 0.2)",
    "hover_color": "#f5f5f5",
    "hover_background": "rgb(78, 139, 202)",
})