Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/mdbook-html/front-end/css/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@
--searchresults-li-bg: #dec2a2;
--search-mark-bg: #e69f67;

--color-scheme: light;

/* Same as `--icons` */
--copy-button-filter: invert(51%) sepia(10%) saturate(393%) hue-rotate(198deg) brightness(86%) contrast(87%);
/* Same as `--sidebar-active` */
Expand Down
1 change: 1 addition & 0 deletions tests/gui/books/basic/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Summary

- [Chapter 1](./chapter_1.md)
- [Chapter 2](./chapter_2.md)
10 changes: 10 additions & 0 deletions tests/gui/books/basic/src/chapter_2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<style>
main {
background-color: light-dark(white, black);
color: light-dark(black, white);
}
</style>

# title

Some content
39 changes: 39 additions & 0 deletions tests/gui/color-scheme.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// This GUI test checks help popup.

go-to: |DOC_PATH| + "basic/chapter_2.html"

define-function: (
"change-theme",
[theme],
block {
store-css: ("#mdbook-theme-list", {"display": theme_list_display})
if: (|theme_list_display| != "block", block {
click: "#mdbook-theme-toggle"
wait-for-css: ("#mdbook-theme-list", {"display": "block"})
})
click: "#mdbook-theme-list #mdbook-theme-" + |theme|
wait-for: "#mdbook-theme-list #mdbook-theme-" + |theme| + ".theme-selected"
},
)

define-function: (
"check-scheme-applied",
[theme, background_color],
block {
call-function: ("change-theme", {"theme": |theme|})
assert-css: ("#mdbook-content main", {"background-color": |background_color|})
store-value: (themes_checked, |themes_checked| + 1)
}
)

store-value: (themes_checked, 1) // It's one to take into account the "auto" theme.

call-function: ("check-scheme-applied", {"theme": "light", "background_color": "white"})
call-function: ("check-scheme-applied", {"theme": "rust", "background_color": "white"})
call-function: ("check-scheme-applied", {"theme": "coal", "background_color": "black"})
call-function: ("check-scheme-applied", {"theme": "navy", "background_color": "black"})
call-function: ("check-scheme-applied", {"theme": "ayu", "background_color": "black"})

// We confirm that the we checked all themes. If other themes are added later on, this test will
// fail.
assert-count: ("#mdbook-theme-list .theme", |themes_checked|)
2 changes: 1 addition & 1 deletion tests/gui/help.goml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ wait-for-css: ("#mdbook-help-container", {"display": "flex"})
click: "#mdbook-help-popup"
wait-for-css: ("#mdbook-help-container", {"display": "flex"})
// Click outside dismisses.
click: "*"
click: (0, 0)
wait-for-css: ("#mdbook-help-container", {"display": "none"})
Loading