]> git.proxmox.com Git - rustc.git/blame - tests/rustdoc-gui/scrape-examples-color.goml
New upstream version 1.71.1+dfsg1
[rustc.git] / tests / rustdoc-gui / scrape-examples-color.goml
CommitLineData
9c376795 1// Check that scrape example code blocks have the expected colors.
353b0b11 2go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
9c376795
FG
3show-text: true
4
5define-function: (
6 "check-colors",
7 (theme, highlight, highlight_focus, help_border, help_color, help_hover_border,
8 help_hover_color),
9 block {
353b0b11 10 set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }
9c376795
FG
11 reload:
12 wait-for: ".more-examples-toggle"
13 assert-css: (".scraped-example .example-wrap .rust span.highlight:not(.focus)", {
14 "background-color": |highlight|,
15 }, ALL)
16 assert-css: (".scraped-example .example-wrap .rust span.highlight.focus", {
17 "background-color": |highlight_focus|,
18 }, ALL)
19
20 assert-css: (".scraped-example-list .scrape-help", {
21 "border-color": |help_border|,
22 "color": |help_color|,
23 })
24 move-cursor-to: ".scraped-example-list .scrape-help"
25 assert-css: (".scraped-example-list .scrape-help:hover", {
26 "border-color": |help_hover_border|,
27 "color": |help_hover_color|,
28 })
29 // Moving the cursor to another item to not break next runs.
30 move-cursor-to: ".search-input"
31 }
32)
33
34call-function: ("check-colors", {
35 "theme": "ayu",
49aad941
FG
36 "highlight": "#5b3b01",
37 "highlight_focus": "#7c4b0f",
38 "help_border": "#aaa",
39 "help_color": "#eee",
40 "help_hover_border": "#fff",
41 "help_hover_color": "#fff",
9c376795
FG
42})
43call-function: ("check-colors", {
44 "theme": "dark",
49aad941
FG
45 "highlight": "#5b3b01",
46 "highlight_focus": "#7c4b0f",
47 "help_border": "#aaa",
48 "help_color": "#eee",
49 "help_hover_border": "#fff",
50 "help_hover_color": "#fff",
9c376795
FG
51})
52call-function: ("check-colors", {
53 "theme": "light",
49aad941
FG
54 "highlight": "#fcffd6",
55 "highlight_focus": "#f6fdb0",
56 "help_border": "#555",
57 "help_color": "#333",
58 "help_hover_border": "#000",
59 "help_hover_color": "#000",
9c376795 60})
9ffffee4
FG
61
62// Now testing the top and bottom background in case there is only one scraped examples.
353b0b11 63go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html"
9ffffee4
FG
64
65define-function: (
66 "check-background",
67 (theme, background_color_start, background_color_end),
68 block {
353b0b11 69 set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }
9ffffee4
FG
70 reload:
71 assert-css: (".scraped-example:not(.expanded) .code-wrapper::before", {
72 "background-image": "linear-gradient(" + |background_color_start| + ", " +
73 |background_color_end| + ")",
74 })
75 assert-css: (".scraped-example:not(.expanded) .code-wrapper::after", {
76 "background-image": "linear-gradient(to top, " + |background_color_start| + ", " +
77 |background_color_end| + ")",
78 })
79 },
80)
81
82call-function: ("check-background", {
83 "theme": "ayu",
49aad941 84 "background_color_start": "rgba(15, 20, 25, 1)",
9ffffee4
FG
85 "background_color_end": "rgba(15, 20, 25, 0)",
86})
87call-function: ("check-background", {
88 "theme": "dark",
49aad941 89 "background_color_start": "rgba(53, 53, 53, 1)",
9ffffee4
FG
90 "background_color_end": "rgba(53, 53, 53, 0)",
91})
92call-function: ("check-background", {
93 "theme": "light",
49aad941 94 "background_color_start": "rgba(255, 255, 255, 1)",
9ffffee4
FG
95 "background_color_end": "rgba(255, 255, 255, 0)",
96})