about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-09-21 16:08:54 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-09-21 16:40:31 +0200
commit6069f71e6c6d40bf72a7751450d91fa9b91ba6fa (patch)
treebd0f1829cc142b05301f164f71483e0b4b6388c1
parent150623eb6c0084042623f521c052694bd6718e2d (diff)
downloadrust-6069f71e6c6d40bf72a7751450d91fa9b91ba6fa.tar.gz
rust-6069f71e6c6d40bf72a7751450d91fa9b91ba6fa.zip
Add GUI test for `.stab` elements in docblocks
-rw-r--r--src/test/rustdoc-gui/check-stab-in-docblock.goml21
-rw-r--r--src/test/rustdoc-gui/src/test_docs/lib.rs18
2 files changed, 39 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/check-stab-in-docblock.goml b/src/test/rustdoc-gui/check-stab-in-docblock.goml
new file mode 100644
index 00000000000..7f965ada594
--- /dev/null
+++ b/src/test/rustdoc-gui/check-stab-in-docblock.goml
@@ -0,0 +1,21 @@
+// This test checks that using `.stab` attributes in `.docblock` elements doesn't
+// create scrollable paragraphs.
+goto: file://|DOC_PATH|/test_docs/index.html
+// Needs the text to be display to check for scrollable content.
+show-text: true
+size: (786, 600)
+// Confirms that there 3 paragraphs.
+assert-count: (".top-doc .docblock p", 3)
+// Checking that there is no scrollable content.
+assert-property: (
+    ".top-doc .docblock p:nth-of-type(1)",
+    {"scrollHeight": "120", "clientHeight": "120", "scrollWidth": "502", "clientWidth": "502"},
+)
+assert-property: (
+    ".top-doc .docblock p:nth-of-type(2)",
+    {"scrollHeight": "48", "clientHeight": "48", "scrollWidth": "502", "clientWidth": "502"},
+)
+assert-property: (
+    ".top-doc .docblock p:nth-of-type(3)",
+    {"scrollHeight": "48", "clientHeight": "48", "scrollWidth": "502", "clientWidth": "502"},
+)
diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs
index 4eedf7f15c3..f4c2dadea6d 100644
--- a/src/test/rustdoc-gui/src/test_docs/lib.rs
+++ b/src/test/rustdoc-gui/src/test_docs/lib.rs
@@ -6,6 +6,24 @@
 #![feature(rustdoc_internals)]
 #![feature(doc_cfg)]
 
+/*!
+Enable the feature <span class="stab portability"><code>some-feature</code></span> to enjoy
+this crate even more!
+Enable the feature <span class="stab portability"><code>some-feature</code></span> to enjoy
+this crate even more!
+Enable the feature <span class="stab portability"><code>some-feature</code></span> to enjoy
+this crate even more!
+
+Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
+Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
+Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
+
+Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
+</span>.
+Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
+</span>.
+*/
+
 use std::convert::AsRef;
 use std::fmt;