summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc-gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/rustdoc-gui')
-rw-r--r--src/test/rustdoc-gui/anchors.goml128
-rw-r--r--src/test/rustdoc-gui/check_info_sign_position.goml8
-rw-r--r--src/test/rustdoc-gui/code-tags.goml4
-rw-r--r--src/test/rustdoc-gui/codeblock-tooltip.goml96
-rw-r--r--src/test/rustdoc-gui/docblock-table-overflow.goml4
-rw-r--r--src/test/rustdoc-gui/docblock-table.goml4
-rw-r--r--src/test/rustdoc-gui/headings.goml6
-rw-r--r--src/test/rustdoc-gui/item-info-alignment.goml10
-rw-r--r--src/test/rustdoc-gui/item-summary-table.goml2
-rw-r--r--src/test/rustdoc-gui/label-next-to-symbol.goml26
-rw-r--r--src/test/rustdoc-gui/links-color.goml85
-rw-r--r--src/test/rustdoc-gui/overflow-tooltip-information.goml2
-rw-r--r--src/test/rustdoc-gui/pocket-menu.goml4
-rw-r--r--src/test/rustdoc-gui/search-filter.goml18
-rw-r--r--src/test/rustdoc-gui/search-form-elements.goml243
-rw-r--r--src/test/rustdoc-gui/search-input.goml23
-rw-r--r--src/test/rustdoc-gui/search-result-color.goml204
-rw-r--r--src/test/rustdoc-gui/search-result-display.goml31
-rw-r--r--src/test/rustdoc-gui/sidebar-mobile-scroll.goml31
-rw-r--r--src/test/rustdoc-gui/sidebar-source-code-display.goml15
-rw-r--r--src/test/rustdoc-gui/src/lib2/lib.rs40
-rw-r--r--src/test/rustdoc-gui/src/staged_api/Cargo.toml3
-rw-r--r--src/test/rustdoc-gui/src/staged_api/lib.rs2
-rw-r--r--src/test/rustdoc-gui/src/test_docs/lib.rs32
-rw-r--r--src/test/rustdoc-gui/toggle-click-deadspace.goml5
-rw-r--r--src/test/rustdoc-gui/type-declation-overflow.goml4
-rw-r--r--src/test/rustdoc-gui/where-whitespace.goml27
27 files changed, 959 insertions, 98 deletions
diff --git a/src/test/rustdoc-gui/anchors.goml b/src/test/rustdoc-gui/anchors.goml
index 84b8bbd1b..3ad62c721 100644
--- a/src/test/rustdoc-gui/anchors.goml
+++ b/src/test/rustdoc-gui/anchors.goml
@@ -1,6 +1,5 @@
// This test is to ensure that the anchors (`ยง`) have the expected color and position.
-goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
-show-text: true
+goto: file://|DOC_PATH|/staged_api/struct.Foo.html
// This is needed to ensure that the text color is computed.
show-text: true
@@ -13,10 +12,31 @@ reload:
assert-css: ("#toggle-all-docs", {"color": "rgb(0, 0, 0)"})
assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(0, 0, 0)"})
assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(173, 55, 138)"})
-assert-css: (".srclink", {"color": "rgb(56, 115, 173)"})
+assert-css: (
+ ".rightside .srclink",
+ {"color": "rgb(56, 115, 173)", "text-decoration": "none solid rgb(56, 115, 173)"},
+ ALL,
+)
+compare-elements-css: (".rightside .srclink", ".rightside.srclink", ["color", "text-decoration"])
+compare-elements-css: (".main-heading .srclink", ".rightside.srclink", ["color", "text-decoration"])
move-cursor-to: ".main-heading .srclink"
-assert-css: (".srclink", {"text-decoration": "underline solid rgb(56, 115, 173)"})
+assert-css: (
+ ".main-heading .srclink",
+ {"color": "rgb(56, 115, 173)", "text-decoration": "underline solid rgb(56, 115, 173)"},
+)
+move-cursor-to: ".impl-items .rightside .srclink"
+assert-css: (
+ ".impl-items .rightside .srclink",
+ {"color": "rgb(56, 115, 173)", "text-decoration": "none solid rgb(56, 115, 173)"},
+)
+move-cursor-to: ".impl-items .rightside.srclink"
+assert-css: (
+ ".impl-items .rightside.srclink",
+ {"color": "rgb(56, 115, 173)", "text-decoration": "none solid rgb(56, 115, 173)"},
+)
+
+goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
assert-css: ("#top-doc-prose-title", {"color": "rgb(0, 0, 0)"})
@@ -32,3 +52,103 @@ move-cursor-to: "#impl-HeavilyDocumentedStruct"
assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": "rgb(0, 0, 0)"})
assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
+
+//
+// We do the same checks with the dark theme now.
+//
+local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
+goto: file://|DOC_PATH|/staged_api/struct.Foo.html
+
+assert-css: ("#toggle-all-docs", {"color": "rgb(221, 221, 221)"})
+assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(221, 221, 221)"})
+assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(45, 191, 184)"})
+assert-css: (
+ ".rightside .srclink",
+ {"color": "rgb(210, 153, 29)", "text-decoration": "none solid rgb(210, 153, 29)"},
+ ALL,
+)
+compare-elements-css: (".rightside .srclink", ".rightside.srclink", ["color", "text-decoration"])
+compare-elements-css: (".main-heading .srclink", ".rightside.srclink", ["color", "text-decoration"])
+
+move-cursor-to: ".main-heading .srclink"
+assert-css: (
+ ".main-heading .srclink",
+ {"color": "rgb(210, 153, 29)", "text-decoration": "underline solid rgb(210, 153, 29)"},
+)
+move-cursor-to: ".impl-items .rightside .srclink"
+assert-css: (
+ ".impl-items .rightside .srclink",
+ {"color": "rgb(210, 153, 29)", "text-decoration": "none solid rgb(210, 153, 29)"},
+)
+move-cursor-to: ".impl-items .rightside.srclink"
+assert-css: (
+ ".impl-items .rightside.srclink",
+ {"color": "rgb(210, 153, 29)", "text-decoration": "none solid rgb(210, 153, 29)"},
+)
+
+goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
+
+assert-css: ("#top-doc-prose-title", {"color": "rgb(221, 221, 221)"})
+
+assert-css: (".sidebar a", {"color": "rgb(253, 191, 53)"})
+assert-css: (".in-band a", {"color": "rgb(221, 221, 221)"})
+
+// We move the cursor over the "Implementations" title so the anchor is displayed.
+move-cursor-to: "h2#implementations"
+assert-css: ("h2#implementations a.anchor", {"color": "rgb(221, 221, 221)"})
+
+// Same thing with the impl block title.
+move-cursor-to: "#impl-HeavilyDocumentedStruct"
+assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": "rgb(221, 221, 221)"})
+
+assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
+
+//
+// We do the same checks with the ayu theme now.
+//
+local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
+goto: file://|DOC_PATH|/staged_api/struct.Foo.html
+
+assert-css: ("#toggle-all-docs", {"color": "rgb(197, 197, 197)"})
+assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgb(255, 255, 255)"})
+assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgb(255, 160, 165)"})
+assert-css: (
+ ".rightside .srclink",
+ {"color": "rgb(57, 175, 215)", "text-decoration": "none solid rgb(57, 175, 215)"},
+ ALL,
+)
+compare-elements-css: (".rightside .srclink", ".rightside.srclink", ["color", "text-decoration"])
+compare-elements-css: (".main-heading .srclink", ".rightside.srclink", ["color", "text-decoration"])
+
+move-cursor-to: ".main-heading .srclink"
+assert-css: (
+ ".main-heading .srclink",
+ {"color": "rgb(57, 175, 215)", "text-decoration": "underline solid rgb(57, 175, 215)"},
+)
+move-cursor-to: ".impl-items .rightside .srclink"
+assert-css: (
+ ".impl-items .rightside .srclink",
+ {"color": "rgb(57, 175, 215)", "text-decoration": "none solid rgb(57, 175, 215)"},
+)
+move-cursor-to: ".impl-items .rightside.srclink"
+assert-css: (
+ ".impl-items .rightside.srclink",
+ {"color": "rgb(57, 175, 215)", "text-decoration": "none solid rgb(57, 175, 215)"},
+)
+
+goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
+
+assert-css: ("#top-doc-prose-title", {"color": "rgb(255, 255, 255)"})
+
+assert-css: (".sidebar a", {"color": "rgb(83, 177, 219)"})
+assert-css: (".in-band a", {"color": "rgb(255, 255, 255)"})
+
+// We move the cursor over the "Implementations" title so the anchor is displayed.
+move-cursor-to: "h2#implementations"
+assert-css: ("h2#implementations a.anchor", {"color": "rgb(197, 197, 197)"})
+
+// Same thing with the impl block title.
+move-cursor-to: "#impl-HeavilyDocumentedStruct"
+assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": "rgb(197, 197, 197)"})
+
+assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
diff --git a/src/test/rustdoc-gui/check_info_sign_position.goml b/src/test/rustdoc-gui/check_info_sign_position.goml
index 3bed7a0a0..47a78f02f 100644
--- a/src/test/rustdoc-gui/check_info_sign_position.goml
+++ b/src/test/rustdoc-gui/check_info_sign_position.goml
@@ -4,8 +4,8 @@ goto: file://|DOC_PATH|/test_docs/index.html
goto: ./fn.check_list_code_block.html
// If the codeblock is the first element of the docblock, the information tooltip must have
// have some top margin to avoid going over the toggle (the "[+]").
-assert-css: (".docblock > .information > .compile_fail", { "margin-top": "16px" })
+assert-css: (".docblock > .example-wrap.compile_fail .tooltip", { "margin-top": "16px" })
// Checks that the other codeblocks don't have this top margin.
-assert-css: ("ol > li > .information > .compile_fail", { "margin-top": "0px" })
-assert-css: ("ol > li > .information > .ignore", { "margin-top": "0px" })
-assert-css: (".docblock > .information > .ignore", { "margin-top": "0px" })
+assert-css: ("ol > li > .example-wrap.compile_fail .tooltip", { "margin-top": "0px" })
+assert-css: ("ol > li > .example-wrap.ignore .tooltip", { "margin-top": "0px" })
+assert-css: (".docblock > .example-wrap.ignore .tooltip", { "margin-top": "0px" })
diff --git a/src/test/rustdoc-gui/code-tags.goml b/src/test/rustdoc-gui/code-tags.goml
index 200569a28..8d399a9a5 100644
--- a/src/test/rustdoc-gui/code-tags.goml
+++ b/src/test/rustdoc-gui/code-tags.goml
@@ -1,9 +1,9 @@
// This test ensures that items and documentation code blocks are wrapped in <pre><code>
goto: file://|DOC_PATH|/test_docs/fn.foo.html
size: (1080, 600)
-// There should be three doc codeblocks
+// There should be four doc codeblocks.
// Check that their content is inside <pre><code>
-assert-count: (".example-wrap pre > code", 3)
+assert-count: (".example-wrap pre > code", 4)
// Check that function signature is inside <pre><code>
assert: "pre.rust.fn > code"
diff --git a/src/test/rustdoc-gui/codeblock-tooltip.goml b/src/test/rustdoc-gui/codeblock-tooltip.goml
new file mode 100644
index 000000000..21a9e120c
--- /dev/null
+++ b/src/test/rustdoc-gui/codeblock-tooltip.goml
@@ -0,0 +1,96 @@
+// Checking the colors of the codeblocks tooltips.
+goto: file://|DOC_PATH|/test_docs/fn.foo.html
+show-text: true
+
+// Dark theme.
+local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
+reload:
+
+// compile_fail block
+assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
+assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
+
+move-cursor-to: ".docblock .example-wrap.compile_fail"
+
+assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgb(255, 0, 0)"})
+assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
+
+// should_panic block
+assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
+assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
+
+move-cursor-to: ".docblock .example-wrap.should_panic"
+
+assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgb(255, 0, 0)"})
+assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
+
+// ignore block
+assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgba(255, 142, 0, 0.6)"})
+assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
+
+move-cursor-to: ".docblock .example-wrap.ignore"
+
+assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgb(255, 142, 0)"})
+assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgb(255, 142, 0)"})
+
+
+// Light theme.
+local-storage: {"rustdoc-theme": "light"}
+reload:
+
+assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
+assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
+
+move-cursor-to: ".docblock .example-wrap.compile_fail"
+
+assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgb(255, 0, 0)"})
+assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
+
+// should_panic block
+assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
+assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
+
+move-cursor-to: ".docblock .example-wrap.should_panic"
+
+assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgb(255, 0, 0)"})
+assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
+
+// ignore block
+assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgba(255, 142, 0, 0.6)"})
+assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
+
+move-cursor-to: ".docblock .example-wrap.ignore"
+
+assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgb(255, 142, 0)"})
+assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgb(255, 142, 0)"})
+
+
+// Ayu theme.
+local-storage: {"rustdoc-theme": "ayu"}
+reload:
+
+assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
+assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
+
+move-cursor-to: ".docblock .example-wrap.compile_fail"
+
+assert-css: (".docblock .example-wrap.compile_fail .tooltip", {"color": "rgb(255, 0, 0)"})
+assert-css: (".docblock .example-wrap.compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
+
+// should_panic block
+assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgba(255, 0, 0, 0.5)"})
+assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
+
+move-cursor-to: ".docblock .example-wrap.should_panic"
+
+assert-css: (".docblock .example-wrap.should_panic .tooltip", {"color": "rgb(255, 0, 0)"})
+assert-css: (".docblock .example-wrap.should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
+
+// ignore block
+assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgba(255, 142, 0, 0.6)"})
+assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
+
+move-cursor-to: ".docblock .example-wrap.ignore"
+
+assert-css: (".docblock .example-wrap.ignore .tooltip", {"color": "rgb(255, 142, 0)"})
+assert-css: (".docblock .example-wrap.ignore", {"border-left": "2px solid rgb(255, 142, 0)"})
diff --git a/src/test/rustdoc-gui/docblock-table-overflow.goml b/src/test/rustdoc-gui/docblock-table-overflow.goml
index af76d2ea4..7f97cf220 100644
--- a/src/test/rustdoc-gui/docblock-table-overflow.goml
+++ b/src/test/rustdoc-gui/docblock-table-overflow.goml
@@ -6,7 +6,7 @@ size: (1100, 800)
compare-elements-property: (".top-doc .docblock", ".top-doc .docblock > p", ["scrollWidth"])
assert-property: (".top-doc .docblock", {"scrollWidth": "801"})
// However, since there is overflow in the <table>, its scroll width is bigger.
-assert-property: (".top-doc .docblock table", {"scrollWidth": "1573"})
+assert-property: (".top-doc .docblock table", {"scrollWidth": "1572"})
// Checking it works on other doc blocks as well...
@@ -18,4 +18,4 @@ compare-elements-property: (
)
assert-property: ("#implementations-list > details .docblock", {"scrollWidth": "801"})
// However, since there is overflow in the <table>, its scroll width is bigger.
-assert-property: ("#implementations-list > details .docblock table", {"scrollWidth": "1573"})
+assert-property: ("#implementations-list > details .docblock table", {"scrollWidth": "1572"})
diff --git a/src/test/rustdoc-gui/docblock-table.goml b/src/test/rustdoc-gui/docblock-table.goml
new file mode 100644
index 000000000..7263156ab
--- /dev/null
+++ b/src/test/rustdoc-gui/docblock-table.goml
@@ -0,0 +1,4 @@
+goto: file://|DOC_PATH|/test_docs/doc_block_table/struct.DocBlockTable.html#method.func
+
+compare-elements-css: (".impl-items .docblock table th", ".top-doc .docblock table th", ["border"])
+compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock table td", ["border"])
diff --git a/src/test/rustdoc-gui/headings.goml b/src/test/rustdoc-gui/headings.goml
index 8c2c3df15..ed07e777b 100644
--- a/src/test/rustdoc-gui/headings.goml
+++ b/src/test/rustdoc-gui/headings.goml
@@ -247,12 +247,12 @@ assert-css: (
local-storage: {"rustdoc-theme": "light"}
goto: file://|DOC_PATH|/staged_api/struct.Foo.html
-assert-css: (".since", {"color": "rgb(128, 128, 128)"})
+assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
local-storage: {"rustdoc-theme": "dark"}
reload:
-assert-css: (".since", {"color": "rgb(128, 128, 128)"})
+assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
local-storage: {"rustdoc-theme": "ayu"}
reload:
-assert-css: (".since", {"color": "rgb(128, 128, 128)"})
+assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
diff --git a/src/test/rustdoc-gui/item-info-alignment.goml b/src/test/rustdoc-gui/item-info-alignment.goml
new file mode 100644
index 000000000..4d7b5045f
--- /dev/null
+++ b/src/test/rustdoc-gui/item-info-alignment.goml
@@ -0,0 +1,10 @@
+// This test ensures that the "item-info" looks about the same
+// whether or not it's inside a toggle.
+goto: file://|DOC_PATH|/lib2/struct.ItemInfoAlignmentTest.html
+
+// First, we try it in "desktop" mode.
+size: (1200, 870)
+compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))
+// Next, we try it in "mobile" mode (max-width: 700px).
+size: (650, 650)
+compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x"))
diff --git a/src/test/rustdoc-gui/item-summary-table.goml b/src/test/rustdoc-gui/item-summary-table.goml
index 6bf4e288c..4bff32b3d 100644
--- a/src/test/rustdoc-gui/item-summary-table.goml
+++ b/src/test/rustdoc-gui/item-summary-table.goml
@@ -3,4 +3,4 @@ goto: file://|DOC_PATH|/lib2/summary_table/index.html
// We check that we picked the right item first.
assert-text: (".item-table .item-left", "Foo")
// Then we check that its summary is empty.
-assert-text: (".item-table .item-right", "")
+assert-false: ".item-table .item-right"
diff --git a/src/test/rustdoc-gui/label-next-to-symbol.goml b/src/test/rustdoc-gui/label-next-to-symbol.goml
index ca3994a08..4b4cea262 100644
--- a/src/test/rustdoc-gui/label-next-to-symbol.goml
+++ b/src/test/rustdoc-gui/label-next-to-symbol.goml
@@ -7,14 +7,14 @@ size: (1080, 600)
assert: (".stab.deprecated")
assert: (".stab.portability")
-// make sure that deprecated and portability are different colours
+// make sure that deprecated and portability have the right colors
assert-css: (
".item-table .item-left .stab.deprecated",
- { "background-color": "rgb(255, 196, 196)" },
+ { "background-color": "rgb(255, 245, 214)" },
)
assert-css: (
".item-table .item-left .stab.portability",
- { "background-color": "rgb(243, 223, 255)" },
+ { "background-color": "rgb(255, 245, 214)" },
)
// table like view
@@ -31,15 +31,9 @@ compare-elements-position: (
)
// Ensure no wrap
-compare-elements-position-near: (
- "//*[@class='item-left module-item']//a[text()='replaced_function']",
- "//*[@class='item-right docblock-short']//p[text()='a thing with a label']",
- {"y": 2},
-)
-// compare parent elements
compare-elements-position: (
"//*[@class='item-left module-item']//a[text()='replaced_function']/..",
- "//*[@class='item-right docblock-short']//p[text()='a thing with a label']/..",
+ "//*[@class='item-right docblock-short'][text()='a thing with a label']",
("y"),
)
@@ -51,7 +45,7 @@ assert-css: (".item-right.docblock-short", { "padding-left": "32px" })
compare-elements-position-near: (
"//*[@class='item-left module-item']//a[text()='replaced_function']",
".item-left .stab.deprecated",
- {"y": 1},
+ {"y": 2},
)
compare-elements-position: (
".item-left .stab.deprecated",
@@ -60,19 +54,13 @@ compare-elements-position: (
)
// Ensure wrap
-compare-elements-position-near-false: (
- "//*[@class='item-left module-item']//a[text()='replaced_function']",
- "//*[@class='item-right docblock-short']//p[text()='a thing with a label']",
- {"y": 12},
-)
-// compare parent elements
compare-elements-position-false: (
"//*[@class='item-left module-item']//a[text()='replaced_function']/..",
- "//*[@class='item-right docblock-short']//p[text()='a thing with a label']/..",
+ "//*[@class='item-right docblock-short'][text()='a thing with a label']",
("y"),
)
compare-elements-position-false: (
".item-left .stab.deprecated",
- "//*[@class='item-right docblock-short']//p[text()='a thing with a label']",
+ "//*[@class='item-right docblock-short'][text()='a thing with a label']",
("y"),
)
diff --git a/src/test/rustdoc-gui/links-color.goml b/src/test/rustdoc-gui/links-color.goml
new file mode 100644
index 000000000..69c5b4a67
--- /dev/null
+++ b/src/test/rustdoc-gui/links-color.goml
@@ -0,0 +1,85 @@
+// This test checks links colors.
+goto: file://|DOC_PATH|/test_docs/index.html
+
+// This is needed so that the text color is computed.
+show-text: true
+
+// Ayu theme
+local-storage: {
+ "rustdoc-theme": "ayu",
+ "rustdoc-use-system-theme": "false",
+}
+reload:
+
+assert-css: (".item-table .mod", {"color": "rgb(57, 175, 215)"}, ALL)
+assert-css: (".item-table .macro", {"color": "rgb(163, 122, 204)"}, ALL)
+assert-css: (".item-table .struct", {"color": "rgb(255, 160, 165)"}, ALL)
+assert-css: (".item-table .enum", {"color": "rgb(255, 160, 165)"}, ALL)
+assert-css: (".item-table .trait", {"color": "rgb(57, 175, 215)"}, ALL)
+assert-css: (".item-table .fn", {"color": "rgb(253, 214, 135)"}, ALL)
+assert-css: (".item-table .type", {"color": "rgb(255, 160, 165)"}, ALL)
+assert-css: (".item-table .union", {"color": "rgb(255, 160, 165)"}, ALL)
+assert-css: (".item-table .keyword", {"color": "rgb(57, 175, 215)"}, ALL)
+
+assert-css: (
+ ".sidebar-elems a:not(.current)",
+ {"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)", "font-weight": "400"},
+ ALL,
+)
+assert-css: (
+ ".sidebar-elems a.current",
+ {"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)", "font-weight": "500"},
+ ALL,
+)
+
+
+// Dark theme
+local-storage: {"rustdoc-theme": "dark"}
+reload:
+
+assert-css: (".item-table .mod", {"color": "rgb(210, 153, 29)"}, ALL)
+assert-css: (".item-table .macro", {"color": "rgb(9, 189, 0)"}, ALL)
+assert-css: (".item-table .struct", {"color": "rgb(45, 191, 184)"}, ALL)
+assert-css: (".item-table .enum", {"color": "rgb(45, 191, 184)"}, ALL)
+assert-css: (".item-table .trait", {"color": "rgb(183, 140, 242)"}, ALL)
+assert-css: (".item-table .fn", {"color": "rgb(43, 171, 99)"}, ALL)
+assert-css: (".item-table .type", {"color": "rgb(45, 191, 184)"}, ALL)
+assert-css: (".item-table .union", {"color": "rgb(45, 191, 184)"}, ALL)
+assert-css: (".item-table .keyword", {"color": "rgb(210, 153, 29)"}, ALL)
+
+assert-css: (
+ ".sidebar-elems a:not(.current)",
+ {"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)", "font-weight": "400"},
+ ALL,
+)
+assert-css: (
+ ".sidebar-elems a.current",
+ {"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)", "font-weight": "500"},
+ ALL,
+)
+
+
+// Light theme
+local-storage: {"rustdoc-theme": "light"}
+reload:
+
+assert-css: (".item-table .mod", {"color": "rgb(56, 115, 173)"}, ALL)
+assert-css: (".item-table .macro", {"color": "rgb(6, 128, 0)"}, ALL)
+assert-css: (".item-table .struct", {"color": "rgb(173, 55, 138)"}, ALL)
+assert-css: (".item-table .enum", {"color": "rgb(173, 55, 138)"}, ALL)
+assert-css: (".item-table .trait", {"color": "rgb(110, 79, 201)"}, ALL)
+assert-css: (".item-table .fn", {"color": "rgb(173, 124, 55)"}, ALL)
+assert-css: (".item-table .type", {"color": "rgb(173, 55, 138)"}, ALL)
+assert-css: (".item-table .union", {"color": "rgb(173, 55, 138)"}, ALL)
+assert-css: (".item-table .keyword", {"color": "rgb(56, 115, 173)"}, ALL)
+
+assert-css: (
+ ".sidebar-elems a:not(.current)",
+ {"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)", "font-weight": "400"},
+ ALL,
+)
+assert-css: (
+ ".sidebar-elems a.current",
+ {"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)", "font-weight": "500"},
+ ALL,
+)
diff --git a/src/test/rustdoc-gui/overflow-tooltip-information.goml b/src/test/rustdoc-gui/overflow-tooltip-information.goml
index 7ef85a4c4..f481f82c2 100644
--- a/src/test/rustdoc-gui/overflow-tooltip-information.goml
+++ b/src/test/rustdoc-gui/overflow-tooltip-information.goml
@@ -2,7 +2,7 @@
// have overflow and max-width CSS rules set because they create a bug in firefox on
// mac. For more information: https://github.com/rust-lang/rust/issues/89185
goto: file://|DOC_PATH|/test_docs/fn.foo.html
-assert-css: (".docblock > .information", {
+assert-css: (".docblock > .example-wrap .tooltip", {
"overflow-x": "visible",
"max-width": "none"
}, ALL)
diff --git a/src/test/rustdoc-gui/pocket-menu.goml b/src/test/rustdoc-gui/pocket-menu.goml
index 54f3790a7..71d514648 100644
--- a/src/test/rustdoc-gui/pocket-menu.goml
+++ b/src/test/rustdoc-gui/pocket-menu.goml
@@ -56,7 +56,7 @@ reload:
click: "#help-button"
assert-css: (
"#help-button .popover",
- {"display": "block", "border-color": "rgb(210, 210, 210)"},
+ {"display": "block", "border-color": "rgb(224, 224, 224)"},
)
compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-color"])
compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"])
@@ -71,7 +71,7 @@ reload:
click: "#help-button"
assert-css: (
"#help-button .popover",
- {"display": "block", "border-color": "rgb(221, 221, 221)"},
+ {"display": "block", "border-color": "rgb(224, 224, 224)"},
)
compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-color"])
compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"])
diff --git a/src/test/rustdoc-gui/search-filter.goml b/src/test/rustdoc-gui/search-filter.goml
index d645e2370..35d7ca480 100644
--- a/src/test/rustdoc-gui/search-filter.goml
+++ b/src/test/rustdoc-gui/search-filter.goml
@@ -40,7 +40,7 @@ press-key: "ArrowUp"
press-key: "Enter"
// Waiting for the search results to appear...
wait-for: "#titles"
-assert-property: ("#crate-search", {"value": "All crates"})
+assert-property: ("#crate-search", {"value": "all crates"})
// Checking that the URL parameter is taken into account for crate filtering.
goto: file://|DOC_PATH|/test_docs/index.html?search=test&filter-crate=lib2
@@ -48,8 +48,8 @@ wait-for: "#crate-search"
assert-property: ("#crate-search", {"value": "lib2"})
assert-false: "#results .externcrate"
-// Checking that the text for the "title" is correct (the "All" comes from the "<select>").
-assert-text: ("#search-settings", "Results for test in All", STARTS_WITH)
+// Checking that the text for the "title" is correct (the "all crates" comes from the "<select>").
+assert-text: (".search-results-title", "Results in all crates", STARTS_WITH)
// Checking the display of the crate filter.
// We start with the light theme.
@@ -69,15 +69,15 @@ click: "#settings-menu"
wait-for: "#settings"
click: "#theme-dark"
wait-for-css: ("#crate-search", {
- "border": "1px solid rgb(240, 240, 240)",
- "color": "rgb(17, 17, 17)",
- "background-color": "rgb(240, 240, 240)",
+ "border": "1px solid rgb(224, 224, 224)",
+ "color": "rgb(221, 221, 221)",
+ "background-color": "rgb(53, 53, 53)",
})
// And finally we check the ayu theme.
click: "#theme-ayu"
wait-for-css: ("#crate-search", {
- "border": "1px solid rgb(66, 76, 87)",
- "color": "rgb(197, 197, 197)",
- "background-color": "rgb(20, 25, 32)",
+ "border": "1px solid rgb(92, 103, 115)",
+ "color": "rgb(255, 255, 255)",
+ "background-color": "rgb(15, 20, 25)",
})
diff --git a/src/test/rustdoc-gui/search-form-elements.goml b/src/test/rustdoc-gui/search-form-elements.goml
new file mode 100644
index 000000000..1c64974e9
--- /dev/null
+++ b/src/test/rustdoc-gui/search-form-elements.goml
@@ -0,0 +1,243 @@
+// This test ensures that the elements in ".search-form" have the expected display.
+goto: file://|DOC_PATH|/test_docs/index.html
+show-text: true
+
+// Ayu theme
+local-storage: {
+ "rustdoc-theme": "ayu",
+ "rustdoc-use-system-theme": "false",
+}
+reload:
+
+assert-css: (
+ ".search-input",
+ {
+ "border-color": "rgb(92, 103, 115)",
+ "background-color": "rgb(20, 25, 32)",
+ "color": "rgb(255, 255, 255)",
+ },
+)
+focus: ".search-input"
+// Nothing should change.
+assert-css: (
+ ".search-input",
+ {
+ "border-color": "rgb(92, 103, 115)",
+ "background-color": "rgb(20, 25, 32)",
+ "color": "rgb(255, 255, 255)",
+ },
+)
+
+assert-css: (
+ "#help-button",
+ {"border-color": "rgb(197, 197, 197)"},
+)
+assert-css: (
+ "#help-button > button",
+ {
+ "color": "rgb(255, 255, 255)",
+ "border-color": "rgb(92, 103, 115)",
+ "background-color": "rgb(20, 25, 32)",
+ },
+)
+move-cursor-to: "#help-button"
+assert-css: (
+ "#help-button:hover",
+ {"border-color": "rgb(197, 197, 197)"},
+)
+// Only "border-color" should change.
+assert-css: (
+ "#help-button:hover > button",
+ {
+ "color": "rgb(255, 255, 255)",
+ "border-color": "rgb(224, 224, 224)",
+ "background-color": "rgb(20, 25, 32)",
+ },
+)
+
+assert-css: (
+ "#settings-menu",
+ {"border-color": "rgb(197, 197, 197)"},
+)
+assert-css: (
+ "#settings-menu > a",
+ {
+ "color": "rgb(255, 255, 255)",
+ "border-color": "rgb(92, 103, 115)",
+ "background-color": "rgb(20, 25, 32)",
+ },
+)
+move-cursor-to: "#settings-menu"
+assert-css: (
+ "#settings-menu:hover",
+ {"border-color": "rgb(197, 197, 197)"},
+)
+// Only "border-color" should change.
+assert-css: (
+ "#settings-menu:hover > a",
+ {
+ "color": "rgb(255, 255, 255)",
+ "border-color": "rgb(224, 224, 224)",
+ "background-color": "rgb(20, 25, 32)",
+ },
+)
+
+// Dark theme
+local-storage: {
+ "rustdoc-theme": "dark",
+ "rustdoc-use-system-theme": "false",
+}
+reload:
+
+assert-css: (
+ ".search-input",
+ {
+ "border-color": "rgb(224, 224, 224)",
+ "background-color": "rgb(240, 240, 240)",
+ "color": "rgb(17, 17, 17)",
+ },
+)
+focus: ".search-input"
+// Only "border-color" should change.
+assert-css: (
+ ".search-input",
+ {
+ "border-color": "rgb(0, 141, 253)",
+ "background-color": "rgb(240, 240, 240)",
+ "color": "rgb(17, 17, 17)",
+ },
+)
+
+assert-css: (
+ "#help-button",
+ {"border-color": "rgb(221, 221, 221)"},
+)
+assert-css: (
+ "#help-button > button",
+ {
+ "color": "rgb(0, 0, 0)",
+ "border-color": "rgb(224, 224, 224)",
+ "background-color": "rgb(240, 240, 240)",
+ },
+)
+move-cursor-to: "#help-button"
+assert-css: (
+ "#help-button:hover",
+ {"border-color": "rgb(221, 221, 221)"},
+)
+// Only "border-color" should change.
+assert-css: (
+ "#help-button:hover > button",
+ {
+ "color": "rgb(0, 0, 0)",
+ "border-color": "rgb(255, 185, 0)",
+ "background-color": "rgb(240, 240, 240)",
+ },
+)
+
+assert-css: (
+ "#settings-menu",
+ {"border-color": "rgb(221, 221, 221)"},
+)
+assert-css: (
+ "#settings-menu > a",
+ {
+ "color": "rgb(0, 0, 0)",
+ "border-color": "rgb(224, 224, 224)",
+ "background-color": "rgb(240, 240, 240)",
+ },
+)
+move-cursor-to: "#settings-menu"
+assert-css: (
+ "#settings-menu:hover",
+ {"border-color": "rgb(221, 221, 221)"},
+)
+// Only "border-color" should change.
+assert-css: (
+ "#settings-menu:hover > a",
+ {
+ "color": "rgb(0, 0, 0)",
+ "border-color": "rgb(255, 185, 0)",
+ "background-color": "rgb(240, 240, 240)",
+ },
+)
+
+// Light theme
+local-storage: {
+ "rustdoc-theme": "light",
+ "rustdoc-use-system-theme": "false",
+}
+reload:
+
+assert-css: (
+ ".search-input",
+ {
+ "border-color": "rgb(224, 224, 224)",
+ "background-color": "rgb(255, 255, 255)",
+ "color": "rgb(0, 0, 0)",
+ },
+)
+focus: ".search-input"
+// Nothing should change.
+assert-css: (
+ ".search-input",
+ {
+ "border-color": "rgb(102, 175, 233)",
+ "background-color": "rgb(255, 255, 255)",
+ "color": "rgb(0, 0, 0)",
+ },
+)
+
+assert-css: (
+ "#help-button",
+ {"border-color": "rgb(0, 0, 0)"},
+)
+assert-css: (
+ "#help-button > button",
+ {
+ "color": "rgb(0, 0, 0)",
+ "border-color": "rgb(224, 224, 224)",
+ "background-color": "rgb(255, 255, 255)",
+ },
+)
+move-cursor-to: "#help-button"
+assert-css: (
+ "#help-button:hover",
+ {"border-color": "rgb(0, 0, 0)"},
+)
+// Only "border-color" should change.
+assert-css: (
+ "#help-button:hover > button",
+ {
+ "color": "rgb(0, 0, 0)",
+ "border-color": "rgb(113, 113, 113)",
+ "background-color": "rgb(255, 255, 255)",
+ },
+)
+
+assert-css: (
+ "#settings-menu",
+ {"border-color": "rgb(0, 0, 0)"},
+)
+assert-css: (
+ "#settings-menu > a",
+ {
+ "color": "rgb(56, 115, 173)",
+ "border-color": "rgb(224, 224, 224)",
+ "background-color": "rgb(255, 255, 255)",
+ },
+)
+move-cursor-to: "#settings-menu"
+assert-css: (
+ "#settings-menu:hover",
+ {"border-color": "rgb(0, 0, 0)"},
+)
+// Only "border-color" should change.
+assert-css: (
+ "#settings-menu:hover > a",
+ {
+ "color": "rgb(56, 115, 173)",
+ "border-color": "rgb(113, 113, 113)",
+ "background-color": "rgb(255, 255, 255)",
+ },
+)
diff --git a/src/test/rustdoc-gui/search-input.goml b/src/test/rustdoc-gui/search-input.goml
deleted file mode 100644
index 44123b702..000000000
--- a/src/test/rustdoc-gui/search-input.goml
+++ /dev/null
@@ -1,23 +0,0 @@
-// Ensures that the search input border color changes on focus.
-goto: file://|DOC_PATH|/test_docs/index.html
-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
-reload:
-
-assert-css: (".search-input", {"border-color": "rgb(224, 224, 224)"})
-click: ".search-input"
-focus: ".search-input"
-assert-css: (".search-input", {"border-color": "rgb(0, 141, 253)"})
-
-local-storage: {"rustdoc-theme": "light"}
-reload:
-
-assert-css: (".search-input", {"border-color": "rgb(224, 224, 224)"})
-click: ".search-input"
-assert-css: (".search-input", {"border-color": "rgb(102, 175, 233)"})
-
-local-storage: {"rustdoc-theme": "ayu"}
-reload:
-
-assert-css: (".search-input", {"border-color": "rgb(66, 76, 87)"})
-click: ".search-input"
-assert-css: (".search-input", {"border-color": "rgb(66, 76, 87)"})
diff --git a/src/test/rustdoc-gui/search-result-color.goml b/src/test/rustdoc-gui/search-result-color.goml
index 9a49ae2c6..c4b5fdf53 100644
--- a/src/test/rustdoc-gui/search-result-color.goml
+++ b/src/test/rustdoc-gui/search-result-color.goml
@@ -7,7 +7,6 @@ show-text: true
// Ayu theme
local-storage: {
"rustdoc-theme": "ayu",
- "rustdoc-preferred-dark-theme": "ayu",
"rustdoc-use-system-theme": "false",
}
reload:
@@ -23,16 +22,82 @@ assert-css: (
{"color": "rgb(0, 150, 207)"},
)
-// Checking the color for "keyword".
+// Checking the color of "keyword" text.
assert-css: (
"//*[@class='result-name']//*[text()='(keyword)']",
{"color": "rgb(120, 135, 151)"},
)
+// Checking the color of "keyword".
+assert-css: (
+ ".result-name .keyword",
+ {"color": "rgb(57, 175, 215)"},
+ ALL,
+)
+// Check the color of "struct".
+assert-css: (
+ ".result-name .struct",
+ {"color": "rgb(255, 160, 165)"},
+ ALL,
+)
+// Check the color of "associated type".
+assert-css: (
+ ".result-name .associatedtype",
+ {"color": "rgb(57, 175, 215)"},
+ ALL,
+)
+// Check the color of "type method".
+assert-css: (
+ ".result-name .tymethod",
+ {"color": "rgb(253, 214, 135)"},
+ ALL,
+)
+// Check the color of "method".
+assert-css: (
+ ".result-name .method",
+ {"color": "rgb(253, 214, 135)"},
+ ALL,
+)
+// Check the color of "struct field".
+assert-css: (
+ ".result-name .structfield",
+ {"color": "rgb(0, 150, 207)"},
+ ALL,
+)
+// Check the color of "macro".
+assert-css: (
+ ".result-name .macro",
+ {"color": "rgb(163, 122, 204)"},
+ ALL,
+)
+// Check the color of "fn".
+assert-css: (
+ ".result-name .fn",
+ {"color": "rgb(253, 214, 135)"},
+ ALL,
+)
+
+// Checking the `<a>` container.
+assert-css: (
+ "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
+ {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"},
+ ALL,
+)
+
+// Checking color and background on hover.
+move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
+assert-css: (
+ "//*[@class='result-name']/*[text()='test_docs::']",
+ {"color": "rgb(255, 255, 255)"},
+)
+assert-css: (
+ "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
+ {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"},
+)
+
// Dark theme
local-storage: {
"rustdoc-theme": "dark",
- "rustdoc-preferred-dark-theme": "dark",
"rustdoc-use-system-theme": "false",
}
reload:
@@ -54,6 +119,72 @@ assert-css: (
{"color": "rgb(221, 221, 221)"},
)
+// Checking the color of "keyword".
+assert-css: (
+ ".result-name .keyword",
+ {"color": "rgb(210, 153, 29)"},
+ ALL,
+)
+// Check the color of "struct".
+assert-css: (
+ ".result-name .struct",
+ {"color": "rgb(45, 191, 184)"},
+ ALL,
+)
+// Check the color of "associated type".
+assert-css: (
+ ".result-name .associatedtype",
+ {"color": "rgb(210, 153, 29)"},
+ ALL,
+)
+// Check the color of "type method".
+assert-css: (
+ ".result-name .tymethod",
+ {"color": "rgb(43, 171, 99)"},
+ ALL,
+)
+// Check the color of "method".
+assert-css: (
+ ".result-name .method",
+ {"color": "rgb(43, 171, 99)"},
+ ALL,
+)
+// Check the color of "struct field".
+assert-css: (
+ ".result-name .structfield",
+ {"color": "rgb(221, 221, 221)"},
+ ALL,
+)
+// Check the color of "macro".
+assert-css: (
+ ".result-name .macro",
+ {"color": "rgb(9, 189, 0)"},
+ ALL,
+)
+// Check the color of "fn".
+assert-css: (
+ ".result-name .fn",
+ {"color": "rgb(43, 171, 99)"},
+ ALL,
+)
+
+// Checking the `<a>` container.
+assert-css: (
+ "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
+ {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
+)
+
+// Checking color and background on hover.
+move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
+assert-css: (
+ "//*[@class='result-name']/*[text()='test_docs::']",
+ {"color": "rgb(221, 221, 221)"},
+)
+assert-css: (
+ "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
+ {"color": "rgb(221, 221, 221)", "background-color": "rgb(119, 119, 119)"},
+)
+
// Light theme
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:
@@ -75,13 +206,78 @@ assert-css: (
{"color": "rgb(0, 0, 0)"},
)
+// Checking the color of "keyword".
+assert-css: (
+ ".result-name .keyword",
+ {"color": "rgb(56, 115, 173)"},
+ ALL,
+)
+// Check the color of "struct".
+assert-css: (
+ ".result-name .struct",
+ {"color": "rgb(173, 55, 138)"},
+ ALL,
+)
+// Check the color of "associated type".
+assert-css: (
+ ".result-name .associatedtype",
+ {"color": "rgb(56, 115, 173)"},
+ ALL,
+)
+// Check the color of "type method".
+assert-css: (
+ ".result-name .tymethod",
+ {"color": "rgb(173, 124, 55)"},
+ ALL,
+)
+// Check the color of "method".
+assert-css: (
+ ".result-name .method",
+ {"color": "rgb(173, 124, 55)"},
+ ALL,
+)
+// Check the color of "struct field".
+assert-css: (
+ ".result-name .structfield",
+ {"color": "rgb(0, 0, 0)"},
+ ALL,
+)
+// Check the color of "macro".
+assert-css: (
+ ".result-name .macro",
+ {"color": "rgb(6, 128, 0)"},
+ ALL,
+)
+// Check the color of "fn".
+assert-css: (
+ ".result-name .fn",
+ {"color": "rgb(173, 124, 55)"},
+ ALL,
+)
+
+// Checking the `<a>` container.
+assert-css: (
+ "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
+ {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
+)
+
+// Checking color and background on hover.
+move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
+assert-css: (
+ "//*[@class='result-name']/*[text()='test_docs::']",
+ {"color": "rgb(0, 0, 0)"},
+)
+assert-css: (
+ "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
+ {"color": "rgb(0, 0, 0)", "background-color": "rgb(221, 221, 221)"},
+)
+
// Check the alias more specifically in the dark theme.
goto: file://|DOC_PATH|/test_docs/index.html
// We set the theme so we're sure that the correct values will be used, whatever the computer
// this test is running on.
local-storage: {
"rustdoc-theme": "dark",
- "rustdoc-preferred-dark-theme": "dark",
"rustdoc-use-system-theme": "false",
}
// If the text isn't displayed, the browser doesn't compute color style correctly...
diff --git a/src/test/rustdoc-gui/search-result-display.goml b/src/test/rustdoc-gui/search-result-display.goml
index 8464ba7c2..efbbfb925 100644
--- a/src/test/rustdoc-gui/search-result-display.goml
+++ b/src/test/rustdoc-gui/search-result-display.goml
@@ -4,26 +4,25 @@ size: (900, 1000)
write: (".search-input", "test")
// To be SURE that the search will be run.
press-key: 'Enter'
-wait-for: "#search-settings"
+wait-for: "#crate-search"
// The width is returned by "getComputedStyle" which returns the exact number instead of the
// CSS rule which is "50%"...
-assert-css: (".search-results div.desc", {"width": "295px"})
+assert-css: (".search-results div.desc", {"width": "293px"})
size: (600, 100)
// As counter-intuitive as it may seem, in this width, the width is "100%", which is why
// when computed it's larger.
-assert-css: (".search-results div.desc", {"width": "570px"})
+assert-css: (".search-results div.desc", {"width": "566px"})
+
+// The result set is all on one line.
+assert-css: (".search-results .result-name > span", {"display": "inline"})
// Check that the crate filter `<select>` is correctly handled when it goes to next line.
// To do so we need to update the length of one of its `<option>`.
size: (900, 900)
-// First we check the current width and position.
-assert-css: ("#crate-search", {"width": "218px"})
-compare-elements-position-near: (
- "#crate-search",
- "#search-settings .search-results-title",
- {"y": 5},
-)
+// First we check the current width, height and position.
+assert-css: ("#crate-search", {"width": "223px"})
+assert-css: (".search-results-title", {"height": "44px", "width": "336px"})
// Then we update the text of one of the `<option>`.
text: (
@@ -31,12 +30,8 @@ text: (
"sdjfaksdjfaksjdbfkadsbfkjsadbfkdsbkfbsadkjfbkdsabfkadsfkjdsafa",
)
-// Then we compare again.
-assert-css: ("#crate-search", {"width": "640px"})
-compare-elements-position-near-false: (
- "#crate-search",
- "#search-settings .search-results-title",
- {"y": 5},
-)
-// And we check that the `<select>` isn't bigger than its container.
+// Then we compare again to confirm the height didn't change.
+assert-css: ("#crate-search", {"width": "527px"})
+assert-css: (".search-results-title", {"height": "44px", "width": "640px"})
+// And we check that the `<select>` isn't bigger than its container (".search-results-title").
assert-css: ("#search", {"width": "640px"})
diff --git a/src/test/rustdoc-gui/sidebar-mobile-scroll.goml b/src/test/rustdoc-gui/sidebar-mobile-scroll.goml
new file mode 100644
index 000000000..dc50185f0
--- /dev/null
+++ b/src/test/rustdoc-gui/sidebar-mobile-scroll.goml
@@ -0,0 +1,31 @@
+// This test ensures that the mobile sidebar preserves scroll position.
+goto: file://|DOC_PATH|/test_docs/struct.Foo.html
+// Switching to "mobile view" by reducing the width to 600px.
+size: (600, 600)
+assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
+
+// Scroll down.
+scroll-to: "//h2[@id='blanket-implementations']"
+assert-window-property: {"pageYOffset": "643"}
+
+// Open the sidebar menu.
+click: ".sidebar-menu-toggle"
+wait-for-css: (".sidebar", {"left": "0px"})
+
+// We are no longer "scrolled". It's important that the user can't
+// scroll the body at all, but these test scripts are run only in Chrome,
+// and we need to use a more complicated solution to this problem because
+// of Mobile Safari...
+assert-window-property: {"pageYOffset": "0"}
+
+// Close the sidebar menu. Make sure the scroll position gets restored.
+click: ".sidebar-menu-toggle"
+wait-for-css: (".sidebar", {"left": "-1000px"})
+assert-window-property: {"pageYOffset": "643"}
+
+// Now test that scrollability returns when the browser window is just resized.
+click: ".sidebar-menu-toggle"
+wait-for-css: (".sidebar", {"left": "0px"})
+assert-window-property: {"pageYOffset": "0"}
+size: (900, 600)
+assert-window-property: {"pageYOffset": "643"}
diff --git a/src/test/rustdoc-gui/sidebar-source-code-display.goml b/src/test/rustdoc-gui/sidebar-source-code-display.goml
index fa322574f..4321efcdb 100644
--- a/src/test/rustdoc-gui/sidebar-source-code-display.goml
+++ b/src/test/rustdoc-gui/sidebar-source-code-display.goml
@@ -224,14 +224,25 @@ click: "#sidebar-toggle"
wait-for-css: (".sidebar", {"width": "0px"})
// We scroll to line 117 to change the scroll position.
scroll-to: '//*[@id="117"]'
-assert-window-property: {"pageYOffset": "2519"}
+assert-window-property: {"pageYOffset": "2542"}
// Expanding the sidebar...
click: "#sidebar-toggle"
wait-for-css: (".sidebar", {"width": "500px"})
click: "#sidebar-toggle"
wait-for-css: (".sidebar", {"width": "0px"})
// The "scrollTop" property should be the same.
-assert-window-property: {"pageYOffset": "2519"}
+assert-window-property: {"pageYOffset": "2542"}
+
+// We now check that the scroll position is restored if the window is resized.
+size: (500, 700)
+click: "#sidebar-toggle"
+wait-for-css: ("#source-sidebar", {"visibility": "visible"})
+assert-window-property: {"pageYOffset": "0"}
+size: (900, 900)
+assert-window-property: {"pageYOffset": "2542"}
+size: (500, 700)
+click: "#sidebar-toggle"
+wait-for-css: ("#source-sidebar", {"visibility": "hidden"})
// We now check that opening the sidebar and clicking a link will close it.
// The behavior here on mobile is different than the behavior on desktop,
diff --git a/src/test/rustdoc-gui/src/lib2/lib.rs b/src/test/rustdoc-gui/src/lib2/lib.rs
index 87f91be3a..24aecc70d 100644
--- a/src/test/rustdoc-gui/src/lib2/lib.rs
+++ b/src/test/rustdoc-gui/src/lib2/lib.rs
@@ -38,11 +38,14 @@ pub trait Trait {
#[deprecated = "Whatever [`Foo`](#tadam)"]
fn foo() {}
+ fn fooo();
}
impl Trait for Foo {
type X = u32;
const Y: u32 = 0;
+
+ fn fooo() {}
}
impl implementors::Whatever for Foo {
@@ -143,3 +146,40 @@ pub struct LongItemInfo2;
/// Some docs.
#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
impl SimpleTrait for LongItemInfo2 {}
+
+pub struct WhereWhitespace<T>;
+
+impl<T> WhereWhitespace<T> {
+ pub fn new<F>(f: F) -> Self
+ where
+ F: FnMut() -> i32,
+ {}
+}
+
+impl<K, T> Whitespace<&K> for WhereWhitespace<T>
+where
+ K: std::fmt::Debug,
+{
+ type Output = WhereWhitespace<T>;
+ fn index(&self, _key: &K) -> &Self::Output {
+ self
+ }
+}
+
+pub trait Whitespace<Idx>
+where
+ Idx: ?Sized,
+{
+ type Output;
+ fn index(&self, index: Idx) -> &Self::Output;
+}
+
+pub struct ItemInfoAlignmentTest;
+
+impl ItemInfoAlignmentTest {
+ /// This method has docs
+ #[deprecated]
+ pub fn foo() {}
+ #[deprecated]
+ pub fn bar() {}
+}
diff --git a/src/test/rustdoc-gui/src/staged_api/Cargo.toml b/src/test/rustdoc-gui/src/staged_api/Cargo.toml
index 117c4134e..b231be6ee 100644
--- a/src/test/rustdoc-gui/src/staged_api/Cargo.toml
+++ b/src/test/rustdoc-gui/src/staged_api/Cargo.toml
@@ -7,5 +7,6 @@ edition = "2021"
path = "lib.rs"
[features]
-default = ["some_feature"]
+default = ["some_feature", "some_other_feature"]
some_feature = []
+some_other_feature = []
diff --git a/src/test/rustdoc-gui/src/staged_api/lib.rs b/src/test/rustdoc-gui/src/staged_api/lib.rs
index 0cb460f03..5934593a8 100644
--- a/src/test/rustdoc-gui/src/staged_api/lib.rs
+++ b/src/test/rustdoc-gui/src/staged_api/lib.rs
@@ -7,4 +7,6 @@ pub struct Foo {}
impl Foo {
#[stable(feature = "some_feature", since = "1.3.5")]
pub fn bar() {}
+ #[stable(feature = "some_other_feature", since = "1.3.6")]
+ pub fn yo() {}
}
diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs
index 1b26aaecb..4eedf7f15 100644
--- a/src/test/rustdoc-gui/src/test_docs/lib.rs
+++ b/src/test/rustdoc-gui/src/test_docs/lib.rs
@@ -28,6 +28,12 @@ use std::fmt;
/// Let's say I'm just some text will ya?
/// ```
///
+/// A failing to run one:
+///
+/// ```should_panic
+/// panic!("tadam");
+/// ```
+///
/// An inlined `code`!
pub fn foo() {}
@@ -293,3 +299,29 @@ pub mod details {
/// </details>
pub struct Details;
}
+
+pub mod doc_block_table {
+
+ pub trait DocBlockTableTrait {
+ fn func();
+ }
+
+ /// Struct doc.
+ ///
+ /// | header1 | header2 |
+ /// |--------------------------|--------------------------|
+ /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
+ pub struct DocBlockTable {}
+
+ impl DocBlockTableTrait for DocBlockTable {
+ /// Trait impl func doc for struct.
+ ///
+ /// | header1 | header2 |
+ /// |--------------------------|--------------------------|
+ /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
+ fn func() {
+ println!();
+ }
+ }
+
+}
diff --git a/src/test/rustdoc-gui/toggle-click-deadspace.goml b/src/test/rustdoc-gui/toggle-click-deadspace.goml
index 4a328c9f9..8c3a0bf5b 100644
--- a/src/test/rustdoc-gui/toggle-click-deadspace.goml
+++ b/src/test/rustdoc-gui/toggle-click-deadspace.goml
@@ -4,7 +4,10 @@ goto: file://|DOC_PATH|/lib2/struct.Foo.html
assert-attribute: (".impl-items .rustdoc-toggle", {"open": ""})
click: "h4.code-header" // This is the position of "pub" in "pub fn a_method"
assert-attribute: (".impl-items .rustdoc-toggle", {"open": ""})
-click: ".impl-items .rustdoc-toggle summary::before" // This is the position of "[-]" next to that pub fn.
+click-with-offset: (
+ ".impl-items .rustdoc-toggle summary",
+ {"x": -24, "y": 8}, // This is the position of "[-]" next to that pub fn.
+)
assert-attribute-false: (".impl-items .rustdoc-toggle", {"open": ""})
// Click the "Trait" part of "impl Trait" and verify it navigates.
diff --git a/src/test/rustdoc-gui/type-declation-overflow.goml b/src/test/rustdoc-gui/type-declation-overflow.goml
index 22212a317..9a46908f9 100644
--- a/src/test/rustdoc-gui/type-declation-overflow.goml
+++ b/src/test/rustdoc-gui/type-declation-overflow.goml
@@ -32,6 +32,6 @@ assert-property: (".item-decl pre", {"scrollWidth": "950"})
size: (600, 600)
goto: file://|DOC_PATH|/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html
// It shouldn't have an overflow in the topbar either.
-assert-property: (".mobile-topbar .location", {"scrollWidth": "492"})
-assert-property: (".mobile-topbar .location", {"clientWidth": "492"})
+assert-property: (".mobile-topbar .location", {"scrollWidth": "500"})
+assert-property: (".mobile-topbar .location", {"clientWidth": "500"})
assert-css: (".mobile-topbar .location", {"overflow-x": "hidden"})
diff --git a/src/test/rustdoc-gui/where-whitespace.goml b/src/test/rustdoc-gui/where-whitespace.goml
new file mode 100644
index 000000000..1a3ff1f49
--- /dev/null
+++ b/src/test/rustdoc-gui/where-whitespace.goml
@@ -0,0 +1,27 @@
+// This test ensures that the where conditions are correctly displayed.
+goto: file://|DOC_PATH|/lib2/trait.Whitespace.html
+show-text: true
+// First, we check in the trait definition if the where clause is "on its own" (not on the same
+// line than "pub trait Whitespace<Idx>").
+compare-elements-position-false: (".item-decl code", ".where.fmt-newline", ("y"))
+// And that the code following it isn't on the same line either.
+compare-elements-position-false: (".item-decl .fnname", ".where.fmt-newline", ("y"))
+
+goto: file://|DOC_PATH|/lib2/struct.WhereWhitespace.html
+// We make the screen a bit wider to ensure that the trait impl is on one line.
+size: (915, 915)
+
+compare-elements-position-false: ("#method\.new .fnname", "#method\.new .where.fmt-newline", ("y"))
+// We ensure that both the trait name and the struct name are on the same line in
+// "impl<K, T> Whitespace<&K> for WhereWhitespace<T>".
+compare-elements-position: (
+ "#trait-implementations-list .impl h3 .trait",
+ "#trait-implementations-list .impl h3 .struct",
+ ("y"),
+)
+// And we now check that the where condition isn't on the same line.
+compare-elements-position-false: (
+ "#trait-implementations-list .impl h3 .trait",
+ "#trait-implementations-list .impl h3 .where.fmt-newline",
+ ("y"),
+)