1
1
// This test ensures that code blocks buttons are displayed on hover and when you click on them.
2
2
go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
3
+ include: "utils.goml"
3
4
4
5
// First we check we "hover".
5
6
move-cursor-to: ".example-wrap"
@@ -19,3 +20,71 @@ click: ".example-wrap"
19
20
move-cursor-to: ".search-input"
20
21
assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0)
21
22
assert-css: (".example-wrap .copy-button", { "visibility": "hidden" })
23
+
24
+ define-function: (
25
+ "check-buttons",
26
+ [theme, background, filter, filter_hover],
27
+ block {
28
+ call-function: ("switch-theme", {"theme": |theme|})
29
+
30
+ assert-css: (".example-wrap .test-arrow", {"visibility": "hidden"})
31
+ assert-css: (".example-wrap .copy-button", {"visibility": "hidden"})
32
+
33
+ move-cursor-to: ".example-wrap"
34
+ assert-css: (".example-wrap .test-arrow", {
35
+ "visibility": "visible",
36
+ "background-color": |background|,
37
+ "border-radius": "2px",
38
+ })
39
+ assert-css: (".example-wrap .test-arrow::before", {
40
+ "filter": |filter|,
41
+ })
42
+ assert-css: (".example-wrap .copy-button", {
43
+ "visibility": "visible",
44
+ "background-color": |background|,
45
+ "border-radius": "2px",
46
+ })
47
+ assert-css: (".example-wrap .copy-button::before", {
48
+ "filter": |filter|,
49
+ })
50
+
51
+ move-cursor-to: ".example-wrap .test-arrow"
52
+ assert-css: (".example-wrap .test-arrow:hover", {
53
+ "visibility": "visible",
54
+ "background-color": |background|,
55
+ "border-radius": "2px",
56
+ })
57
+ assert-css: (".example-wrap .test-arrow:hover::before", {
58
+ "filter": |filter_hover|,
59
+ })
60
+
61
+ move-cursor-to: ".example-wrap .copy-button"
62
+ assert-css: (".example-wrap .copy-button:hover", {
63
+ "visibility": "visible",
64
+ "background-color": |background|,
65
+ "border-radius": "2px",
66
+ })
67
+ assert-css: (".example-wrap .copy-button:hover::before", {
68
+ "filter": |filter_hover|,
69
+ })
70
+ },
71
+ )
72
+
73
+ call-function: ("check-buttons",{
74
+ "theme": "ayu",
75
+ "background": "#0f1419",
76
+ "filter": "invert(0.7)",
77
+ "filter_hover": "invert(1)",
78
+ })
79
+ call-function: ("check-buttons",{
80
+ "theme": "dark",
81
+ "background": "#353535",
82
+ "filter": "invert(0.5)",
83
+ "filter_hover": "invert(0.65)",
84
+ })
85
+ call-function: ("check-buttons",{
86
+ "theme": "light",
87
+ "background": "#fff",
88
+ "filter": "invert(0.5)",
89
+ "filter_hover": "invert(0.35)",
90
+ })
0 commit comments