1 // This test checks the position of the `i` for the notable traits.
2 goto: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html"
4 // We start with a wide screen.
6 // Checking they have the same y position.
7 compare-elements-position: (
8 "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
9 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
12 // Checking they don't have the same x position.
13 compare-elements-position-false: (
14 "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
15 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
18 // The `i` should be *after* the type.
20 "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
24 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
27 // The tooltip should be below the `i`
28 // Also, clicking the tooltip should bring its text into the DOM
29 assert-count: ("//*[@class='notable popover']", 0)
30 click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
31 assert-count: ("//*[@class='notable popover']", 1)
32 compare-elements-position-near: (
33 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
34 "//*[@class='notable popover']",
37 compare-elements-position-false: (
38 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
39 "//*[@class='notable popover']",
42 click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
43 move-cursor-to: "//h1"
44 assert-count: ("//*[@class='notable popover']", 0)
46 // Now only the `i` should be on the next line.
48 compare-elements-position-false: (
49 "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
50 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
54 // Now both the `i` and the struct name should be on the next line.
56 // Checking they have the same y position.
57 compare-elements-position: (
58 "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
59 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
62 // Checking they don't have the same x position.
63 compare-elements-position-false: (
64 "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
65 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
68 // The `i` should be *after* the type.
70 "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
74 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
78 // Checking on mobile now.
80 // Checking they have the same y position.
81 compare-elements-position: (
82 "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
83 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
86 // Checking they don't have the same x position.
87 compare-elements-position-false: (
88 "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
89 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
92 // The `i` should be *after* the type.
94 "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
98 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
101 // The tooltip should STILL be below `i`
102 click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
103 assert-count: ("//*[@class='notable popover']", 1)
104 compare-elements-position-near: (
105 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
106 "//*[@class='notable popover']",
109 compare-elements-position-false: (
110 "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
111 "//*[@class='notable popover']",
115 "//*[@class='notable popover']",
118 click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
119 move-cursor-to: "//h1"
120 assert-count: ("//*[@class='notable popover']", 0)
122 // Now check the colors.
125 (theme, header_color, content_color, type_color, trait_color),
127 ("goto", "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html"),
128 // This is needed to ensure that the text color is computed.
131 // Setting the theme.
132 ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
133 // We reload the page so the local storage settings are being used.
136 ("move-cursor-to", "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"),
137 ("assert-count", (".notable.popover", 1)),
140 ".notable.popover h3",
141 {"color": |header_color|},
145 ".notable.popover pre",
146 {"color": |content_color|},
150 ".notable.popover pre a.struct",
151 {"color": |type_color|},
155 ".notable.popover pre a.trait",
156 {"color": |trait_color|},
166 "content_color": "rgb(230, 225, 207)",
167 "header_color": "rgb(255, 255, 255)",
168 "type_color": "rgb(255, 160, 165)",
169 "trait_color": "rgb(57, 175, 215)",
177 "content_color": "rgb(221, 221, 221)",
178 "header_color": "rgb(221, 221, 221)",
179 "type_color": "rgb(45, 191, 184)",
180 "trait_color": "rgb(183, 140, 242)",
188 "content_color": "rgb(0, 0, 0)",
189 "header_color": "rgb(0, 0, 0)",
190 "type_color": "rgb(173, 55, 138)",
191 "trait_color": "rgb(110, 79, 201)",
197 // Check that pressing escape works
198 click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
199 move-cursor-to: "//*[@class='notable popover']"
200 assert-count: ("//*[@class='notable popover']", 1)
202 assert-count: ("//*[@class='notable popover']", 0)
204 // Check that clicking outside works.
205 click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
206 assert-count: ("//*[@class='notable popover']", 1)
207 click: ".search-input"
208 assert-count: ("//*[@class='notable popover']", 0)
210 // Check that pressing tab over and over works.
211 click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
212 move-cursor-to: "//*[@class='notable popover']"
213 assert-count: ("//*[@class='notable popover']", 1)
221 assert-count: ("//*[@class='notable popover']", 0)
222 assert: "#method\.create_an_iterator_from_read .notable-traits:focus"
224 // Now we check that the focus isn't given back to the wrong item when opening
226 store-window-property: (scroll, "scrollY")
227 click: "#method\.create_an_iterator_from_read .fnname"
228 // We ensure that the scroll position changed.
229 assert-window-property-false: {"scrollY": |scroll|}
230 // Store the new position.
231 store-window-property: (scroll, "scrollY")
232 click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
233 wait-for: "//*[@class='notable popover']"
234 click: "#settings-menu a"
235 click: ".search-input"
236 // We ensure we didn't come back to the previous focused item.
237 assert-window-property-false: {"scrollY": |scroll|}
239 // Same but with Escape handling.
240 store-window-property: (scroll, "scrollY")
241 click: "#method\.create_an_iterator_from_read .fnname"
242 // We ensure that the scroll position changed.
243 assert-window-property-false: {"scrollY": |scroll|}
244 // Store the new position.
245 store-window-property: (scroll, "scrollY")
246 click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
247 wait-for: "//*[@class='notable popover']"
248 click: "#settings-menu a"
250 // We ensure we didn't come back to the previous focused item.
251 assert-window-property-false: {"scrollY": |scroll|}