Migrate no_index_for_print_html to BookTest
This commit is contained in:
parent
3e22a5cdad
commit
50dfa365c7
3 changed files with 10 additions and 13 deletions
|
|
@ -306,19 +306,6 @@ fn theme_dir_overrides_work_correctly() {
|
|||
dummy_book::assert_contains_strings(built_index, &["This is a modified index.hbs!"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_index_for_print_html() {
|
||||
let temp = DummyBook::new().build().unwrap();
|
||||
let md = MDBook::load(temp.path()).unwrap();
|
||||
md.build().unwrap();
|
||||
|
||||
let print_html = temp.path().join("book/print.html");
|
||||
assert_contains_strings(print_html, &[r##"noindex"##]);
|
||||
|
||||
let index_html = temp.path().join("book/index.html");
|
||||
assert_doesnt_contain_strings(index_html, &[r##"noindex"##]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn redirects_are_emitted_correctly() {
|
||||
let temp = DummyBook::new().build().unwrap();
|
||||
|
|
|
|||
|
|
@ -21,3 +21,12 @@ both the print page and the non-print page.</p>
|
|||
<h2 id="some-section"><a class="header" href="#some-section">Some section</a></h2>
|
||||
"##]]);
|
||||
}
|
||||
|
||||
// Checks that print.html is noindex.
|
||||
#[test]
|
||||
fn noindex() {
|
||||
let robots = r#"<meta name="robots" content="noindex">"#;
|
||||
BookTest::from_dir("print/noindex")
|
||||
.check_file_contains("book/print.html", robots)
|
||||
.check_file_doesnt_contain("book/index.html", robots);
|
||||
}
|
||||
|
|
|
|||
1
tests/testsuite/print/noindex/src/SUMMARY.md
Normal file
1
tests/testsuite/print/noindex/src/SUMMARY.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
- [Intro](index.md)
|
||||
Loading…
Add table
Reference in a new issue