Skip to content

Commit 0e7f0ec

Browse files
GuillaumeGomezsyphar
authored andcommitted
Add gui test for scrollbar presence
1 parent 53f3c33 commit 0e7f0ec

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

gui-tests/topbar-resize.goml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,25 @@ store-value: (window_height, 1000)
44

55
define-function: (
66
"check-topbar",
7-
[width, text_display, search_display, search_max_width],
7+
[width, text_display, search_display],
88
block {
99
set-window-size: (|width|, |window_height|)
1010
wait-for-css: (".nav-container > .container a > .title", {"display": |text_display|})
1111

1212
// We check that there is no horizontal scrollbar (which would be because of docs.rs
1313
// topbar).
1414
assert-window-property: {"innerWidth": |width|}
15+
wait-for-document-property: {"documentElement"."clientWidth": |width|}
1516

16-
assert-css: ("#search-input-nav", {"display": |search_display|, "max-width": |search_max_width|})
1717
assert-size: ("body > .nav-container", {"height": |top_navbar_height|})
1818

1919
// And finally we check that the top navbar height didn't change.
2020
store-size: ("body > .nav-container", {"height": tmp_top_navbar_height})
2121
assert: |tmp_top_navbar_height| == |top_navbar_height|
22+
23+
// Checks that there is no x-axis scrollbar.
24+
// If the scroll width is the same as the viewport width, then all good!
25+
assert-document-property: {"body"."scrollWidth": |width|}
2226
}
2327
)
2428

@@ -33,60 +37,51 @@ define-function: (
3337
"width": 1000,
3438
"text_display": "inline",
3539
"search_display": "block",
36-
"search_max_width": "200px",
3740
})
3841
call-function: ("check-topbar", {
3942
"width": 900,
4043
"text_display": "inline",
4144
"search_display": "block",
42-
"search_max_width": "200px",
4345
})
4446
call-function: ("check-topbar", {
4547
"width": 872,
4648
"text_display": "inline",
4749
"search_display": "block",
48-
"search_max_width": "200px",
4950
})
5051
// From this point, text should not be displayed anymore.
5152
call-function: ("check-topbar", {
5253
"width": 871,
5354
"text_display": "none",
5455
"search_display": "block",
55-
"search_max_width": "200px",
5656
})
5757
call-function: ("check-topbar", {
5858
"width": 768,
5959
"text_display": "none",
6060
"search_display": "block",
61-
"search_max_width": "200px",
6261
})
6362
// From this point, search input should be smaller.
6463
call-function: ("check-topbar", {
6564
"width": 767,
6665
"text_display": "none",
6766
"search_display": "block",
68-
"search_max_width": "150px",
6967
})
7068
call-function: ("check-topbar", {
7169
"width": 568,
7270
"text_display": "none",
7371
"search_display": "block",
74-
"search_max_width": "150px",
7572
})
7673
// From this point, search input should not be displayed anymore.
7774
call-function: ("check-topbar", {
7875
"width": 567,
7976
"text_display": "none",
8077
"search_display": "none",
81-
"search_max_width": "150px",
8278
})
8379
// Even at very small width, we maintain the height of the topbar, but such cases will very likely
8480
// never happen "in real life".
8581
call-function: ("check-topbar", {
86-
"width": 272,
82+
"width": 310,
8783
"text_display": "none",
8884
"search_display": "none",
89-
"search_max_width": "150px",
9085
})
9186
}
9287
)

0 commit comments

Comments
 (0)