]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/search-result-color.goml
Auto merge of #94566 - yanganto:show-ignore-message, r=m-ou-se
[rust.git] / src / test / rustdoc-gui / search-result-color.goml
1 // The goal of this test is to ensure the color of the text is the one expected.
2 goto: file://|DOC_PATH|/test_docs/index.html?search=coo
3
4 // This is needed so that the text color is computed.
5 show-text: true
6
7 // Ayu theme
8 local-storage: {
9     "rustdoc-theme": "ayu",
10     "rustdoc-preferred-dark-theme": "ayu",
11     "rustdoc-use-system-theme": "false",
12 }
13 reload:
14
15 // Waiting for the search results to appear...
16 wait-for: "#titles"
17 assert-css: (
18     "//*[@class='desc']//*[text()='Just a normal struct.']",
19     {"color": "rgb(197, 197, 197)"},
20 )
21 assert-css: (
22     "//*[@class='result-name']/*[text()='test_docs::']",
23     {"color": "rgb(0, 150, 207)"},
24 )
25
26 // Checking the color for "keyword".
27 assert-css: (
28     "//*[@class='result-name']//*[text()='(keyword)']",
29     {"color": "rgb(120, 135, 151)"},
30 )
31
32 // Dark theme
33 local-storage: {
34     "rustdoc-theme": "dark",
35     "rustdoc-preferred-dark-theme": "dark",
36     "rustdoc-use-system-theme": "false",
37 }
38 reload:
39
40 // Waiting for the search results to appear...
41 wait-for: "#titles"
42 assert-css: (
43     "//*[@class='desc']//*[text()='Just a normal struct.']",
44     {"color": "rgb(221, 221, 221)"},
45 )
46 assert-css: (
47     "//*[@class='result-name']/*[text()='test_docs::']",
48     {"color": "rgb(221, 221, 221)"},
49 )
50
51 // Checking the color for "keyword".
52 assert-css: (
53     "//*[@class='result-name']//*[text()='(keyword)']",
54     {"color": "rgb(221, 221, 221)"},
55 )
56
57 // Light theme
58 local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
59 reload:
60
61 // Waiting for the search results to appear...
62 wait-for: "#titles"
63 assert-css: (
64     "//*[@class='desc']//*[text()='Just a normal struct.']",
65     {"color": "rgb(0, 0, 0)"},
66 )
67 assert-css: (
68     "//*[@class='result-name']/*[text()='test_docs::']",
69     {"color": "rgb(0, 0, 0)"},
70 )
71
72 // Checking the color for "keyword".
73 assert-css: (
74     "//*[@class='result-name']//*[text()='(keyword)']",
75     {"color": "rgb(0, 0, 0)"},
76 )
77
78 // Check the alias more specifically in the dark theme.
79 goto: file://|DOC_PATH|/test_docs/index.html
80 // We set the theme so we're sure that the correct values will be used, whatever the computer
81 // this test is running on.
82 local-storage: {
83     "rustdoc-theme": "dark",
84     "rustdoc-preferred-dark-theme": "dark",
85     "rustdoc-use-system-theme": "false",
86 }
87 // If the text isn't displayed, the browser doesn't compute color style correctly...
88 show-text: true
89 // We reload the page so the local storage settings are being used.
90 reload:
91 write: (".search-input", "thisisanalias")
92 // Waiting for the search results to appear...
93 wait-for: "#titles"
94 // Checking that the colors for the alias element are the ones expected.
95 assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
96 assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})