fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.6 KiB71 linesraw
1// This test ensures that opening the help page in its own tab works.
2go-to: "file://" + |DOC_PATH| + "/help.html"
3set-window-size: (1000, 1000) // Try desktop size first.
4wait-for: "#help"
5assert-css: ("#help", {"display": "block"})
6assert-css: ("#help dd", {"font-size": "16px"})
7click: "#help-button > a"
8assert-css: ("#help", {"display": "block"})
9compare-elements-property: (".sub", "#help", ["offsetWidth"])
10compare-elements-position: (".sub", "#help", ("x"))
11set-window-size: (500, 1000) // Try mobile next.
12assert-css: ("#help", {"display": "block"})
13compare-elements-property: (".sub", "#help", ["offsetWidth"])
14compare-elements-position: (".sub", "#help", ("x"))
15
16// Checking the color of the elements of the help menu.
17show-text: true
18define-function: (
19    "check-colors",
20    (theme, color, background, box_shadow),
21    block {
22        // Setting the theme.
23        set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
24        // We reload the page so the local storage settings are being used.
25        reload:
26        assert-css: ("#help kbd", {
27            "color": |color|,
28            "background-color": |background|,
29            "box-shadow": |box_shadow| + " 0px -1px 0px 0px inset",
30        }, ALL)
31    },
32)
33
34call-function: ("check-colors", {
35    "theme": "ayu",
36    "color": "#c5c5c5",
37    "background": "#314559",
38    "box_shadow": "#5c6773",
39})
40call-function: ("check-colors", {
41    "theme": "dark",
42    "color": "#000",
43    "background": "#fafbfc",
44    "box_shadow": "#c6cbd1",
45})
46call-function: ("check-colors", {
47    "theme": "light",
48    "color": "#000",
49    "background": "#fafbfc",
50    "box_shadow": "#c6cbd1",
51})
52
53// This test ensures that opening the help popover without switching pages works.
54go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
55set-window-size: (1000, 1000) // Only supported on desktop.
56assert-false: "#help"
57click: "#help-button > a"
58assert-css: ("#help", {"display": "block"})
59assert-css: ("#help dd", {"font-size": "16px"})
60click: "#help-button > a"
61assert-css: ("#help", {"display": "none"})
62compare-elements-property-false: (".sub", "#help", ["offsetWidth"])
63compare-elements-position-false: (".sub", "#help", ("x"))
64
65// This test ensures that the "the rustdoc book" anchor link within the help popover works.
66go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
67set-window-size: (1000, 1000) // Popover only appears when the screen width is >700px.
68assert-false: "#help"
69click: "#help-button > a"
70click: "//*[@id='help']//a[text()='the rustdoc book']"
71wait-for-document-property: ({"URL": "https://doc.rust-lang.org/"}, STARTS_WITH)