• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Checks that the documentation toggles on mobile have the correct position, style and work
2// as expected.
3go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
4set-window-size: (433, 600)
5assert-attribute: (".top-doc", {"open": ""})
6click: (4, 270) // This is the position of the top doc comment toggle
7assert-attribute-false: (".top-doc", {"open": ""})
8click: (4, 270)
9assert-attribute: (".top-doc", {"open": ""})
10// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
11click: (3, 270)
12assert-attribute: (".top-doc", {"open": ""})
13
14// Assert the position of the toggle on the top doc block.
15assert-position: (".top-doc summary::before", {"x": 4})
16// Assert the position of the toggle on the impl block.
17assert-position: ("#implementations-list > details > summary::before", {"x": 4})
18// Assert the position of the toggle on a method.
19assert-position: (
20    "#trait-implementations-list .impl-items .method-toggle > summary::before",
21    {"x": 4},
22)
23
24// Now we do the same but with a little bigger width
25set-window-size: (600, 600)
26assert-attribute: (".top-doc", {"open": ""})
27click: (4, 270) // New Y position since all search elements are back on one line.
28assert-attribute-false: (".top-doc", {"open": ""})
29click: (4, 270)
30assert-attribute: (".top-doc", {"open": ""})
31// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
32click: (3, 270)
33assert-attribute: (".top-doc", {"open": ""})
34