Skip to content

Commit dd27c4f

Browse files
committed
Migrate theme_dir_overrides_work_correctly to BookTest
1 parent 25b9acc commit dd27c4f

File tree

4 files changed

+14
-18
lines changed

4 files changed

+14
-18
lines changed

tests/rendered_output.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -270,24 +270,6 @@ fn example_book_can_build() {
270270
md.build().unwrap();
271271
}
272272

273-
#[test]
274-
fn theme_dir_overrides_work_correctly() {
275-
let book_dir = dummy_book::new_copy_of_example_book().unwrap();
276-
let book_dir = book_dir.path();
277-
let theme_dir = book_dir.join("theme");
278-
279-
let mut index = mdbook::theme::INDEX.to_vec();
280-
index.extend_from_slice(b"\n<!-- This is a modified index.hbs! -->");
281-
282-
write_file(&theme_dir, "index.hbs", &index).unwrap();
283-
284-
let md = MDBook::load(book_dir).unwrap();
285-
md.build().unwrap();
286-
287-
let built_index = book_dir.join("book").join("index.html");
288-
dummy_book::assert_contains_strings(built_index, &["This is a modified index.hbs!"]);
289-
}
290-
291273
/// Checks formatting of summary names with inline elements.
292274
#[test]
293275
fn summary_with_markdown_formatting() {

tests/testsuite/theme.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,15 @@ fn empty_theme() {
3030
"#]]);
3131
});
3232
}
33+
34+
// Checks overriding index.hbs.
35+
#[test]
36+
fn override_index() {
37+
BookTest::from_dir("theme/override_index").check_file(
38+
"book/index.html",
39+
str![[r#"
40+
This is a modified index.hbs!
41+
42+
"#]],
43+
);
44+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [Intro](index.md)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a modified index.hbs!

0 commit comments

Comments
 (0)