Add test for HTML tags in titles.

This commit is contained in:
tastytea 2021-05-26 08:53:48 +02:00
parent 785fba691f
commit 9c307ab0fd
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 22 additions and 0 deletions

View File

@ -106,6 +106,28 @@ SCENARIO("Searching helpers work as intended")
REQUIRE(text == "Soup");
}
}
WHEN("There is a <span> in the h2 headline")
{
text = "… <h2>The <span class=\"long\">long</span> "
"road to nowhere</h2> …";
try
{
epubgrep::search::cleanup_text(text);
text = epubgrep::search::headline(text);
}
catch (const std::exception &)
{
exception = true;
}
THEN("No exception is thrown")
AND_THEN("The headline is correctly extracted")
{
REQUIRE_FALSE(exception);
REQUIRE(text == "The long road to nowhere");
}
}
}
SECTION("page() does what it should do")