File: scrape-examples-toggle.goml

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (54 lines) | stat: -rw-r--r-- 1,862 bytes parent folder | download | duplicates (3)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// This tests checks that the "scraped examples" toggle is working as expected.
include: "utils.goml"
go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"

// Checking the color of the toggle line.
show-text: true
define-function: (
    "check-color",
    [theme, toggle_line_color, toggle_line_hover_color],
    block {
        call-function: ("switch-theme", {"theme": |theme|})
        reload:

        // Clicking "More examples..." will open additional examples
        assert-attribute-false: (".more-examples-toggle", {"open": ""})
        click: ".more-examples-toggle"
        assert-attribute: (".more-examples-toggle", {"open": ""})

        assert-css: (".toggle-line-inner", {"background-color": |toggle_line_color|}, ALL)
        move-cursor-to: ".toggle-line"
        assert-css: (
            ".toggle-line:hover .toggle-line-inner",
            {"background-color": |toggle_line_hover_color|},
        )
        // We put the toggle in the original state.
        click: ".more-examples-toggle"
        // Moving cursor away from the toggle line to prevent disrupting next test.
        move-cursor-to: ".search-input"
    },
)

call-function: ("check-color", {
    "theme": "ayu",
    "toggle_line_color": "#999",
    "toggle_line_hover_color": "#c5c5c5",
})
call-function: ("check-color", {
    "theme": "dark",
    "toggle_line_color": "#999",
    "toggle_line_hover_color": "#c5c5c5",
})
call-function: ("check-color", {
    "theme": "light",
    "toggle_line_color": "#ccc",
    "toggle_line_hover_color": "#999",
})

// Toggling all docs will close additional examples
click: "#toggle-all-docs"
assert-attribute-false: (".more-examples-toggle", {"open": ""})

// After re-opening the docs, the additional examples should stay closed
click: "#toggle-all-docs"
assert-attribute-false: (".more-examples-toggle", {"open": ""})