Skip to content

Commit a7a0b36

Browse files
committed
rustdoc: add test case for positioning of notable trait tooltip
1 parent 3dd7009 commit a7a0b36

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

src/test/rustdoc-gui/notable-trait.goml

+38-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,23 @@ assert-position: (
2424
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
2525
{"x": 951},
2626
)
27-
27+
// The tooltip should be beside the `i`
28+
click: "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']"
29+
compare-elements-position-near: (
30+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
31+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']",
32+
{"y": 2}
33+
)
34+
compare-elements-position-false: (
35+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
36+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']",
37+
("x")
38+
)
39+
// The docblock should be flush with the border.
40+
assert-css: (
41+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']/*[@class='docblock']",
42+
{"margin-left": "0px"}
43+
)
2844

2945
// Now only the `i` should be on the next line.
3046
size: (1055, 600)
@@ -81,6 +97,27 @@ assert-position: (
8197
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
8298
{"x": 289},
8399
)
100+
// The tooltip should be below `i`
101+
compare-elements-position-near-false: (
102+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
103+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']",
104+
{"y": 2}
105+
)
106+
compare-elements-position-false: (
107+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
108+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']",
109+
("x")
110+
)
111+
compare-elements-position-near: (
112+
"//*[@id='method.create_an_iterator_from_read']/parent::*",
113+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']",
114+
{"x": 5}
115+
)
116+
// The docblock should be flush with the border.
117+
assert-css: (
118+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits-tooltiptext force-tooltip']/*[@class='docblock']",
119+
{"margin-left": "0px"}
120+
)
84121

85122
// Checking on very small mobile. The `i` should be on its own line.
86123
size: (365, 600)

0 commit comments

Comments
 (0)