Fix outer whitespace not being trimmed in type answer

This commit is contained in:
Damien Elmes 2023-01-23 17:18:53 +10:00
parent c8275257ce
commit dc0185720a

View File

@ -107,7 +107,8 @@ fn prepare_expected(expected: &str) -> String {
let without_av = strip_av_tags(expected);
let without_newlines = LINEBREAKS.replace_all(&without_av, " ");
let without_html = strip_html(&without_newlines);
normalize_to_nfc(&without_html).into()
let without_outer_whitespace = without_html.trim();
normalize_to_nfc(without_outer_whitespace).into()
}
fn prepare_provided(provided: &str) -> String {
@ -270,4 +271,9 @@ mod test {
);
ctx.to_tokens();
}
#[test]
fn whitespace_is_trimmed() {
assert_eq!(prepare_expected("<div>foo</div>"), "foo");
}
}