Skip to content

Commit caacb04

Browse files
Add GUI regression test for indent of trait items on mobile
1 parent 530f8bb commit caacb04

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

Diff for: tests/rustdoc-gui/search-tab.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ call-function: ("check-colors", {
7878
set-window-size: (851, 600)
7979

8080
// Check the size and count in tabs
81-
assert-text: ("#search-tabs > button:nth-child(1) > .count", " (26) ")
81+
assert-text: ("#search-tabs > button:nth-child(1) > .count", " (27) ")
8282
assert-text: ("#search-tabs > button:nth-child(2) > .count", " (7)  ")
8383
assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0)  ")
8484
store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})

Diff for: tests/rustdoc-gui/src/test_docs/lib.rs

+22
Original file line numberDiff line numberDiff line change
@@ -691,3 +691,25 @@ impl ImplDoc {
691691
impl ImplDoc {
692692
pub fn bar5() {}
693693
}
694+
695+
pub trait ItemsTrait {
696+
/// You want doc, here is doc!
697+
///
698+
/// blablala
699+
type F;
700+
701+
/// You want doc, here is doc!
702+
///
703+
/// blablala
704+
const X: u32;
705+
706+
/// You want doc, here is doc!
707+
///
708+
/// blablala
709+
fn foo() {}
710+
711+
/// You want doc, here is doc!
712+
///
713+
/// blablala
714+
fn bar();
715+
}

Diff for: tests/rustdoc-gui/toggle-docs-mobile.goml

+26
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,29 @@ assert-attribute: (".top-doc", {"open": ""})
3131
// To ensure that the toggle isn't over the text, we check that the toggle isn't clicked.
3232
click: (3, 270)
3333
assert-attribute: (".top-doc", {"open": ""})
34+
35+
// Same check on trait items.
36+
fail-on-request-error: false // To prevent downloads errors on "trait.impl/test_docs/trait.ItemsTrait.js"
37+
go-to: "file://" + |DOC_PATH| + "/test_docs/trait.ItemsTrait.html"
38+
39+
define-function: (
40+
"check-trait-item",
41+
[nth, text],
42+
block {
43+
store-value: (selector, ".methods:nth-of-type(" + |nth| + ") > details summary")
44+
assert-text: (|selector| + " h4", |text|)
45+
assert-position: (
46+
|selector| + "::before",
47+
{"x": 6},
48+
)
49+
},
50+
)
51+
52+
// Assert the position of the toggle on an associated const.
53+
call-function: ("check-trait-item", {"nth": 2, "text": "const X: u32"})
54+
// Assert the position of the toggle on an associated type.
55+
call-function: ("check-trait-item", {"nth": 3, "text": "type F"})
56+
// Assert the position of the toggle on an associated required method.
57+
call-function: ("check-trait-item", {"nth": 4, "text": "fn bar()"})
58+
// Assert the position of the toggle on an associated provided method.
59+
call-function: ("check-trait-item", {"nth": 5, "text": "fn foo()"})

0 commit comments

Comments
 (0)