]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/font-weight.goml
Rollup merge of #95520 - rust-lang:ptrtypo, r=lcnr
[rust.git] / src / test / rustdoc-gui / font-weight.goml
1 // This test checks that the font weight is correctly applied.
2 goto: file://|DOC_PATH|/lib2/struct.Foo.html
3 assert-css: ("//*[@class='docblock item-decl']//a[text()='Alias']", {"font-weight": "400"})
4 assert-css: (
5     "//*[@class='structfield small-section-header']//a[text()='Alias']",
6     {"font-weight": "400"},
7 )
8 assert-css: ("#method\.a_method > .code-header", {"font-weight": "600"})
9 assert-css: ("#associatedtype\.X > .code-header", {"font-weight": "600"})
10 assert-css: ("#associatedconstant\.Y > .code-header", {"font-weight": "600"})
11
12 goto: file://|DOC_PATH|/test_docs/type.SomeType.html
13 assert-css: (".top-doc .docblock p", {"font-weight": "400"}, ALL)
14
15 goto: file://|DOC_PATH|/test_docs/struct.Foo.html
16 assert-css: (".impl-items .method", {"font-weight": "600"}, ALL)
17
18 goto: file://|DOC_PATH|/lib2/trait.Trait.html
19
20 // This is a complex selector, so here's how it works:
21 //
22 // * //*[@class='docblock item-decl'] — selects element of any tag with classes docblock and item-decl
23 // * /pre[@class='rust trait'] — selects immediate child with tag pre and classes rust and trait
24 // * /code — selects immediate child with tag code
25 // * /a[@class='constant'] — selects immediate child with tag a and class constant
26 // * //text() — selects child that is text node
27 // * /parent::* — selects immediate parent of the text node (the * means it can be any tag)
28 //
29 // This uses '/parent::*' as a proxy for the style of the text node.
30 // We can't just select the '<a>' because intermediate tags could be added.
31 assert-count: (
32     "//*[@class='docblock item-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*",
33     1,
34 )
35 assert-css: (
36     "//*[@class='docblock item-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*",
37     {"font-weight": "400"},
38 )
39
40 assert-count: (".methods .associatedtype", 1)
41 assert-css: (".methods .associatedtype", {"font-weight": "600"})
42 assert-count: (".methods .constant", 1)
43 assert-css: (".methods .constant", {"font-weight": "600"})
44 assert-css: (".methods .method", {"font-weight": "600"})