Skip to content

Commit d4f3cf0

Browse files
Add test for <code> in doc blocks on mobile
1 parent 0bfac7f commit d4f3cf0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// If we have a long `<code>`, we need to ensure that it'll be fully displayed on mobile, meaning
2+
// that it'll be on two lines.
3+
emulate: "iPhone 8" // it has the following size: (375, 667)
4+
goto: file://|DOC_PATH|/test_docs/long_code_block/index.html
5+
// We now check that the block is on two lines:
6+
show-text: true // We need to enable text draw to be able to have the "real" size
7+
// Little explanations for this test: if the text wasn't displayed on two lines, it would take
8+
// around 20px (which is the font size).
9+
assert-property: (".docblock p > code", {"offsetHeight": "42"})

src/test/rustdoc-gui/src/test_docs/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,6 @@ pub type SomeType = u32;
120120
pub mod huge_amount_of_consts {
121121
include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs"));
122122
}
123+
124+
/// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`.
125+
pub mod long_code_block {}

0 commit comments

Comments
 (0)