]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc-gui/search-result-display.goml
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / rustdoc-gui / search-result-display.goml
1 // Checks that the search results have the expected width.
2 goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
3 size: (900, 1000)
4 write: (".search-input", "test")
5 // To be SURE that the search will be run.
6 press-key: 'Enter'
7 wait-for: "#crate-search"
8 // The width is returned by "getComputedStyle" which returns the exact number instead of the
9 // CSS rule which is "50%"...
10 assert-css: (".search-results div.desc", {"width": "310px"})
11 size: (600, 100)
12 // As counter-intuitive as it may seem, in this width, the width is "100%", which is why
13 // when computed it's larger.
14 assert-css: (".search-results div.desc", {"width": "566px"})
15
16 // The result set is all on one line.
17 assert-css: (".search-results .result-name > span", {"display": "inline"})
18
19 // Check that the crate filter `<select>` is correctly handled when it goes to next line.
20 // To do so we need to update the length of one of its `<option>`.
21 size: (900, 900)
22
23 // First we check the current width, height and position.
24 assert-css: ("#crate-search", {"width": "223px"})
25 assert-css: (".search-results-title", {"height": "44px", "width": "640px"})
26 assert-css: ("#search", {"width": "640px"})
27
28 // Then we update the text of one of the `<option>`.
29 text: (
30     "#crate-search option",
31     "sdjfaksdjfaksjdbfkadsbfkjsadbfkdsbkfbsadkjfbkdsabfkadsfkjdsafa",
32 )
33
34 // Then we compare again to confirm the height didn't change.
35 assert-css: ("#crate-search", {"width": "527px"})
36 assert-css: (".search-results-title", {"height": "44px", "width": "640px"})
37 // And we check that the `<select>` isn't bigger than its container (".search-results-title").
38 assert-css: ("#search", {"width": "640px"})
39
40 // Now checking that the crate filter is working as expected too.
41 show-text: true
42 define-function: (
43     "check-filter",
44     (theme, border, filter, hover_border, hover_filter),
45     block {
46         local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
47         reload:
48         wait-for: "#crate-search"
49         assert-css: ("#crate-search", {"border": "1px solid " + |border|})
50         assert-css: ("#crate-search-div::after", {"filter": |filter|})
51         move-cursor-to: "#crate-search"
52         assert-css: ("#crate-search", {"border": "1px solid " + |hover_border|})
53         assert-css: ("#crate-search-div::after", {"filter": |hover_filter|})
54         move-cursor-to: ".search-input"
55     },
56 )
57
58 call-function: ("check-filter", {
59     "theme": "ayu",
60     "border": "rgb(92, 103, 115)",
61     "filter": "invert(0.41) sepia(0.12) saturate(4.87) hue-rotate(171deg) brightness(0.94) contrast(0.94)",
62     "hover_border": "rgb(224, 224, 224)",
63     "hover_filter": "invert(0.98) sepia(0.12) saturate(0.81) hue-rotate(343deg) brightness(1.13) contrast(0.76)",
64 })
65 call-function: ("check-filter", {
66     "theme": "dark",
67     "border": "rgb(224, 224, 224)",
68     "filter": "invert(0.94) sepia(0) saturate(7.21) hue-rotate(255deg) brightness(0.9) contrast(0.9)",
69     "hover_border": "rgb(33, 150, 243)",
70     "hover_filter": "invert(0.69) sepia(0.6) saturate(66.13) hue-rotate(184deg) brightness(1) contrast(0.91)",
71 })
72 call-function: ("check-filter", {
73     "theme": "light",
74     "border": "rgb(224, 224, 224)",
75     "filter": "invert(1) sepia(0) saturate(42.23) hue-rotate(289deg) brightness(1.14) contrast(0.76)",
76     "hover_border": "rgb(113, 113, 113)",
77     "hover_filter": "invert(0.44) sepia(0.18) saturate(0.23) hue-rotate(317deg) brightness(0.96) contrast(0.93)",
78 })