mdbook/tests/gui/theme.goml
Eric Huss 402d11414c Change all HTML IDs to have a prefix
This changes all HTML IDs so that they have the `mdbook-` prefix. This
should help avoid ID conflicts between internal IDs and IDs from user
content such as section headers.

This is a relatively disruptive change and has a high risk of breaking
something. However, I think I have covered everything, and if anything
is missed, hopefully it will get detected.

I did not change class names since the chance of a collision is much
smaller than with IDs. However, that is something that could be
considered in the future.

Closes https://github.com/rust-lang/mdBook/issues/880
2025-08-19 19:38:22 -07:00

35 lines
1.1 KiB
Text

// Basic theme switcher test.
debug: true
go-to: |DOC_PATH| + "index.html"
// TODO: Dark mode is automatic, how to check that here?
assert-css: ("#mdbook-theme-list", {"display": "none"})
click: "#mdbook-theme-toggle"
assert-css: ("#mdbook-theme-list", {"display": "block"})
click: "#mdbook-theme-rust"
assert-attribute: ("html", {"class": "js rust"})
// Clicking a theme doesn't dismiss the popup.
assert-css: ("#mdbook-theme-list", {"display": "block"})
assert-local-storage: {"mdbook-theme": "rust"}
// Dismiss via toggle.
click: "#mdbook-theme-toggle"
assert-css: ("#mdbook-theme-list", {"display": "none"})
// Check for dismissal for click outside.
click: "#mdbook-theme-toggle"
assert-css: ("#mdbook-theme-list", {"display": "block"})
click: "main"
assert-css: ("#mdbook-theme-list", {"display": "none"})
// Check for escape.
click: "#mdbook-theme-toggle"
assert-css: ("#mdbook-theme-list", {"display": "block"})
press-key: 'Escape'
assert-css: ("#mdbook-theme-list", {"display": "none"})
// Check for navigation retains theme.
go-to: "./rust/rust_codeblock.html"
assert-attribute: ("html", {"class": "rust js"})