summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-gui/search-corrections.goml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /tests/rustdoc-gui/search-corrections.goml
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-gui/search-corrections.goml')
-rw-r--r--tests/rustdoc-gui/search-corrections.goml56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/rustdoc-gui/search-corrections.goml b/tests/rustdoc-gui/search-corrections.goml
new file mode 100644
index 000000000..5d1b83b35
--- /dev/null
+++ b/tests/rustdoc-gui/search-corrections.goml
@@ -0,0 +1,56 @@
+// ignore-tidy-linelength
+
+// Checks that the search tab result tell the user about corrections
+// First, try a search-by-name
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+// Intentionally wrong spelling of "NotableStructWithLongName"
+write: (".search-input", "NotableStructWithLongNamr")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+// Waiting for the search results to appear...
+wait-for: "#search-tabs"
+
+// Corrections aren't shown on the "In Names" tab.
+assert: "#search-tabs button.selected:first-child"
+assert-css: (".search-corrections", {
+ "display": "none"
+})
+
+// Corrections do get shown on the "In Parameters" tab.
+click: "#search-tabs button:nth-child(2)"
+assert: "#search-tabs button.selected:nth-child(2)"
+assert-css: (".search-corrections", {
+ "display": "block"
+})
+assert-text: (
+ ".search-corrections",
+ "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
+)
+
+// Corrections do get shown on the "In Return Type" tab.
+click: "#search-tabs button:nth-child(3)"
+assert: "#search-tabs button.selected:nth-child(3)"
+assert-css: (".search-corrections", {
+ "display": "block"
+})
+assert-text: (
+ ".search-corrections",
+ "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
+)
+
+// Now, explicit return values
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+// Intentionally wrong spelling of "NotableStructWithLongName"
+write: (".search-input", "-> NotableStructWithLongNamr")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+// Waiting for the search results to appear...
+wait-for: "#search-tabs"
+
+assert-css: (".search-corrections", {
+ "display": "block"
+})
+assert-text: (
+ ".search-corrections",
+ "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
+)