Skip to content

Commit 7e5fa35

Browse files
committed
Add a fontawesome test for a missing icon
This is a test for when an icon is missing.
1 parent 6d9f49c commit 7e5fa35

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

tests/testsuite/rendering.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,16 @@ fn first_chapter_is_copied_as_index_even_if_not_first_elem() {
4747
// Fontawesome `<i>` tag support.
4848
#[test]
4949
fn fontawesome() {
50-
BookTest::from_dir("rendering/fontawesome").check_all_main_files();
50+
BookTest::from_dir("rendering/fontawesome")
51+
.run("build", |cmd| {
52+
cmd.expect_stderr(str![[r#"
53+
INFO Book building has started
54+
INFO Running the html backend
55+
INFO HTML book written to `[ROOT]/book`
56+
57+
"#]]);
58+
})
59+
.check_all_main_files();
5160
}
5261

5362
// Tests the rendering when setting the default rust edition.

tests/testsuite/rendering/fontawesome/expected/fa.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ <h1 id="chapter-1"><a class="header" href="#chapter-1">Chapter 1</a></h1>
22
<p><span class="fa-svg extra-class" id="example1"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M47.6 300.4L228.3 469.1c7.5 7 17.4 10.9 27.7 10.9s20.2-3.9 27.7-10.9L464.4 300.4c30.4-28.3 47.6-68 47.6-109.5v-5.8c0-69.9-50.5-129.5-119.4-141C347 36.5 300.6 51.4 268 84L256 96 244 84c-32.6-32.6-79-47.5-124.6-39.9C50.5 55.6 0 115.2 0 185.1v5.8c0 41.5 17.2 81.2 47.6 109.5z"/></svg></span></p>
33
<p><span class="fa-svg"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M272 304h-96C78.8 304 0 382.8 0 480c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32C448 382.8 369.2 304 272 304zM48.99 464C56.89 400.9 110.8 352 176 352h96c65.16 0 119.1 48.95 127 112H48.99zM224 256c70.69 0 128-57.31 128-128c0-70.69-57.31-128-128-128S96 57.31 96 128C96 198.7 153.3 256 224 256zM224 48c44.11 0 80 35.89 80 80c0 44.11-35.89 80-80 80S144 172.1 144 128C144 83.89 179.9 48 224 48z"/></svg></span></p>
44
<p><span class="fa-svg"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M448 48V384C385 407 366 416 329 416C266 416 242 384 179 384C159 384 143 388 128 392V328C143 324 159 320 179 320C242 320 266 352 329 352C349 352 364 349 384 343V135C364 141 349 144 329 144C266 144 242 112 179 112C128 112 104 133 64 141V448C64 466 50 480 32 480S0 466 0 448V64C0 46 14 32 32 32S64 46 64 64V77C104 69 128 48 179 48C242 48 266 80 329 80C366 80 385 71 448 48Z"/></svg></span></p>
5-
<p><i class="fas fa-heart">Text prevents translation.</i></p>
5+
<p><i class="fas fa-heart">Text prevents translation.</i></p>
6+
<p><i class="fa fa-does-not-exist"></i></p>

tests/testsuite/rendering/fontawesome/src/fa.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
<i class="fab fa-font-awesome"></i>
88

99
<i class="fas fa-heart">Text prevents translation.</i>
10+
11+
<i class="fa fa-does-not-exist"></i>

0 commit comments

Comments
 (0)