|
| 1 | +// Checks that the topbar is correctly displayed, whatever the screen width. |
| 2 | + |
| 3 | +store-value: (window_height, 1000) |
| 4 | + |
| 5 | +define-function: ( |
| 6 | + "check-topbar", |
| 7 | + (width, text_display, search_display, search_max_width), |
| 8 | + block { |
| 9 | + set-window-size: (|width|, |window_height|) |
| 10 | + wait-for-css: (".nav-container > .container a > .title", {"display": |text_display|}) |
| 11 | + assert-css: ("#search-input-nav", {"display": |search_display|, "max-width": |search_max_width|}) |
| 12 | + assert-size: ("body > .nav-container", {"height": |top_navbar_height|}) |
| 13 | + |
| 14 | + // And finally we check that the top navbar height didn't change. |
| 15 | + store-size: ("body > .nav-container", {"height": tmp_top_navbar_height}) |
| 16 | + assert: |tmp_top_navbar_height| == |top_navbar_height| |
| 17 | + } |
| 18 | +) |
| 19 | + |
| 20 | +go-to: |DOC_PATH| + "/sysinfo" |
| 21 | + |
| 22 | +set-window-size: (1100, |window_height|) |
| 23 | +store-size: ("body > .nav-container", {"height": top_navbar_height}) |
| 24 | + |
| 25 | +call-function: ("check-topbar", { |
| 26 | + "width": 1000, |
| 27 | + "text_display": "inline", |
| 28 | + "search_display": "block", |
| 29 | + "search_max_width": "200px", |
| 30 | +}) |
| 31 | +call-function: ("check-topbar", { |
| 32 | + "width": 900, |
| 33 | + "text_display": "inline", |
| 34 | + "search_display": "block", |
| 35 | + "search_max_width": "200px", |
| 36 | +}) |
| 37 | +call-function: ("check-topbar", { |
| 38 | + "width": 872, |
| 39 | + "text_display": "inline", |
| 40 | + "search_display": "block", |
| 41 | + "search_max_width": "200px", |
| 42 | +}) |
| 43 | +// From this point, text should not be displayed anymore. |
| 44 | +call-function: ("check-topbar", { |
| 45 | + "width": 871, |
| 46 | + "text_display": "none", |
| 47 | + "search_display": "block", |
| 48 | + "search_max_width": "200px", |
| 49 | +}) |
| 50 | +call-function: ("check-topbar", { |
| 51 | + "width": 768, |
| 52 | + "text_display": "none", |
| 53 | + "search_display": "block", |
| 54 | + "search_max_width": "200px", |
| 55 | +}) |
| 56 | +// From this point, search input should be smaller. |
| 57 | +call-function: ("check-topbar", { |
| 58 | + "width": 767, |
| 59 | + "text_display": "none", |
| 60 | + "search_display": "block", |
| 61 | + "search_max_width": "150px", |
| 62 | +}) |
| 63 | +call-function: ("check-topbar", { |
| 64 | + "width": 568, |
| 65 | + "text_display": "none", |
| 66 | + "search_display": "block", |
| 67 | + "search_max_width": "150px", |
| 68 | +}) |
| 69 | +// From this point, search input should not be displayed anymore. |
| 70 | +call-function: ("check-topbar", { |
| 71 | + "width": 567, |
| 72 | + "text_display": "none", |
| 73 | + "search_display": "none", |
| 74 | + "search_max_width": "150px", |
| 75 | +}) |
| 76 | +// Even at very small width, we maintain the height of the topbar, but such cases will very likely |
| 77 | +// never happen "in real life". |
| 78 | +call-function: ("check-topbar", { |
| 79 | + "width": 272, |
| 80 | + "text_display": "none", |
| 81 | + "search_display": "none", |
| 82 | + "search_max_width": "150px", |
| 83 | +}) |
0 commit comments