summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc-gui/search-result-display.goml
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/rustdoc-gui/search-result-display.goml')
-rw-r--r--src/test/rustdoc-gui/search-result-display.goml42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/search-result-display.goml b/src/test/rustdoc-gui/search-result-display.goml
new file mode 100644
index 000000000..8464ba7c2
--- /dev/null
+++ b/src/test/rustdoc-gui/search-result-display.goml
@@ -0,0 +1,42 @@
+// Checks that the search results have the expected width.
+goto: file://|DOC_PATH|/test_docs/index.html
+size: (900, 1000)
+write: (".search-input", "test")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+wait-for: "#search-settings"
+// 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"})
+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"})
+
+// 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},
+)
+
+// Then we update the text of one of the `<option>`.
+text: (
+ "#crate-search option",
+ "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.
+assert-css: ("#search", {"width": "640px"})