2022-02-24 11:18:10 +00:00
|
|
|
// 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...
|
2022-03-21 14:50:05 +00:00
|
|
|
wait-for-css: (".sidebar > *", {"visibility": "hidden", "opacity": 0})
|
2022-02-24 11:18:10 +00:00
|
|
|
|
|
|
|
// 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"
|
2022-05-10 14:42:34 +00:00
|
|
|
// Because of the transition CSS, we check by using `wait-for-css` instead of `assert-css`.
|
2022-03-21 14:50:05 +00:00
|
|
|
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
|
2022-06-25 20:22:35 +00:00
|
|
|
|
|
|
|
// 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)"},
|
|
|
|
)
|
2022-06-29 13:15:53 +00:00
|
|
|
|
|
|
|
// Now checking on mobile devices.
|
|
|
|
size: (500, 700)
|
|
|
|
reload:
|
|
|
|
// Waiting for the sidebar to be displayed...
|
|
|
|
wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1})
|
|
|
|
|
|
|
|
// We now check it takes the full size of the display.
|
|
|
|
assert-property: ("body", {"clientWidth": "500", "clientHeight": "700"})
|
|
|
|
assert-property: (".sidebar", {"clientWidth": "500", "clientHeight": "700"})
|