about summary refs log tree commit diff
path: root/tests/rustdoc-gui/fields.goml
blob: dce9918c332425f5587f35022ee2b4fd0e7ecfd5 (plain)
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
// This test checks that fields are displayed as expected (one by line) and they are surrounded
// by margins.

store-value: (margin, "9.6px")
define-function: (
    "check-fields",
    [path, selector_1, selector_2],
    block {
        go-to: "file://" + |DOC_PATH| + "/test_docs/fields/" + |path|
        store-position: (|selector_1|, {"y": a_y})
        store-position: (|selector_2|, {"y": b_y})
        assert: |a_y| < |b_y|

        // Check the margins.
        assert-css: (".structfield.section-header", {
            "margin-top": |margin|,
            "margin-bottom": |margin|,
            "margin-left": "0px",
            "margin-right": "0px",
        }, ALL)
    }
)

call-function: ("check-fields", {
    "path": "struct.Struct.html",
    "selector_1": "#structfield\.a",
    "selector_2": "#structfield\.b",
})

call-function: ("check-fields", {
    "path": "union.Union.html",
    "selector_1": "#structfield\.a",
    "selector_2": "#structfield\.b",
})

go-to: "file://" + |DOC_PATH| + "/test_docs/fields/enum.Enum.html"
store-position: ("#variant\.A\.field\.a", {"y": a_y})
store-position: ("#variant\.A\.field\.b", {"y": b_y})
assert: |a_y| < |b_y|
store-position: ("#variant\.B\.field\.a", {"y": a_y})
store-position: ("#variant\.B\.field\.b", {"y": b_y})
assert: |a_y| < |b_y|

// Check the margins.
assert-css: (".sub-variant-field", {
    "margin-top": |margin|,
    "margin-bottom": |margin|,
    "margin-left": "24px",
    "margin-right": "0px",
}, ALL)