| 1 |
// Basic theme switcher test. |
| 2 |
|
| 3 |
debug: true |
| 4 |
|
| 5 |
go-to: |DOC_PATH| + "all-summary/index.html" |
| 6 |
|
| 7 |
// TODO: Dark mode is automatic, how to check that here? |
| 8 |
assert-css: ("#mdbook-theme-list", {"display": "none"}) |
| 9 |
click: "#mdbook-theme-toggle" |
| 10 |
assert-css: ("#mdbook-theme-list", {"display": "block"}) |
| 11 |
click: "#mdbook-theme-rust" |
| 12 |
assert-attribute: ("html", {"class": "js rust"}) |
| 13 |
// Clicking a theme doesn't dismiss the popup. |
| 14 |
assert-css: ("#mdbook-theme-list", {"display": "block"}) |
| 15 |
assert-local-storage: {"mdbook-theme": "rust"} |
| 16 |
|
| 17 |
// Dismiss via toggle. |
| 18 |
click: "#mdbook-theme-toggle" |
| 19 |
assert-css: ("#mdbook-theme-list", {"display": "none"}) |
| 20 |
|
| 21 |
// Check for dismissal for click outside. |
| 22 |
click: "#mdbook-theme-toggle" |
| 23 |
assert-css: ("#mdbook-theme-list", {"display": "block"}) |
| 24 |
click: "main" |
| 25 |
assert-css: ("#mdbook-theme-list", {"display": "none"}) |
| 26 |
|
| 27 |
// Check for escape. |
| 28 |
click: "#mdbook-theme-toggle" |
| 29 |
assert-css: ("#mdbook-theme-list", {"display": "block"}) |
| 30 |
press-key: 'Escape' |
| 31 |
assert-css: ("#mdbook-theme-list", {"display": "none"}) |
| 32 |
|
| 33 |
// Check for navigation retains theme. |
| 34 |
go-to: "./part-1/chapter-1.html" |
| 35 |
assert-attribute: ("html", {"class": "rust js"}) |