summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-gui/font-weight.goml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/rustdoc-gui/font-weight.goml
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-gui/font-weight.goml')
-rw-r--r--tests/rustdoc-gui/font-weight.goml44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/rustdoc-gui/font-weight.goml b/tests/rustdoc-gui/font-weight.goml
new file mode 100644
index 000000000..fafb15631
--- /dev/null
+++ b/tests/rustdoc-gui/font-weight.goml
@@ -0,0 +1,44 @@
+// This test checks that the font weight is correctly applied.
+goto: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html"
+assert-css: ("//*[@class='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:
+//
+// * //*[@class='item-decl'] — selects element of any tag with classes docblock and item-decl
+// * /pre[@class='rust'] — selects immediate child with tag pre and class rust
+// * /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: (
+ "//*[@class='item-decl']/pre[@class='rust']/code/a[@class='constant']//text()/parent::*",
+ 1,
+)
+assert-css: (
+ "//*[@class='item-decl']/pre[@class='rust']/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"})