about summary refs log tree commit diff
path: root/src/test/rustdoc-gui/sidebar-source-code-display.goml
blob: 8f53e8627ee1c8bb973c5c270a478c89c788571c (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// This test ensures that the elements in the sidebar are displayed correctly.
javascript: false
goto: file://|DOC_PATH|/src/test_docs/lib.rs.html
// Since the javascript is disabled, there shouldn't be a toggle.
assert-false: "#sidebar-toggle"
// For some reason, we need to wait a bit here because it seems like the transition on opacity
// is being applied whereas it can't be reproduced in a browser...
wait-for-css: (".sidebar > *", {"visibility": "hidden", "opacity": 0})

// Let's retry with javascript enabled.
javascript: true
reload:
wait-for: "#sidebar-toggle"
assert-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
assert-css: (".sidebar > *:not(#sidebar-toggle)", {"visibility": "hidden", "opacity": 0})
// Let's expand the sidebar now.
click: "#sidebar-toggle"
// Because of the transition CSS, we check by using `wait-for-css` instead of `assert-css`.
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})

// Now we check the display of the sidebar items.
show-text: true

// First we start with the light theme.
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:
// Waiting for the sidebar to be displayed...
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
assert-css: (
    "#source-sidebar .expand + .children a.selected",
    {"color": "rgb(0, 0, 0)", "background-color": "rgb(255, 255, 255)"},
)
// Without hover.
assert-css: (
    "#source-sidebar .expand + .children > .files a:not(.selected)",
    {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
assert-css: (
    "#source-sidebar .expand + .children > .files a:not(.selected)",
    {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
)
// Without hover.
assert-css: (
    "#source-sidebar .expand + .children .folders .name",
    {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children .folders .name"
assert-css: (
    "#source-sidebar .expand + .children .folders .name",
    {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"},
)

// Now with the dark theme.
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
reload:
// Waiting for the sidebar to be displayed...
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
assert-css: (
    "#source-sidebar .expand + .children a.selected",
    {"color": "rgb(221, 221, 221)", "background-color": "rgb(51, 51, 51)"},
)
// Without hover.
assert-css: (
    "#source-sidebar .expand + .children > .files a:not(.selected)",
    {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
assert-css: (
    "#source-sidebar .expand + .children > .files a:not(.selected)",
    {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
)
// Without hover.
assert-css: (
    "#source-sidebar .expand + .children .folders .name",
    {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children .folders .name"
assert-css: (
    "#source-sidebar .expand + .children .folders .name",
    {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"},
)

// And finally with the ayu theme.
local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
reload:
// Waiting for the sidebar to be displayed...
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
assert-css: (
    "#source-sidebar .expand + .children a.selected",
    {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
)
// Without hover.
assert-css: (
    "#source-sidebar .expand + .children > .files a:not(.selected)",
    {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)"
assert-css: (
    "#source-sidebar .expand + .children > .files a:not(.selected)",
    {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
)
// Without hover.
assert-css: (
    "#source-sidebar .expand + .children .folders .name",
    {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"},
)
// With hover.
move-cursor-to: "#source-sidebar .expand + .children .folders .name"
assert-css: (
    "#source-sidebar .expand + .children .folders .name",
    {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"},
)