Migrate rendered_code_does_not_have_playground_stuff_in_html_when_disabled_in_config to BookTest
This commit is contained in:
parent
20d42a53d3
commit
aa29ef04a2
5 changed files with 25 additions and 19 deletions
|
|
@ -93,25 +93,6 @@ fn check_correct_relative_links_in_print_page() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rendered_code_does_not_have_playground_stuff_in_html_when_disabled_in_config() {
|
||||
let temp = DummyBook::new().build().unwrap();
|
||||
let config = Config::from_str(
|
||||
"
|
||||
[output.html.playground]
|
||||
runnable = false
|
||||
",
|
||||
)
|
||||
.unwrap();
|
||||
let md = MDBook::load_with_config(temp.path(), config).unwrap();
|
||||
md.build().unwrap();
|
||||
|
||||
let nested = temp.path().join("book/first/nested.html");
|
||||
let playground_class = vec![r#"class="playground""#];
|
||||
|
||||
assert_doesnt_contain_strings(nested, &playground_class);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn chapter_content_appears_in_rendered_document() {
|
||||
let content = vec![
|
||||
|
|
|
|||
|
|
@ -16,3 +16,15 @@ fn playground_on_rust_code() {
|
|||
"##]],
|
||||
);
|
||||
}
|
||||
|
||||
// When the playground is disabled, there should be no playground class.
|
||||
#[test]
|
||||
fn disabled_playground() {
|
||||
BookTest::from_dir("playground/disabled_playground").check_main_file(
|
||||
"book/index.html",
|
||||
str![[r##"
|
||||
<h1 id="rust-sample"><a class="header" href="#rust-sample">Rust Sample</a></h1>
|
||||
<pre><code class="language-rust">let x = 1;</code></pre>
|
||||
"##]],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
5
tests/testsuite/playground/disabled_playground/book.toml
Normal file
5
tests/testsuite/playground/disabled_playground/book.toml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[book]
|
||||
title = "playground_on_rust_code"
|
||||
|
||||
[output.html.playground]
|
||||
runnable = false
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Summary
|
||||
|
||||
- [Rust Playground](./index.md)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# Rust Sample
|
||||
|
||||
```rust
|
||||
let x = 1;
|
||||
```
|
||||
Loading…
Add table
Reference in a new issue