File: go-to-collapsed-elem.goml

package info (click to toggle)
rustc 1.70.0%2Bdfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 722,120 kB
  • sloc: xml: 147,962; javascript: 10,210; sh: 8,590; python: 8,220; ansic: 5,901; cpp: 4,635; makefile: 4,001; asm: 2,856
file content (40 lines) | stat: -rw-r--r-- 2,196 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// This test ensures that when clicking on a link which leads to an item inside a collapsed element,
// the collapsed element will be expanded.
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// We check that the implementors block is expanded.
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
// We now collapse the implementors block.
set-property: ("#implementations-list .implementors-toggle", {"open": "false"})
// And now we click on the link to the method to ensure it'll expand the implementors block.
click: "//*[@class='sidebar']//a[@href='#method.must_use']"
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})

define-function: ("collapsed-from-search", (), block {
    // Now we do the same through search result.
    // First we reload the page without the anchor in the URL.
    go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
    // Then we collapse the section again...
    set-property: ("#implementations-list .implementors-toggle", {"open": "false"})
    // Then we run the search.
    write: (".search-input", "foo::must_use")
    wait-for: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']"
    click: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']"
    assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
})

call-function: ("collapsed-from-search", {})

// Now running the same check but with mobile.
set-window-size: (600, 600)
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// We check that the implementors block is expanded.
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})
// We now collapse the implementors block.
set-property: ("#implementations-list .implementors-toggle", {"open": "false"})
// First we expand the mobile menu.
click: ".sidebar-menu-toggle"
// Then we click on the link to the method to ensure it'll expand the implementors block.
click: "//*[@class='sidebar shown']//a[@href='#method.must_use']"
assert-property: ("#implementations-list .implementors-toggle", {"open": "true"})

call-function: ("collapsed-from-search", {})