summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-gui/font-weight.goml
blob: aad334d2bd29586e8aef37365aaacae1cf9e610b (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
// This test checks that the font weight is correctly applied.
goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html"
assert-css: ("//*[@class='rust item-decl']//a[text()='Alias']", {"font-weight": "400"})
assert-css: (
    "//*[@class='structfield small-section-header']//a[text()='Alias']",
    {"font-weight": "400"},
)
assert-css: ("#method\.a_method > .code-header", {"font-weight": "600"})
assert-css: ("#associatedtype\.X > .code-header", {"font-weight": "600"})
assert-css: ("#associatedconstant\.Y > .code-header", {"font-weight": "600"})

goto: "file://" + |DOC_PATH| + "/test_docs/type.SomeType.html"
assert-css: (".top-doc .docblock p", {"font-weight": "400"}, ALL)

goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert-css: (".impl-items .method > .code-header", {"font-weight": "600"}, ALL)

goto: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html"

// This is a complex selector, so here's how it works:
//
// * //pre[@class='rust item-decl'] — selects item-decl code block
// * /code — selects immediate child with tag code
// * /a[@class='constant'] — selects immediate child with tag a and class constant
// * //text() — selects child that is text node
// * /parent::* — selects immediate parent of the text node (the * means it can be any tag)
//
// This uses '/parent::*' as a proxy for the style of the text node.
// We can't just select the '<a>' because intermediate tags could be added.
assert-count: (
    "//pre[@class='rust item-decl']/code/a[@class='constant']//text()/parent::*",
    1,
)
assert-css: (
    "//pre[@class='rust item-decl']/code/a[@class='constant']//text()/parent::*",
    {"font-weight": "400"},
)

assert-count: (".methods .associatedtype", 1)
assert-css: (".methods .associatedtype", {"font-weight": "600"})
assert-count: (".methods .constant", 1)
assert-css: (".methods .constant", {"font-weight": "600"})
assert-css: (".methods .method > .code-header", {"font-weight": "600"})