Skip to content

Commit 0f2e137

Browse files
committed
Add test for item-table with resize to mobile
1 parent a48d9d1 commit 0f2e137

File tree

7 files changed

+55
-10
lines changed

7 files changed

+55
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// These tests verify that labels like "UNIX" and "Deprecated" stay on the same line as their symbol.
2+
// It also verifies the staggered layout on mobile.
3+
goto: file://|DOC_PATH|/test_docs/index.html
4+
5+
// Desktop view
6+
size: (1080, 600)
7+
assert: (".stab.deprecated")
8+
assert: (".stab.portability")
9+
10+
// make sure that deprecated and portability are different colours
11+
assert-css: (".item-table .item-left .stab.deprecated", { "background-color": "rgb(255, 196, 196)" })
12+
assert-css: (".item-table .item-left .stab.portability", { "background-color": "rgb(243, 223, 255)" })
13+
14+
// table like view
15+
assert-css: (".item-right.docblock-short", { "padding-left": "0px" })
16+
// Requires new function: https://github.com/GuillaumeGomez/browser-UI-test/pull/202
17+
//compare-elements-position-near: ("//*[@class='item-left module-item']//a[text()='replaced_function']", ".item-left .stab.deprecated", ("y"))
18+
compare-elements-position: (".item-left .stab.deprecated", ".item-left .stab.portability", ("y"))
19+
20+
// Ensure no wrap
21+
//compare-elements-position: ("//*[@class='item-left module-item']//a[text()='replaced_function']", "//*[@class='item-right docblock-short']//p[text()='a thing with a label']", ("y"))
22+
compare-elements-position: ("//*[@class='item-left module-item']//a[text()='replaced_function']/..", "//*[@class='item-right docblock-short']//p[text()='a thing with a label']/..", ("y"))
23+
24+
25+
// Mobile view
26+
size: (600, 600)
27+
// staggered layout with 2em spacing
28+
assert-css: (".item-right.docblock-short", { "padding-left": "32px" })
29+
// Requires new function: https://github.com/GuillaumeGomez/browser-UI-test/pull/202
30+
//compare-elements-position-near: ("//*[@class='item-left module-item']//a[text()='replaced_function']", ".item-left .stab.deprecated", ("y"))
31+
compare-elements-position: (".item-left .stab.deprecated", ".item-left .stab.portability", ("y"))
32+
33+
// Ensure wrap
34+
compare-elements-position-false: ("//*[@class='item-left module-item']//a[text()='replaced_function']", "//*[@class='item-right docblock-short']//p[text()='a thing with a label']", ("y"))
35+
compare-elements-position-false: ("//*[@class='item-left module-item']//a[text()='replaced_function']/..", "//*[@class='item-right docblock-short']//p[text()='a thing with a label']/..", ("y"))
36+
compare-elements-position-false: (".item-left .stab.deprecated", "//*[@class='item-right docblock-short']//p[text()='a thing with a label']", ("y"))

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

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
#![crate_name = "test_docs"]
55
#![feature(doc_keyword)]
6+
#![feature(doc_cfg)]
67

78
use std::fmt;
89

@@ -90,6 +91,11 @@ pub trait AnotherOne {
9091
/// ```
9192
pub fn check_list_code_block() {}
9293

94+
/// a thing with a label
95+
#[deprecated(since = "1.0.0", note = "text why this deprecated")]
96+
#[doc(cfg(unix))]
97+
pub fn replaced_function() {}
98+
9399
pub enum AnEnum {
94100
WithVariants { and: usize, sub: usize, variants: usize },
95101
}

src/test/rustdoc/deprecated.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @has deprecated/index.html '//*[@class="item-right docblock-short"]/span[@class="stab deprecated"]' \
1+
// @has deprecated/index.html '//*[@class="item-left module-item"]/span[@class="stab deprecated"]' \
22
// 'Deprecated'
33
// @has - '//*[@class="item-right docblock-short"]' 'Deprecated docs'
44

src/test/rustdoc/doc-cfg.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub struct Portable;
1212
// @has doc_cfg/unix_only/index.html \
1313
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
1414
// 'This is supported on Unix only.'
15-
// @matches - '//*[@class="item-right docblock-short"]//*[@class="stab portability"]' '\AARM\Z'
15+
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AARM\Z'
1616
// @count - '//*[@class="stab portability"]' 2
1717
#[doc(cfg(unix))]
1818
pub mod unix_only {
@@ -42,7 +42,7 @@ pub mod unix_only {
4242
// @has doc_cfg/wasi_only/index.html \
4343
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
4444
// 'This is supported on WASI only.'
45-
// @matches - '//*[@class="item-right docblock-short"]//*[@class="stab portability"]' '\AWebAssembly\Z'
45+
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\AWebAssembly\Z'
4646
// @count - '//*[@class="stab portability"]' 2
4747
#[doc(cfg(target_os = "wasi"))]
4848
pub mod wasi_only {
@@ -74,7 +74,7 @@ pub mod wasi_only {
7474

7575
// the portability header is different on the module view versus the full view
7676
// @has doc_cfg/index.html
77-
// @matches - '//*[@class="item-right docblock-short"]//*[@class="stab portability"]' '\Aavx\Z'
77+
// @matches - '//*[@class="item-left module-item"]//*[@class="stab portability"]' '\Aavx\Z'
7878

7979
// @has doc_cfg/fn.uses_target_feature.html
8080
// @has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \

src/test/rustdoc/duplicate-cfg.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
#![feature(doc_cfg)]
33

44
// @has 'foo/index.html'
5-
// @matches '-' '//*[@class="item-right docblock-short"]//*[@class="stab portability"]' '^sync$'
6-
// @has '-' '//*[@class="item-right docblock-short"]//*[@class="stab portability"]/@title' 'This is supported on crate feature `sync` only'
5+
// @matches '-' '//*[@class="item-left module-item"]//*[@class="stab portability"]' '^sync$'
6+
// @has '-' '//*[@class="item-left module-item"]//*[@class="stab portability"]/@title' 'This is supported on crate feature `sync` only'
77

88
// @has 'foo/struct.Foo.html'
99
// @has '-' '//*[@class="stab portability"]' 'sync'
1010
#[doc(cfg(feature = "sync"))]
1111
#[doc(cfg(feature = "sync"))]
12+
/// my feature sync struct
1213
pub struct Foo;
1314

1415
// @has 'foo/bar/index.html'

src/test/rustdoc/inline_cross/macros.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
extern crate macros;
99

10-
// @has foo/index.html '//*[@class="item-right docblock-short"]/span[@class="stab deprecated"]' Deprecated
11-
// @has - '//*[@class="item-right docblock-short"]/span[@class="stab unstable"]' Experimental
10+
// @has foo/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab deprecated"]' \
11+
// Deprecated
12+
// @has - '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab unstable"]' \
13+
// Experimental
1214

1315
// @has foo/macro.my_macro.html
1416
// @has - '//*[@class="docblock"]' 'docs for my_macro'

src/test/rustdoc/issue-32374.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
#![unstable(feature="test", issue = "32374")]
55

6-
// @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/span[@class="stab deprecated"]' \
6+
// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab deprecated"]' \
77
// 'Deprecated'
8-
// @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/span[@class="stab unstable"]' \
8+
// @matches issue_32374/index.html '//*[@class="item-left unstable deprecated module-item"]/span[@class="stab unstable"]' \
99
// 'Experimental'
1010
// @matches issue_32374/index.html '//*[@class="item-right docblock-short"]/text()' 'Docs'
1111

0 commit comments

Comments
 (0)