diff options
Diffstat (limited to 'src/test/rustdoc-gui/headings.goml')
-rw-r--r-- | src/test/rustdoc-gui/headings.goml | 258 |
1 files changed, 258 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/headings.goml b/src/test/rustdoc-gui/headings.goml new file mode 100644 index 000000000..8c2c3df15 --- /dev/null +++ b/src/test/rustdoc-gui/headings.goml @@ -0,0 +1,258 @@ +// This test checks that headers (a) have the correct heading level, (b) are the right size, +// and (c) have the correct underlining (or absence of underlining). +// The sizes may change as design changes, but try to make sure a lower header is never bigger than +// its parent headers. Also make sure lower headers don't have underlines when their parents lack +// an underline. +// Most of these sizes are set in CSS in `em` units, so here's a conversion chart based on our +// default 16px font size: +// 24px 1.5em +// 22px 1.375rem +// 20px 1.25rem +// 18px 1.125em +// 16px 1rem +// 14px 0.875rem +goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html + +assert-css: ("h1.fqn", {"font-size": "24px"}) + +assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"}) +assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"}) +assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"}) +assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"}) +assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "18px"}) +assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"}) + +assert-css: ("h2#fields", {"font-size": "22px"}) +assert-css: ("h2#fields", {"border-bottom-width": "1px"}) +assert-css: ("h3#title-for-field", {"font-size": "20px"}) +assert-css: ("h3#title-for-field", {"border-bottom-width": "0px"}) +assert-css: ("h4#sub-heading-for-field", {"font-size": "16px"}) +assert-css: ("h4#sub-heading-for-field", {"border-bottom-width": "0px"}) + +assert-css: ("h2#implementations", {"font-size": "22px"}) +assert-css: ("h2#implementations", {"border-bottom-width": "1px"}) + +assert-css: ("#impl-HeavilyDocumentedStruct > h3.code-header", {"font-size": "18px"}) +assert-css: ("#impl-HeavilyDocumentedStruct > h3.code-header", {"border-bottom-width": "0px"}) +assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"}) +assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"}) + +assert-css: ("h4#title-for-struct-impl-doc", {"font-size": "16px"}) +assert-css: ("h4#title-for-struct-impl-doc", {"border-bottom-width": "0px"}) +assert-css: ("h5#sub-heading-for-struct-impl-doc", {"font-size": "16px"}) +assert-css: ("h5#sub-heading-for-struct-impl-doc", {"border-bottom-width": "0px"}) +assert-css: ("h6#sub-sub-heading-for-struct-impl-doc", {"font-size": "14px"}) +assert-css: ("h6#sub-sub-heading-for-struct-impl-doc", {"border-bottom-width": "0px"}) + +assert-css: ("h5#title-for-struct-impl-item-doc", {"font-size": "16px"}) +assert-css: ("h5#title-for-struct-impl-item-doc", {"border-bottom-width": "0px"}) +assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"font-size": "14px"}) +assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"border-bottom-width": "0px"}) +assert-css: ("h6#sub-sub-heading-for-struct-impl-item-doc", {"font-size": "14px"}) + +goto: file://|DOC_PATH|/test_docs/enum.HeavilyDocumentedEnum.html + +assert-css: ("h1.fqn", {"font-size": "24px"}) + +assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"}) +assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"}) +assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"}) +assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"}) +assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "18px"}) +assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"}) + +assert-css: ("h2#variants", {"font-size": "22px"}) +assert-css: ("h2#variants", {"border-bottom-width": "1px"}) + +assert-css: ("h4#none-prose-title", {"font-size": "16px"}) +assert-css: ("h4#none-prose-title", {"border-bottom-width": "0px"}) +assert-css: ("h5#none-prose-sub-heading", {"font-size": "16px"}) +assert-css: ("h5#none-prose-sub-heading", {"border-bottom-width": "0px"}) + +assert-css: ("h4#wrapped-prose-title", {"font-size": "16px"}) +assert-css: ("h4#wrapped-prose-title", {"border-bottom-width": "0px"}) +assert-css: ("h5#wrapped-prose-sub-heading", {"font-size": "16px"}) +assert-css: ("h5#wrapped-prose-sub-heading", {"border-bottom-width": "0px"}) + +assert-css: ("h5#wrapped0-prose-title", {"font-size": "16px"}) +assert-css: ("h5#wrapped0-prose-title", {"border-bottom-width": "0px"}) +assert-css: ("h6#wrapped0-prose-sub-heading", {"font-size": "14px"}) +assert-css: ("h6#wrapped0-prose-sub-heading", {"border-bottom-width": "0px"}) + +assert-css: ("h5#structy-prose-title", {"font-size": "16px"}) +assert-css: ("h5#structy-prose-title", {"border-bottom-width": "0px"}) +assert-css: ("h6#structy-prose-sub-heading", {"font-size": "14px"}) +assert-css: ("h6#structy-prose-sub-heading", {"border-bottom-width": "0px"}) + +assert-css: ("h2#implementations", {"font-size": "22px"}) +assert-css: ("h2#implementations", {"border-bottom-width": "1px"}) + +assert-css: ("#impl-HeavilyDocumentedEnum > h3.code-header", {"font-size": "18px"}) +assert-css: ("#impl-HeavilyDocumentedEnum > h3.code-header", {"border-bottom-width": "0px"}) +assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"}) +assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"}) + +assert-css: ("h4#title-for-enum-impl-doc", {"font-size": "16px"}) +assert-css: ("h4#title-for-enum-impl-doc", {"border-bottom-width": "0px"}) +assert-css: ("h5#sub-heading-for-enum-impl-doc", {"font-size": "16px"}) +assert-css: ("h5#sub-heading-for-enum-impl-doc", {"border-bottom-width": "0px"}) +assert-css: ("h6#sub-sub-heading-for-enum-impl-doc", {"font-size": "14px"}) +assert-css: ("h6#sub-sub-heading-for-enum-impl-doc", {"border-bottom-width": "0px"}) + +assert-css: ("h5#title-for-enum-impl-item-doc", {"font-size": "16px"}) +assert-css: ("h5#title-for-enum-impl-item-doc", {"border-bottom-width": "0px"}) +assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"font-size": "14px"}) +assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"}) +assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"font-size": "14px"}) +assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"}) + +assert-text: (".sidebar .mod h3", "Modules") +assert-css: (".sidebar .mod h3", {"border-bottom-width": "0px"}, ALL) + +goto: file://|DOC_PATH|/test_docs/union.HeavilyDocumentedUnion.html + +assert-css: ("h1.fqn", {"font-size": "24px"}) + +assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"}) +assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"}) +assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"}) +assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"}) + +assert-css: ("h2#fields", {"font-size": "22px"}) +assert-css: ("h2#fields", {"border-bottom-width": "1px"}) + +assert-css: ("h3#title-for-union-variant", {"font-size": "20px"}) +assert-css: ("h3#title-for-union-variant", {"border-bottom-width": "0px"}) +assert-css: ("h4#sub-heading-for-union-variant", {"font-size": "16px"}) +assert-css: ("h4#sub-heading-for-union-variant", {"border-bottom-width": "0px"}) + +assert-css: ("h2#implementations", {"font-size": "22px"}) +assert-css: ("h2#implementations", {"border-bottom-width": "1px"}) + +assert-css: ("#impl-HeavilyDocumentedUnion > h3.code-header", {"font-size": "18px"}) +assert-css: ("#impl-HeavilyDocumentedUnion > h3.code-header", {"border-bottom-width": "0px"}) +assert-css: ("h4#title-for-union-impl-doc", {"font-size": "16px"}) +assert-css: ("h4#title-for-union-impl-doc", {"border-bottom-width": "0px"}) +assert-css: ("h5#sub-heading-for-union-impl-doc", {"font-size": "16px"}) +assert-css: ("h5#sub-heading-for-union-impl-doc", {"border-bottom-width": "0px"}) + +assert-css: ("h5#title-for-union-impl-item-doc", {"font-size": "16px"}) +assert-css: ("h5#title-for-union-impl-item-doc", {"border-bottom-width": "0px"}) +assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"font-size": "14px"}) +assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"border-bottom-width": "0px"}) + +goto: file://|DOC_PATH|/test_docs/macro.heavily_documented_macro.html + +assert-css: ("h1.fqn", {"font-size": "24px"}) + +assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"}) +assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"}) +assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"}) +assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"}) + +// Checking colors now. +show-text: true +local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} +goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html +assert-css: ( + ".top-doc .docblock h2", + {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"}, +) +assert-css: ( + ".top-doc .docblock h3", + {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"}, +) +assert-css: ( + ".top-doc .docblock h4", + {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"}, +) +assert-css: ( + ".top-doc .docblock h5", + {"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"}, +) +assert-css: ( + "#implementations-list .docblock h4", + {"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"}, +) +assert-css: ( + "#implementations-list .docblock h5", + {"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"}, +) +assert-css: ( + "#implementations-list .docblock h6", + {"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"}, +) + +local-storage: {"rustdoc-theme": "dark"} +reload: +assert-css: ( + ".top-doc .docblock h2", + {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"}, +) +assert-css: ( + ".top-doc .docblock h3", + {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"}, +) +assert-css: ( + ".top-doc .docblock h4", + {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"}, +) +assert-css: ( + ".top-doc .docblock h5", + {"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"}, +) +assert-css: ( + "#implementations-list .docblock h4", + {"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"}, +) +assert-css: ( + "#implementations-list .docblock h5", + {"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"}, +) +assert-css: ( + "#implementations-list .docblock h6", + {"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"}, +) + +local-storage: {"rustdoc-theme": "ayu"} +reload: +assert-css: ( + ".top-doc .docblock h2", + {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"}, +) +assert-css: ( + ".top-doc .docblock h2", + {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"}, +) +assert-css: ( + ".top-doc .docblock h4", + {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"}, +) +assert-css: ( + ".top-doc .docblock h5", + {"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"}, +) +assert-css: ( + "#implementations-list .docblock h4", + {"color": "rgb(255, 255, 255)", "border-bottom": "0px none rgb(92, 103, 115)"}, +) +assert-css: ( + "#implementations-list .docblock h5", + {"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"}, +) +assert-css: ( + "#implementations-list .docblock h6", + {"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"}, +) + +local-storage: {"rustdoc-theme": "light"} +goto: file://|DOC_PATH|/staged_api/struct.Foo.html +assert-css: (".since", {"color": "rgb(128, 128, 128)"}) + +local-storage: {"rustdoc-theme": "dark"} +reload: +assert-css: (".since", {"color": "rgb(128, 128, 128)"}) + +local-storage: {"rustdoc-theme": "ayu"} +reload: +assert-css: (".since", {"color": "rgb(128, 128, 128)"}) |