2021-10-20 05:48:53 +00:00
|
|
|
// This test checks that headers (a) have the correct heading level, (b) are the right size,
|
2021-10-22 06:09:11 +00:00
|
|
|
// and (c) have the correct underlining (or absence of underlining).
|
2021-10-22 20:45:10 +00:00
|
|
|
// The sizes may change as design changes, but try to make sure a lower header is never bigger than
|
2021-10-22 06:09:11 +00:00
|
|
|
// its parent headers. Also make sure lower headers don't have underlines when their parents lack
|
|
|
|
// an underline.
|
2021-10-22 20:45:10 +00:00
|
|
|
// 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
|
2022-02-05 13:05:05 +00:00
|
|
|
// 22px 1.375rem
|
|
|
|
// 20px 1.25rem
|
|
|
|
// 18px 1.125em
|
|
|
|
// 16px 1rem
|
|
|
|
// 14px 0.875rem
|
2024-04-05 19:38:55 +00:00
|
|
|
include: "utils.goml"
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2023-01-13 17:09:25 +00:00
|
|
|
assert-css: (".main-heading h1", {"font-size": "24px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "18px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h2#fields", {"font-size": "22px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h2#fields", {"border-bottom-width": "1px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h3#title-for-field", {"font-size": "20px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h3#title-for-field", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
assert-css: ("h4#sub-heading-for-field", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h4#sub-heading-for-field", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h2#implementations", {"font-size": "22px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-01-10 21:35:55 +00:00
|
|
|
assert-css: ("#impl-HeavilyDocumentedStruct > h3.code-header", {"font-size": "18px"})
|
|
|
|
assert-css: ("#impl-HeavilyDocumentedStruct > h3.code-header", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
|
|
|
assert-css: ("h4#title-for-struct-impl-doc", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h4#title-for-struct-impl-doc", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
assert-css: ("h5#sub-heading-for-struct-impl-doc", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h5#sub-heading-for-struct-impl-doc", {"border-bottom-width": "0px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h6#sub-sub-heading-for-struct-impl-doc", {"font-size": "14px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h6#sub-sub-heading-for-struct-impl-doc", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
|
|
|
assert-css: ("h5#title-for-struct-impl-item-doc", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h5#title-for-struct-impl-item-doc", {"border-bottom-width": "0px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"font-size": "14px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h6#sub-heading-for-struct-impl-item-doc", {"border-bottom-width": "0px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h6#sub-sub-heading-for-struct-impl-item-doc", {"font-size": "14px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/enum.HeavilyDocumentedEnum.html"
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2023-01-13 17:09:25 +00:00
|
|
|
assert-css: (".main-heading h1", {"font-size": "24px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h4#top-doc-prose-sub-sub-heading", {"font-size": "18px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h4#top-doc-prose-sub-sub-heading", {"border-bottom-width": "1px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h2#variants", {"font-size": "22px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h2#variants", {"border-bottom-width": "1px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2021-10-20 05:48:53 +00:00
|
|
|
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"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h6#wrapped0-prose-sub-heading", {"font-size": "14px"})
|
2021-10-20 05:48:53 +00:00
|
|
|
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"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h6#structy-prose-sub-heading", {"font-size": "14px"})
|
2021-10-20 05:48:53 +00:00
|
|
|
assert-css: ("h6#structy-prose-sub-heading", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h2#implementations", {"font-size": "22px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-01-10 21:35:55 +00:00
|
|
|
assert-css: ("#impl-HeavilyDocumentedEnum > h3.code-header", {"font-size": "18px"})
|
|
|
|
assert-css: ("#impl-HeavilyDocumentedEnum > h3.code-header", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
|
|
|
assert-css: ("h4#title-for-enum-impl-doc", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h4#title-for-enum-impl-doc", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
assert-css: ("h5#sub-heading-for-enum-impl-doc", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h5#sub-heading-for-enum-impl-doc", {"border-bottom-width": "0px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h6#sub-sub-heading-for-enum-impl-doc", {"font-size": "14px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h6#sub-sub-heading-for-enum-impl-doc", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
|
|
|
assert-css: ("h5#title-for-enum-impl-item-doc", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h5#title-for-enum-impl-item-doc", {"border-bottom-width": "0px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"font-size": "14px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"font-size": "14px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-10-10 18:37:19 +00:00
|
|
|
assert-text: ("//ul[@class='block mod']/preceding-sibling::h3", "Modules")
|
|
|
|
assert-css: ("//ul[@class='block mod']/preceding-sibling::h3", {"border-bottom-width": "0px"}, ALL)
|
2021-11-04 15:27:02 +00:00
|
|
|
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/union.HeavilyDocumentedUnion.html"
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2023-01-13 17:09:25 +00:00
|
|
|
assert-css: (".main-heading h1", {"font-size": "24px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h2#fields", {"font-size": "22px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h2#fields", {"border-bottom-width": "1px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h3#title-for-union-variant", {"font-size": "20px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h3#title-for-union-variant", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
assert-css: ("h4#sub-heading-for-union-variant", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h4#sub-heading-for-union-variant", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h2#implementations", {"font-size": "22px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-01-10 21:35:55 +00:00
|
|
|
assert-css: ("#impl-HeavilyDocumentedUnion > h3.code-header", {"font-size": "18px"})
|
|
|
|
assert-css: ("#impl-HeavilyDocumentedUnion > h3.code-header", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
assert-css: ("h4#title-for-union-impl-doc", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h4#title-for-union-impl-doc", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
assert-css: ("h5#sub-heading-for-union-impl-doc", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h5#sub-heading-for-union-impl-doc", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
|
|
|
assert-css: ("h5#title-for-union-impl-item-doc", {"font-size": "16px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h5#title-for-union-impl-item-doc", {"border-bottom-width": "0px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"font-size": "14px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h6#sub-heading-for-union-impl-item-doc", {"border-bottom-width": "0px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/macro.heavily_documented_macro.html"
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2023-01-13 17:09:25 +00:00
|
|
|
assert-css: (".main-heading h1", {"font-size": "24px"})
|
2021-10-22 20:45:10 +00:00
|
|
|
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h2#top-doc-prose-title", {"font-size": "22px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
|
2022-02-05 13:05:05 +00:00
|
|
|
assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
|
2021-10-22 06:09:11 +00:00
|
|
|
assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
|
2022-01-15 03:24:21 +00:00
|
|
|
|
2022-10-22 12:12:01 +00:00
|
|
|
// Needed to check colors
|
2022-01-15 03:24:21 +00:00
|
|
|
show-text: true
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
|
2022-07-27 13:36:43 +00:00
|
|
|
|
2022-10-22 12:12:01 +00:00
|
|
|
define-function: (
|
|
|
|
"check-colors",
|
2024-04-01 19:11:22 +00:00
|
|
|
[theme, heading_color, small_heading_color, heading_border_color],
|
2023-01-06 14:18:51 +00:00
|
|
|
block {
|
2024-04-05 19:38:55 +00:00
|
|
|
call-function: ("switch-theme", {"theme": |theme|})
|
|
|
|
|
2023-01-06 14:18:51 +00:00
|
|
|
assert-css: (
|
2022-10-22 12:12:01 +00:00
|
|
|
".top-doc .docblock h2",
|
|
|
|
{"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
|
|
|
assert-css: (
|
2022-10-22 12:12:01 +00:00
|
|
|
".top-doc .docblock h3",
|
|
|
|
{"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
|
|
|
assert-css: (
|
2022-10-22 12:12:01 +00:00
|
|
|
".top-doc .docblock h4",
|
|
|
|
{"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
|
|
|
assert-css: (
|
2022-10-22 12:12:01 +00:00
|
|
|
".top-doc .docblock h5",
|
|
|
|
{"color": |small_heading_color|, "border-bottom-width": "0px"},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
|
|
|
assert-css: (
|
2022-10-22 12:12:01 +00:00
|
|
|
"#implementations-list .docblock h4",
|
|
|
|
{"color": |heading_color|, "border-bottom-width": "0px"},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
|
|
|
assert-css: (
|
2022-10-22 12:12:01 +00:00
|
|
|
"#implementations-list .docblock h5",
|
|
|
|
{"color": |small_heading_color|, "border-bottom-width": "0px"},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
|
|
|
assert-css: (
|
2022-10-22 12:12:01 +00:00
|
|
|
"#implementations-list .docblock h6",
|
|
|
|
{"color": |small_heading_color|, "border-bottom-width": "0px"},
|
2023-01-06 14:18:51 +00:00
|
|
|
)
|
|
|
|
},
|
2022-10-22 12:12:01 +00:00
|
|
|
)
|
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "ayu",
|
2023-07-15 13:14:06 +00:00
|
|
|
"heading_color": "#fff",
|
|
|
|
"small_heading_color": "#c5c5c5",
|
|
|
|
"heading_border_color": "#5c6773",
|
2022-10-22 12:12:01 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "dark",
|
2023-07-15 13:14:06 +00:00
|
|
|
"heading_color": "#ddd",
|
|
|
|
"small_heading_color": "#ddd",
|
|
|
|
"heading_border_color": "#d2d2d2",
|
2022-10-22 12:12:01 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
call-function: (
|
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "light",
|
2023-07-15 13:14:06 +00:00
|
|
|
"heading_color": "black",
|
|
|
|
"small_heading_color": "black",
|
|
|
|
"heading_border_color": "#ddd",
|
2022-10-22 12:12:01 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
define-function: (
|
|
|
|
"check-since-color",
|
2024-04-01 19:11:22 +00:00
|
|
|
[theme],
|
2023-01-06 14:18:51 +00:00
|
|
|
block {
|
2024-04-05 19:38:55 +00:00
|
|
|
call-function: ("switch-theme", {"theme": |theme|})
|
2023-07-15 13:14:06 +00:00
|
|
|
assert-css: (".since", {"color": "#808080"}, ALL)
|
2023-01-06 14:18:51 +00:00
|
|
|
},
|
2022-07-27 13:36:43 +00:00
|
|
|
)
|
|
|
|
|
2023-04-11 17:11:34 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
|
2024-04-01 19:11:22 +00:00
|
|
|
call-function: ("check-since-color", {"theme": "ayu"})
|
|
|
|
call-function: ("check-since-color", {"theme": "dark"})
|
|
|
|
call-function: ("check-since-color", {"theme": "light"})
|