Skip to content

Commit 2581fe6

Browse files
Unify crate pages style
1 parent a4356de commit 2581fe6

2 files changed

Lines changed: 32 additions & 4 deletions

File tree

crates/bin/docs_rs_web/templates/crate/builds.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
<link rel="canonical" href="{{ canonical_url|safe }}" />
1010
{%- endblock -%}
1111

12-
{%- block body_classes -%}
13-
centered
14-
{%- endblock body_classes -%}
15-
1612
{%- block topbar -%}
1713
{%- include "rustdoc/topbar.html" -%}
1814
{%- endblock topbar -%}

gui-tests/crate-pages.goml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Checks that the "crate pages" have all the same style (ie: not centered).
2+
go-to: |DOC_PATH| + "/crate/sysinfo"
3+
4+
store-value: (tabs_menu_selector, ".description-container .pure-menu-horizontal ul.pure-menu-list")
5+
store-value: (current_tab, 1)
6+
7+
define-function: (
8+
"check-tab",
9+
[tab_name, click_next],
10+
block {
11+
// We check the tab's name is the one expected.
12+
assert-text: (|tabs_menu_selector| + " > li a.pure-menu-active .title", |tab_name|)
13+
// We check it also matches the one we clicked.
14+
assert: |tabs_menu_selector| + " > li:nth-of-type(" + |current_tab| + ") a.pure-menu-active"
15+
// We ensure that the content of the page is not centered.
16+
assert: "body:not(.centered)"
17+
assert-css: ("div.container", {"margin": "0px"})
18+
if: (|click_next|, block {
19+
store-value: (current_tab, |current_tab| + 1)
20+
click: |tabs_menu_selector| + " > li:nth-of-type(" + |current_tab| + ")"
21+
})
22+
}
23+
)
24+
25+
// If this assert fails, it means we added new entries for this menu so this test needs to be
26+
// updated.
27+
assert-count: (|tabs_menu_selector| + " > li", 4)
28+
29+
call-function: ("check-tab", {"tab_name": " Crate", "click_next": true})
30+
call-function: ("check-tab", {"tab_name": " Source", "click_next": true})
31+
call-function: ("check-tab", {"tab_name": " Builds", "click_next": true})
32+
call-function: ("check-tab", {"tab_name": "Feature flags", "click_next": false})

0 commit comments

Comments
 (0)