Migrate theme_dir_overrides_work_correctly to BookTest
This commit is contained in:
parent
25b9acc321
commit
dd27c4f8ba
4 changed files with 14 additions and 18 deletions
|
|
@ -270,24 +270,6 @@ fn example_book_can_build() {
|
||||||
md.build().unwrap();
|
md.build().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn theme_dir_overrides_work_correctly() {
|
|
||||||
let book_dir = dummy_book::new_copy_of_example_book().unwrap();
|
|
||||||
let book_dir = book_dir.path();
|
|
||||||
let theme_dir = book_dir.join("theme");
|
|
||||||
|
|
||||||
let mut index = mdbook::theme::INDEX.to_vec();
|
|
||||||
index.extend_from_slice(b"\n<!-- This is a modified index.hbs! -->");
|
|
||||||
|
|
||||||
write_file(&theme_dir, "index.hbs", &index).unwrap();
|
|
||||||
|
|
||||||
let md = MDBook::load(book_dir).unwrap();
|
|
||||||
md.build().unwrap();
|
|
||||||
|
|
||||||
let built_index = book_dir.join("book").join("index.html");
|
|
||||||
dummy_book::assert_contains_strings(built_index, &["This is a modified index.hbs!"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Checks formatting of summary names with inline elements.
|
/// Checks formatting of summary names with inline elements.
|
||||||
#[test]
|
#[test]
|
||||||
fn summary_with_markdown_formatting() {
|
fn summary_with_markdown_formatting() {
|
||||||
|
|
|
||||||
|
|
@ -30,3 +30,15 @@ fn empty_theme() {
|
||||||
"#]]);
|
"#]]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks overriding index.hbs.
|
||||||
|
#[test]
|
||||||
|
fn override_index() {
|
||||||
|
BookTest::from_dir("theme/override_index").check_file(
|
||||||
|
"book/index.html",
|
||||||
|
str![[r#"
|
||||||
|
This is a modified index.hbs!
|
||||||
|
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
1
tests/testsuite/theme/override_index/src/SUMMARY.md
Normal file
1
tests/testsuite/theme/override_index/src/SUMMARY.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
- [Intro](index.md)
|
||||||
1
tests/testsuite/theme/override_index/theme/index.hbs
Normal file
1
tests/testsuite/theme/override_index/theme/index.hbs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
This is a modified index.hbs!
|
||||||
Loading…
Add table
Reference in a new issue