summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-gui')
-rw-r--r--tests/rustdoc-gui/codeblock-tooltip.goml2
-rw-r--r--tests/rustdoc-gui/docblock-code-block-line-number.goml6
-rw-r--r--tests/rustdoc-gui/fields.goml18
-rw-r--r--tests/rustdoc-gui/headers-color.goml22
-rw-r--r--tests/rustdoc-gui/help-page.goml4
-rw-r--r--tests/rustdoc-gui/label-next-to-symbol.goml12
-rw-r--r--tests/rustdoc-gui/notable-trait.goml43
-rw-r--r--tests/rustdoc-gui/search-filter.goml18
-rw-r--r--tests/rustdoc-gui/search-reexport.goml10
-rw-r--r--tests/rustdoc-gui/search-result-color.goml43
-rw-r--r--tests/rustdoc-gui/search-result-display.goml46
-rw-r--r--tests/rustdoc-gui/search-result-keyword.goml7
-rw-r--r--tests/rustdoc-gui/search-tab-change-title-fn-sig.goml2
-rw-r--r--tests/rustdoc-gui/setting-go-to-only-result.goml9
-rw-r--r--tests/rustdoc-gui/settings.goml60
-rw-r--r--tests/rustdoc-gui/shortcuts.goml6
-rw-r--r--tests/rustdoc-gui/sidebar-mobile.goml12
-rw-r--r--tests/rustdoc-gui/sidebar-source-code.goml12
-rw-r--r--tests/rustdoc-gui/source-code-page.goml24
-rw-r--r--tests/rustdoc-gui/src/test_docs/lib.rs30
-rw-r--r--tests/rustdoc-gui/target.goml8
-rw-r--r--tests/rustdoc-gui/theme-change.goml6
-rw-r--r--tests/rustdoc-gui/theme-in-history.goml6
23 files changed, 251 insertions, 155 deletions
diff --git a/tests/rustdoc-gui/codeblock-tooltip.goml b/tests/rustdoc-gui/codeblock-tooltip.goml
index e1c81ed79..7be5e39ba 100644
--- a/tests/rustdoc-gui/codeblock-tooltip.goml
+++ b/tests/rustdoc-gui/codeblock-tooltip.goml
@@ -40,6 +40,7 @@ define-function: (
"background-color": |background|,
"border-color": |border|,
})
+ click: ".docblock .example-wrap.compile_fail .tooltip"
// should_panic block
assert-css: (
@@ -71,6 +72,7 @@ define-function: (
"background-color": |background|,
"border-color": |border|,
})
+ click: ".docblock .example-wrap.should_panic .tooltip"
// ignore block
assert-css: (
diff --git a/tests/rustdoc-gui/docblock-code-block-line-number.goml b/tests/rustdoc-gui/docblock-code-block-line-number.goml
index 4c36394a3..a50449e17 100644
--- a/tests/rustdoc-gui/docblock-code-block-line-number.goml
+++ b/tests/rustdoc-gui/docblock-code-block-line-number.goml
@@ -37,15 +37,15 @@ define-function: (
)
call-function: ("check-colors", {
"theme": "ayu",
- "color": "rgb(92, 103, 115)",
+ "color": "#5c6773",
})
call-function: ("check-colors", {
"theme": "dark",
- "color": "rgb(59, 145, 226)",
+ "color": "#3b91e2",
})
call-function: ("check-colors", {
"theme": "light",
- "color": "rgb(198, 126, 45)",
+ "color": "#c67e2d",
})
// The first code block has two lines so let's check its `<pre>` elements lists both of them.
diff --git a/tests/rustdoc-gui/fields.goml b/tests/rustdoc-gui/fields.goml
new file mode 100644
index 000000000..b8139a2ed
--- /dev/null
+++ b/tests/rustdoc-gui/fields.goml
@@ -0,0 +1,18 @@
+// This test checks that fields are displayed as expected (one by line).
+go-to: "file://" + |DOC_PATH| + "/test_docs/fields/struct.Struct.html"
+store-position: ("#structfield\.a", {"y": a_y})
+store-position: ("#structfield\.b", {"y": b_y})
+assert: |a_y| < |b_y|
+
+go-to: "file://" + |DOC_PATH| + "/test_docs/fields/union.Union.html"
+store-position: ("#structfield\.a", {"y": a_y})
+store-position: ("#structfield\.b", {"y": b_y})
+assert: |a_y| < |b_y|
+
+go-to: "file://" + |DOC_PATH| + "/test_docs/fields/enum.Enum.html"
+store-position: ("#variant\.A\.field\.a", {"y": a_y})
+store-position: ("#variant\.A\.field\.b", {"y": b_y})
+assert: |a_y| < |b_y|
+store-position: ("#variant\.B\.field\.a", {"y": a_y})
+store-position: ("#variant\.B\.field\.b", {"y": b_y})
+assert: |a_y| < |b_y|
diff --git a/tests/rustdoc-gui/headers-color.goml b/tests/rustdoc-gui/headers-color.goml
index 7d83833a8..a7ac94c49 100644
--- a/tests/rustdoc-gui/headers-color.goml
+++ b/tests/rustdoc-gui/headers-color.goml
@@ -42,29 +42,29 @@ call-function: (
"check-colors",
{
"theme": "ayu",
- "color": "rgb(197, 197, 197)",
- "code_header_color": "rgb(230, 225, 207)",
+ "color": "#c5c5c5",
+ "code_header_color": "#e6e1cf",
"focus_background_color": "rgba(255, 236, 164, 0.06)",
- "headings_color": "rgb(57, 175, 215)",
+ "headings_color": "#39afd7",
},
)
call-function: (
"check-colors",
{
"theme": "dark",
- "color": "rgb(221, 221, 221)",
- "code_header_color": "rgb(221, 221, 221)",
- "focus_background_color": "rgb(73, 74, 61)",
- "headings_color": "rgb(210, 153, 29)",
+ "color": "#ddd",
+ "code_header_color": "#ddd",
+ "focus_background_color": "#494a3d",
+ "headings_color": "#d2991d",
},
)
call-function: (
"check-colors",
{
"theme": "light",
- "color": "rgb(0, 0, 0)",
- "code_header_color": "rgb(0, 0, 0)",
- "focus_background_color": "rgb(253, 255, 211)",
- "headings_color": "rgb(56, 115, 173)",
+ "color": "black",
+ "code_header_color": "black",
+ "focus_background_color": "#fdffd3",
+ "headings_color": "#3873ad",
},
)
diff --git a/tests/rustdoc-gui/help-page.goml b/tests/rustdoc-gui/help-page.goml
index 1a1c1b28f..6e880302f 100644
--- a/tests/rustdoc-gui/help-page.goml
+++ b/tests/rustdoc-gui/help-page.goml
@@ -67,5 +67,5 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
set-window-size: (1000, 1000) // Popover only appears when the screen width is >700px.
assert-false: "#help"
click: "#help-button > a"
-click: ".popover a[href='https://doc.rust-lang.org/rustdoc/']"
-wait-for-document-property: {"URL": "https://doc.rust-lang.org/rustdoc/"}
+click: "//*[@id='help']//a[text()='the rustdoc book']"
+wait-for-document-property: ({"URL": "https://doc.rust-lang.org/"}, STARTS_WITH)
diff --git a/tests/rustdoc-gui/label-next-to-symbol.goml b/tests/rustdoc-gui/label-next-to-symbol.goml
index 6c6380256..eb603d6c6 100644
--- a/tests/rustdoc-gui/label-next-to-symbol.goml
+++ b/tests/rustdoc-gui/label-next-to-symbol.goml
@@ -37,7 +37,6 @@ compare-elements-position: (
("y"),
)
-
// Mobile view
set-window-size: (600, 600)
// staggered layout with 2em spacing
@@ -64,3 +63,14 @@ compare-elements-position-false: (
"//*[@class='desc docblock-short'][text()='a thing with a label']",
("y"),
)
+
+// Ensure it doesn't expand.
+set-window-size: (800, 800)
+go-to: "file://" + |DOC_PATH| + "/test_docs/cfgs/index.html"
+// This part of the tags should not be on the same line as the beginning since the width
+// is too small for that.
+compare-elements-position-false: (
+ "//*[@class='stab portability']/code[text()='appservice-api-c']",
+ "//*[@class='stab portability']/code[text()='server']",
+ ("y"),
+)
diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml
index ecb57c274..e10bb538f 100644
--- a/tests/rustdoc-gui/notable-trait.goml
+++ b/tests/rustdoc-gui/notable-trait.goml
@@ -122,7 +122,7 @@ assert-count: ("//*[@class='tooltip popover']", 0)
// Now check the colors.
define-function: (
"check-colors",
- (theme, header_color, content_color, type_color, trait_color),
+ (theme, header_color, content_color, type_color, trait_color, link_color),
block {
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html"
// This is needed to ensure that the text color is computed.
@@ -133,8 +133,20 @@ define-function: (
// We reload the page so the local storage settings are being used.
reload:
+ assert-css: (
+ "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
+ {"color": |content_color|},
+ ALL,
+ )
+
move-cursor-to: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']"
- assert-count: (".tooltip.popover", 1)
+ wait-for-count: (".tooltip.popover", 1)
+
+ assert-css: (
+ "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']",
+ {"color": |link_color|},
+ ALL,
+ )
assert-css: (
".tooltip.popover h3",
@@ -163,10 +175,11 @@ call-function: (
"check-colors",
{
"theme": "ayu",
- "content_color": "rgb(230, 225, 207)",
- "header_color": "rgb(255, 255, 255)",
- "type_color": "rgb(255, 160, 165)",
- "trait_color": "rgb(57, 175, 215)",
+ "link_color": "#39afd7",
+ "content_color": "#e6e1cf",
+ "header_color": "#fff",
+ "type_color": "#ffa0a5",
+ "trait_color": "#39afd7",
},
)
@@ -174,10 +187,11 @@ call-function: (
"check-colors",
{
"theme": "dark",
- "content_color": "rgb(221, 221, 221)",
- "header_color": "rgb(221, 221, 221)",
- "type_color": "rgb(45, 191, 184)",
- "trait_color": "rgb(183, 140, 242)",
+ "link_color": "#d2991d",
+ "content_color": "#ddd",
+ "header_color": "#ddd",
+ "type_color": "#2dbfb8",
+ "trait_color": "#b78cf2",
},
)
@@ -185,10 +199,11 @@ call-function: (
"check-colors",
{
"theme": "light",
- "content_color": "rgb(0, 0, 0)",
- "header_color": "rgb(0, 0, 0)",
- "type_color": "rgb(173, 55, 138)",
- "trait_color": "rgb(110, 79, 201)",
+ "link_color": "#3873ad",
+ "content_color": "black",
+ "header_color": "black",
+ "type_color": "#ad378a",
+ "trait_color": "#6e4fc9",
},
)
diff --git a/tests/rustdoc-gui/search-filter.goml b/tests/rustdoc-gui/search-filter.goml
index d739471a6..9e2855b5e 100644
--- a/tests/rustdoc-gui/search-filter.goml
+++ b/tests/rustdoc-gui/search-filter.goml
@@ -65,9 +65,9 @@ reload:
set-timeout: 2000
wait-for: "#crate-search"
assert-css: ("#crate-search", {
- "border": "1px solid rgb(224, 224, 224)",
- "color": "rgb(0, 0, 0)",
- "background-color": "rgb(255, 255, 255)",
+ "border": "1px solid #e0e0e0",
+ "color": "black",
+ "background-color": "white",
})
// We now check the dark theme.
@@ -75,15 +75,15 @@ click: "#settings-menu"
wait-for: "#settings"
click: "#theme-dark"
wait-for-css: ("#crate-search", {
- "border": "1px solid rgb(224, 224, 224)",
- "color": "rgb(221, 221, 221)",
- "background-color": "rgb(53, 53, 53)",
+ "border": "1px solid #e0e0e0",
+ "color": "#ddd",
+ "background-color": "#353535",
})
// And finally we check the ayu theme.
click: "#theme-ayu"
wait-for-css: ("#crate-search", {
- "border": "1px solid rgb(92, 103, 115)",
- "color": "rgb(255, 255, 255)",
- "background-color": "rgb(15, 20, 25)",
+ "border": "1px solid #5c6773",
+ "color": "#fff",
+ "background-color": "#0f1419",
})
diff --git a/tests/rustdoc-gui/search-reexport.goml b/tests/rustdoc-gui/search-reexport.goml
index fd817b589..6ea6d53e2 100644
--- a/tests/rustdoc-gui/search-reexport.goml
+++ b/tests/rustdoc-gui/search-reexport.goml
@@ -14,10 +14,10 @@ assert-attribute: (
"//a[@class='result-import']",
{"href": "../test_docs/index.html#reexport.TheStdReexport"},
)
-assert-text: ("//a[@class='result-import']", "test_docs::TheStdReexport")
+assert-text: ("a.result-import .result-name", "re-export test_docs::TheStdReexport")
click: "//a[@class='result-import']"
// We check that it has the background modified thanks to the focus.
-wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgb(73, 74, 61)"})
+wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "#494a3d"})
// We now check that the alias is working as well on the reexport.
// To be SURE that the search will be run.
@@ -25,9 +25,9 @@ press-key: 'Enter'
write: (".search-input", "AliasForTheStdReexport")
wait-for: "//a[@class='result-import']"
assert-text: (
- "//a[@class='result-import']",
- "AliasForTheStdReexport - see test_docs::TheStdReexport",
+ "a.result-import .result-name",
+ "AliasForTheStdReexport - see re-export test_docs::TheStdReexport",
)
// Same thing again, we click on it to ensure the background is once again set as expected.
click: "//a[@class='result-import']"
-wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgb(73, 74, 61)"})
+wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "#494a3d"})
diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml
index 90f7160b7..7a7785fd9 100644
--- a/tests/rustdoc-gui/search-result-color.goml
+++ b/tests/rustdoc-gui/search-result-color.goml
@@ -28,6 +28,12 @@ define-function: (
".result-" + |result_kind| + ":focus ." + |result_kind|,
{"color": |hover_color|},
)
+ // color of the typename (struct, module, method, ...) before search results
+ assert-css: (
+ ".result-name .typename",
+ {"color": |grey|},
+ ALL,
+ )
},
)
@@ -55,7 +61,7 @@ assert-css: (
{"color": "#c5c5c5"},
)
assert-css: (
- "//*[@class='result-name']/*[text()='test_docs::']",
+ "//*[@class='result-name']//*[text()='test_docs::']",
{"color": "#0096cf"},
)
@@ -65,16 +71,11 @@ assert-css: (
{"border-bottom-color": "#aaa3"}
)
-// Checking the color of "keyword" text.
-assert-css: (
- "//*[@class='result-name']//*[text()='(keyword)']",
- {"color": "#788797"},
-)
-
store-value: (entry_color, "#0096cf") // color of the search entry
store-value: (hover_entry_color, "#fff") // color of the hovered/focused search entry
store-value: (background_color, "transparent") // background color
store-value: (hover_background_color, "#3c3c3c") // hover background color
+store-value: (grey, "#999")
call-function: (
"check-result-color", (
@@ -137,7 +138,7 @@ call-function: (
move-cursor-to: ".search-input"
focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
assert-css: (
- "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
+ "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
{"color": "#0096cf", "background-color": "transparent"},
ALL,
)
@@ -145,11 +146,11 @@ assert-css: (
// Checking color and background on hover.
move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
assert-css: (
- "//*[@class='result-name']/*[text()='test_docs::']",
+ "//*[@class='result-name']//*[text()='test_docs::']",
{"color": "#fff"},
)
assert-css: (
- "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
+ "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
{"color": "#fff", "background-color": "rgb(60, 60, 60)"},
)
@@ -172,7 +173,7 @@ assert-css: (
{"color": "#ddd"},
)
assert-css: (
- "//*[@class='result-name']/*[text()='test_docs::']",
+ "//*[@class='result-name']//*[text()='test_docs::']",
{"color": "#ddd"},
)
@@ -182,16 +183,11 @@ assert-css: (
{"border-bottom-color": "#aaa3"}
)
-// Checking the color for "keyword" text.
-assert-css: (
- "//*[@class='result-name']//*[text()='(keyword)']",
- {"color": "#ddd"},
-)
-
store-value: (entry_color, "#ddd") // color of the search entry
store-value: (hover_entry_color, "#ddd") // color of the hovered/focused search entry
store-value: (background_color, "transparent") // background color
store-value: (hover_background_color, "#616161") // hover background color
+store-value: (grey, "#ccc")
call-function: (
"check-result-color", (
@@ -254,7 +250,7 @@ call-function: (
move-cursor-to: ".search-input"
focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
assert-css: (
- "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
+ "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
{"color": "#ddd", "background-color": "transparent"},
)
@@ -274,7 +270,7 @@ assert-css: (
{"color": "#000"},
)
assert-css: (
- "//*[@class='result-name']/*[text()='test_docs::']",
+ "//*[@class='result-name']//*[text()='test_docs::']",
{"color": "#000"},
)
@@ -284,16 +280,11 @@ assert-css: (
{"border-bottom-color": "#aaa3"}
)
-// Checking the color for "keyword" text.
-assert-css: (
- "//*[@class='result-name']//*[text()='(keyword)']",
- {"color": "#000"},
-)
-
store-value: (entry_color, "#000") // color of the search entry
store-value: (hover_entry_color, "#000") // color of the hovered/focused search entry
store-value: (background_color, "transparent") // background color
store-value: (hover_background_color, "#ccc") // hover background color
+store-value: (grey, "#999")
call-function: (
"check-result-color", (
@@ -356,7 +347,7 @@ call-function: (
move-cursor-to: ".search-input"
focus: ".search-input" // To ensure the `<a>` container isnt focus or hover.
assert-css: (
- "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
+ "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
{"color": "#000", "background-color": "transparent"},
)
diff --git a/tests/rustdoc-gui/search-result-display.goml b/tests/rustdoc-gui/search-result-display.goml
index ee5598e4b..6ce13b8c3 100644
--- a/tests/rustdoc-gui/search-result-display.goml
+++ b/tests/rustdoc-gui/search-result-display.goml
@@ -1,3 +1,4 @@
+// ignore-tidy-linelength
// Checks that the search results have the expected width.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
set-window-size: (900, 1000)
@@ -7,14 +8,41 @@ press-key: 'Enter'
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": "310px"})
+assert-size: (".search-results div.desc", {"width": 248})
+store-size: (".search-results .result-name .typename", {"width": width})
set-window-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": "566px"})
+assert-size: (".search-results div.desc", {"width": 566})
// The result set is all on one line.
-assert-css: (".search-results .result-name > span", {"display": "inline"})
+compare-elements-position-near: (
+ ".search-results .result-name .typename",
+ ".search-results .result-name .path",
+ {"y": 2},
+)
+compare-elements-position-near-false: (
+ ".search-results .result-name .typename",
+ ".search-results .result-name .path",
+ {"x": 5},
+)
+// The width of the "typename" isn't fixed anymore in this display mode.
+store-size: (".search-results .result-name .typename", {"width": new_width})
+assert: |new_width| < |width| - 10
+
+// Check that if the search is too long on mobile, it'll go under the "typename".
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName"
+wait-for: "#crate-search"
+compare-elements-position-near: (
+ ".search-results .result-name .typename",
+ ".search-results .result-name .path",
+ {"y": 2, "x": 0},
+)
+compare-elements-size-near: (
+ ".search-results .result-name",
+ ".search-results .result-name .path",
+ {"width": 8, "height": 8},
+)
// 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>`.
@@ -57,22 +85,22 @@ define-function: (
call-function: ("check-filter", {
"theme": "ayu",
- "border": "rgb(92, 103, 115)",
+ "border": "#5c6773",
"filter": "invert(0.41) sepia(0.12) saturate(4.87) hue-rotate(171deg) brightness(0.94) contrast(0.94)",
- "hover_border": "rgb(224, 224, 224)",
+ "hover_border": "#e0e0e0",
"hover_filter": "invert(0.98) sepia(0.12) saturate(0.81) hue-rotate(343deg) brightness(1.13) contrast(0.76)",
})
call-function: ("check-filter", {
"theme": "dark",
- "border": "rgb(224, 224, 224)",
+ "border": "#e0e0e0",
"filter": "invert(0.94) sepia(0) saturate(7.21) hue-rotate(255deg) brightness(0.9) contrast(0.9)",
- "hover_border": "rgb(33, 150, 243)",
+ "hover_border": "#2196f3",
"hover_filter": "invert(0.69) sepia(0.6) saturate(66.13) hue-rotate(184deg) brightness(1) contrast(0.91)",
})
call-function: ("check-filter", {
"theme": "light",
- "border": "rgb(224, 224, 224)",
+ "border": "#e0e0e0",
"filter": "invert(1) sepia(0) saturate(42.23) hue-rotate(289deg) brightness(1.14) contrast(0.76)",
- "hover_border": "rgb(113, 113, 113)",
+ "hover_border": "#717171",
"hover_filter": "invert(0.44) sepia(0.18) saturate(0.23) hue-rotate(317deg) brightness(0.96) contrast(0.93)",
})
diff --git a/tests/rustdoc-gui/search-result-keyword.goml b/tests/rustdoc-gui/search-result-keyword.goml
index 5d56e9d9c..1b2be6d4e 100644
--- a/tests/rustdoc-gui/search-result-keyword.goml
+++ b/tests/rustdoc-gui/search-result-keyword.goml
@@ -5,9 +5,4 @@ write: (".search-input", "CookieMonster")
press-key: 'Enter'
// Waiting for the search results to appear...
wait-for: "#search-tabs"
-// Note: The two next assert commands could be merged as one but readability would be
-// less good.
-//
-// Checking that the CSS is displaying " (keyword)" in italic.
-assert-text: (".result-name span.keyword > i", "(keyword)")
-assert-text: (".result-name span.keyword", "CookieMonster (keyword)")
+assert-text: (".result-keyword .result-name", "keyword CookieMonster")
diff --git a/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml b/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml
index b3f9ae928..156d8d03c 100644
--- a/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml
+++ b/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml
@@ -55,7 +55,7 @@ assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Return Types"
// Try with a search-by-parameter
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
-write: (".search-input", "usize pattern")
+write: (".search-input", "usize,pattern")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
diff --git a/tests/rustdoc-gui/setting-go-to-only-result.goml b/tests/rustdoc-gui/setting-go-to-only-result.goml
index c5720b4bf..45e0b3490 100644
--- a/tests/rustdoc-gui/setting-go-to-only-result.goml
+++ b/tests/rustdoc-gui/setting-go-to-only-result.goml
@@ -34,7 +34,14 @@ go-to: "file://" + |DOC_PATH| + "/lib2/index.html"
// We enter it into the search.
write: (".search-input", "HasALongTraitWithParams")
wait-for-document-property: {"title": "HasALongTraitWithParams in lib2 - Rust"}
-assert-document-property: ({"URL": "/lib2/struct.HasALongTraitWithParams.html"}, ENDS_WITH)
+assert-window-property: ({"location": "/lib2/struct.HasALongTraitWithParams.html"}, ENDS_WITH)
+
+// Regression test for <https://github.com/rust-lang/rust/issues/112676>.
+// If "go-to-only-result" is enabled and you go back to history, it should not lead you back to the
+// page result again automatically.
+history-go-back:
+wait-for-document-property: {"title": "lib2 - Rust"}
+assert-window-property: ({"location": "/lib2/index.html"}, ENDS_WITH)
// We try again to see if it goes to the only result
go-to: "file://" + |DOC_PATH| + "/lib2/index.html?search=HasALongTraitWithParams"
diff --git a/tests/rustdoc-gui/settings.goml b/tests/rustdoc-gui/settings.goml
index c37d96932..e40c637dc 100644
--- a/tests/rustdoc-gui/settings.goml
+++ b/tests/rustdoc-gui/settings.goml
@@ -56,19 +56,19 @@ move-cursor-to: "#settings-menu > a"
assert-css: (
"#theme-dark",
{
- "border-color": "rgb(153, 153, 153)",
- "box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset",
+ "border-color": "#999",
+ "box-shadow": "#353535 0px 0px 0px 3px inset",
"border-width": "2px",
},
)
-assert-css: ("#theme-light", {"border-color": "rgb(153, 153, 153)", "box-shadow": "none"})
+assert-css: ("#theme-light", {"border-color": "#999", "box-shadow": "none"})
// Let's start with the hover for radio buttons.
move-cursor-to: "#theme-dark"
assert-css: (
"#theme-dark",
{
- "border-color": "rgb(33, 150, 243)",
- "box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset",
+ "border-color": "#2196f3",
+ "box-shadow": "#353535 0px 0px 0px 3px inset",
"border-width": "2px",
},
)
@@ -76,7 +76,7 @@ move-cursor-to: "#theme-light"
assert-css: (
"#theme-light",
{
- "border-color": "rgb(33, 150, 243)",
+ "border-color": "#2196f3",
"box-shadow": "none",
"border-width": "2px",
}
@@ -87,8 +87,8 @@ focus: "#theme-dark"
assert-css: (
"#theme-dark",
{
- "border-color": "rgb(153, 153, 153)",
- "box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset, rgb(33, 150, 243) 0px 0px 2px 2px",
+ "border-color": "#999",
+ "box-shadow": "#353535 0px 0px 0px 3px inset, #2196f3 0px 0px 2px 2px",
"border-width": "2px",
},
)
@@ -96,8 +96,8 @@ focus: "#theme-light"
assert-css: (
"#theme-light",
{
- "border-color": "rgb(153, 153, 153)",
- "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
+ "border-color": "#999",
+ "box-shadow": "#2196f3 0px 0px 1px 1px",
"border-width": "2px",
},
)
@@ -107,8 +107,8 @@ focus: "#theme-dark"
assert-css: (
"#theme-dark",
{
- "border-color": "rgb(33, 150, 243)",
- "box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset, rgb(33, 150, 243) 0px 0px 2px 2px",
+ "border-color": "#2196f3",
+ "box-shadow": "#353535 0px 0px 0px 3px inset, #2196f3 0px 0px 2px 2px",
"border-width": "2px",
},
)
@@ -117,8 +117,8 @@ focus: "#theme-light"
assert-css: (
"#theme-light",
{
- "border-color": "rgb(33, 150, 243)",
- "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
+ "border-color": "#2196f3",
+ "box-shadow": "#2196f3 0px 0px 1px 1px",
"border-width": "2px",
},
)
@@ -154,8 +154,8 @@ compare-elements-position-near: (
assert-css: (
"#auto-hide-large-items",
{
- "background-color": "rgb(33, 150, 243)",
- "border-color": "rgb(153, 153, 153)",
+ "background-color": "#2196f3",
+ "border-color": "#999",
// 1px border when checked
"border-width": "1px",
},
@@ -164,7 +164,7 @@ assert-css: (
"#auto-hide-method-docs",
{
"background-color": "rgba(0, 0, 0, 0)",
- "border-color": "rgb(153, 153, 153)",
+ "border-color": "#999",
// 2px border when unchecked
"border-width": "2px",
},
@@ -174,8 +174,8 @@ move-cursor-to: "#auto-hide-large-items"
assert-css: (
"#auto-hide-large-items",
{
- "background-color": "rgb(33, 150, 243)",
- "border-color": "rgb(33, 150, 243)",
+ "background-color": "#2196f3",
+ "border-color": "#2196f3",
// 1px border when checked
"border-width": "1px",
},
@@ -185,7 +185,7 @@ assert-css: (
"#auto-hide-method-docs",
{
"background-color": "rgba(0, 0, 0, 0)",
- "border-color": "rgb(33, 150, 243)",
+ "border-color": "#2196f3",
// 2px border when unchecked
"border-width": "2px",
},
@@ -196,9 +196,9 @@ focus: "#auto-hide-large-items"
assert-css: (
"#auto-hide-large-items",
{
- "background-color": "rgb(33, 150, 243)",
- "border-color": "rgb(153, 153, 153)",
- "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
+ "background-color": "#2196f3",
+ "border-color": "#999",
+ "box-shadow": "#2196f3 0px 0px 1px 1px",
// 1px border when checked
"border-width": "1px",
},
@@ -208,8 +208,8 @@ assert-css: (
"#auto-hide-method-docs",
{
"background-color": "rgba(0, 0, 0, 0)",
- "border-color": "rgb(153, 153, 153)",
- "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
+ "border-color": "#999",
+ "box-shadow": "#2196f3 0px 0px 1px 1px",
// 2px border when unchecked
"border-width": "2px",
},
@@ -220,9 +220,9 @@ focus: "#auto-hide-large-items"
assert-css: (
"#auto-hide-large-items",
{
- "background-color": "rgb(33, 150, 243)",
- "border-color": "rgb(33, 150, 243)",
- "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
+ "background-color": "#2196f3",
+ "border-color": "#2196f3",
+ "box-shadow": "#2196f3 0px 0px 1px 1px",
// 1px border when checked
"border-width": "1px",
},
@@ -233,8 +233,8 @@ assert-css: (
"#auto-hide-method-docs",
{
"background-color": "rgba(0, 0, 0, 0)",
- "border-color": "rgb(33, 150, 243)",
- "box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
+ "border-color": "#2196f3",
+ "box-shadow": "#2196f3 0px 0px 1px 1px",
// 2px border when unchecked
"border-width": "2px",
},
diff --git a/tests/rustdoc-gui/shortcuts.goml b/tests/rustdoc-gui/shortcuts.goml
index 667df89ec..2c61ee542 100644
--- a/tests/rustdoc-gui/shortcuts.goml
+++ b/tests/rustdoc-gui/shortcuts.goml
@@ -13,7 +13,7 @@ press-key: "Escape"
assert-css: ("#help-button .popover", {"display": "none"})
// Checking doc collapse and expand.
// It should be displaying a "-":
-assert-text: ("#toggle-all-docs", "[\u2212]")
+assert-text: ("#toggle-all-docs", "[−]")
press-key: "-"
wait-for-text: ("#toggle-all-docs", "[+]")
assert-attribute: ("#toggle-all-docs", {"class": "will-expand"})
@@ -23,9 +23,9 @@ assert-text: ("#toggle-all-docs", "[+]")
assert-attribute: ("#toggle-all-docs", {"class": "will-expand"})
// Expanding now.
press-key: "+"
-wait-for-text: ("#toggle-all-docs", "[\u2212]")
+wait-for-text: ("#toggle-all-docs", "[−]")
assert-attribute: ("#toggle-all-docs", {"class": ""})
// Pressing it again shouldn't do anything.
press-key: "+"
-assert-text: ("#toggle-all-docs", "[\u2212]")
+assert-text: ("#toggle-all-docs", "[−]")
assert-attribute: ("#toggle-all-docs", {"class": ""})
diff --git a/tests/rustdoc-gui/sidebar-mobile.goml b/tests/rustdoc-gui/sidebar-mobile.goml
index 3b022c7e9..4b8337ace 100644
--- a/tests/rustdoc-gui/sidebar-mobile.goml
+++ b/tests/rustdoc-gui/sidebar-mobile.goml
@@ -73,16 +73,16 @@ define-function: (
call-function: ("check-colors", {
"theme": "ayu",
- "color": "rgb(197, 197, 197)",
- "background": "rgb(20, 25, 31)",
+ "color": "#c5c5c5",
+ "background": "#14191f",
})
call-function: ("check-colors", {
"theme": "dark",
- "color": "rgb(221, 221, 221)",
- "background": "rgb(80, 80, 80)",
+ "color": "#ddd",
+ "background": "#505050",
})
call-function: ("check-colors", {
"theme": "light",
- "color": "rgb(0, 0, 0)",
- "background": "rgb(245, 245, 245)",
+ "color": "black",
+ "background": "#F5F5F5",
})
diff --git a/tests/rustdoc-gui/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml
index 520b2c59b..2cb888178 100644
--- a/tests/rustdoc-gui/sidebar-source-code.goml
+++ b/tests/rustdoc-gui/sidebar-source-code.goml
@@ -25,24 +25,24 @@ call-function: (
"check-colors",
{
"theme": "ayu",
- "color": "rgb(197, 197, 197)",
- "background_color": "rgb(20, 25, 31)",
+ "color": "#c5c5c5",
+ "background_color": "#14191f",
}
)
call-function: (
"check-colors",
{
"theme": "dark",
- "color": "rgb(221, 221, 221)",
- "background_color": "rgb(80, 80, 80)",
+ "color": "#ddd",
+ "background_color": "#505050",
}
)
call-function: (
"check-colors",
{
"theme": "light",
- "color": "rgb(0, 0, 0)",
- "background_color": "rgb(245, 245, 245)",
+ "color": "black",
+ "background_color": "#F5F5F5",
}
)
diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml
index d5dd511b1..f8f73398d 100644
--- a/tests/rustdoc-gui/source-code-page.goml
+++ b/tests/rustdoc-gui/source-code-page.goml
@@ -64,23 +64,23 @@ call-function: ("check-colors", {
compare-elements-position: ("//*[@id='1']", ".rust > code > span", ("y"))
// Check the `href` property so that users can treat anchors as links.
assert-property: (".src-line-numbers > a:nth-child(1)", {
- "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#1"
-})
+ "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#1"
+}, ENDS_WITH)
assert-property: (".src-line-numbers > a:nth-child(2)", {
- "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#2"
-})
+ "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#2"
+}, ENDS_WITH)
assert-property: (".src-line-numbers > a:nth-child(3)", {
- "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#3"
-})
+ "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#3"
+}, ENDS_WITH)
assert-property: (".src-line-numbers > a:nth-child(4)", {
- "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#4"
-})
+ "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#4"
+}, ENDS_WITH)
assert-property: (".src-line-numbers > a:nth-child(5)", {
- "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#5"
-})
+ "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#5"
+}, ENDS_WITH)
assert-property: (".src-line-numbers > a:nth-child(6)", {
- "href": "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#6"
-})
+ "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#6"
+}, ENDS_WITH)
// Assert that the line numbers text is aligned to the right.
assert-css: (".src-line-numbers", {"text-align": "right"})
diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs
index 6ad1e8b4f..ecf3a7cc1 100644
--- a/tests/rustdoc-gui/src/test_docs/lib.rs
+++ b/tests/rustdoc-gui/src/test_docs/lib.rs
@@ -486,3 +486,33 @@ pub mod search_results {
}
}
+
+pub mod fields {
+ pub struct Struct {
+ pub a: u8,
+ pub b: u32,
+ }
+ pub union Union {
+ pub a: u8,
+ pub b: u32,
+ }
+ pub enum Enum {
+ A {
+ a: u8,
+ b: u32,
+ },
+ B {
+ a: u8,
+ b: u32,
+ },
+ }
+}
+
+pub mod cfgs {
+ #[doc(cfg(all(
+ any(not(feature = "appservice-api-c"), not(feature = "appservice-api-s")),
+ any(not(feature = "client"), not(feature = "server")),
+ )))]
+ /// Some docs.
+ pub mod cfgs {}
+}
diff --git a/tests/rustdoc-gui/target.goml b/tests/rustdoc-gui/target.goml
index 0c514fc68..c5e7f813d 100644
--- a/tests/rustdoc-gui/target.goml
+++ b/tests/rustdoc-gui/target.goml
@@ -25,11 +25,11 @@ call-function: ("check-style", {
})
call-function: ("check-style", {
"theme": "dark",
- "background": "rgb(73, 74, 61)",
- "border": "rgb(187, 116, 16)",
+ "background": "#494a3d",
+ "border": "#bb7410",
})
call-function: ("check-style", {
"theme": "light",
- "background": "rgb(253, 255, 211)",
- "border": "rgb(173, 124, 55)",
+ "background": "#fdffd3",
+ "border": "#ad7c37",
})
diff --git a/tests/rustdoc-gui/theme-change.goml b/tests/rustdoc-gui/theme-change.goml
index ae6947213..e4b031b73 100644
--- a/tests/rustdoc-gui/theme-change.goml
+++ b/tests/rustdoc-gui/theme-change.goml
@@ -3,9 +3,9 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
reload:
-store-value: (background_light, "rgb(255, 255, 255)")
-store-value: (background_dark, "rgb(53, 53, 53)")
-store-value: (background_ayu, "rgb(15, 20, 25)")
+store-value: (background_light, "white")
+store-value: (background_dark, "#353535")
+store-value: (background_ayu, "#0f1419")
click: "#settings-menu"
wait-for: "#theme-ayu"
diff --git a/tests/rustdoc-gui/theme-in-history.goml b/tests/rustdoc-gui/theme-in-history.goml
index 8fcd0ecd3..42c5b5e6e 100644
--- a/tests/rustdoc-gui/theme-in-history.goml
+++ b/tests/rustdoc-gui/theme-in-history.goml
@@ -7,7 +7,7 @@ set-local-storage: {
}
// We reload the page so the local storage settings are being used.
reload:
-assert-css: ("body", { "background-color": "rgb(53, 53, 53)" })
+assert-css: ("body", { "background-color": "#353535" })
assert-local-storage: { "rustdoc-theme": "dark" }
// Now we go to the settings page.
@@ -15,7 +15,7 @@ go-to: "file://" + |DOC_PATH| + "/settings.html"
wait-for: "#settings"
// We change the theme to "light".
click: "#theme-light"
-wait-for-css: ("body", { "background-color": "rgb(255, 255, 255)" })
+wait-for-css: ("body", { "background-color": "white" })
assert-local-storage: { "rustdoc-theme": "light" }
// We go back in history.
@@ -23,5 +23,5 @@ history-go-back:
// Confirm that we're not on the settings page.
assert-false: "#settings"
// Check that the current theme is still "light".
-assert-css: ("body", { "background-color": "rgb(255, 255, 255)" })
+assert-css: ("body", { "background-color": "white" })
assert-local-storage: { "rustdoc-theme": "light" }