|
| 1 | +// This test ensures that the "pocket menus" are working as expected. |
| 2 | +goto: file://|DOC_PATH|/test_docs/index.html |
| 3 | +// First we check that the help menu doesn't exist yet. |
| 4 | +assert-false: "#help-button .popover" |
| 5 | +// Then we display the help menu. |
| 6 | +click: "#help-button" |
| 7 | +assert: "#help-button .popover" |
| 8 | +assert-css: ("#help-button .popover", {"display": "block"}) |
| 9 | + |
| 10 | +// Now we click somewhere else on the page to ensure it is handling the blur event |
| 11 | +// correctly. |
| 12 | +click: ".sidebar" |
| 13 | +assert-css: ("#help-button .popover", {"display": "none"}) |
| 14 | + |
| 15 | +// Now we will check that we cannot have two "pocket menus" displayed at the same time. |
| 16 | +click: "#help-button" |
| 17 | +assert-css: ("#help-button .popover", {"display": "block"}) |
| 18 | +click: "#settings-menu" |
| 19 | +assert-css: ("#help-button .popover", {"display": "none"}) |
| 20 | +assert-css: ("#settings-menu .popover", {"display": "block"}) |
| 21 | + |
| 22 | +// Now the other way. |
| 23 | +click: "#help-button" |
| 24 | +assert-css: ("#help-button .popover", {"display": "block"}) |
| 25 | +assert-css: ("#settings-menu .popover", {"display": "none"}) |
| 26 | + |
| 27 | +// We check the borders color now: |
| 28 | + |
| 29 | +// Ayu theme |
| 30 | +local-storage: { |
| 31 | + "rustdoc-theme": "ayu", |
| 32 | + "rustdoc-use-system-theme": "false", |
| 33 | +} |
| 34 | +reload: |
| 35 | + |
| 36 | +click: "#help-button" |
| 37 | +assert-css: ( |
| 38 | + "#help-button .popover", |
| 39 | + {"display": "block", "border-color": "rgb(92, 103, 115)"}, |
| 40 | +) |
| 41 | +compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-color"]) |
| 42 | +compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"]) |
| 43 | + |
| 44 | +// Dark theme |
| 45 | +local-storage: { |
| 46 | + "rustdoc-theme": "dark", |
| 47 | + "rustdoc-use-system-theme": "false", |
| 48 | +} |
| 49 | +reload: |
| 50 | + |
| 51 | +click: "#help-button" |
| 52 | +assert-css: ( |
| 53 | + "#help-button .popover", |
| 54 | + {"display": "block", "border-color": "rgb(210, 210, 210)"}, |
| 55 | +) |
| 56 | +compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-color"]) |
| 57 | +compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"]) |
| 58 | + |
| 59 | +// Light theme |
| 60 | +local-storage: { |
| 61 | + "rustdoc-theme": "light", |
| 62 | + "rustdoc-use-system-theme": "false", |
| 63 | +} |
| 64 | +reload: |
| 65 | + |
| 66 | +click: "#help-button" |
| 67 | +assert-css: ( |
| 68 | + "#help-button .popover", |
| 69 | + {"display": "block", "border-color": "rgb(221, 221, 221)"}, |
| 70 | +) |
| 71 | +compare-elements-css: ("#help-button .popover", "#help-button .top", ["border-color"]) |
| 72 | +compare-elements-css: ("#help-button .popover", "#help-button .bottom", ["border-color"]) |
0 commit comments