test(examples): assert escaped text exactly
Make v0 and kanban DOM-aware escaped-text checks exact instead of substring-based while preserving the no-rendered-tag assertions. req: html_safety/002 req: test/005
This commit is contained in:
@@ -355,7 +355,8 @@ mod tests {
|
|||||||
.select(&selector("article.card[data-key=\"1\"]"))
|
.select(&selector("article.card[data-key=\"1\"]"))
|
||||||
.next()
|
.next()
|
||||||
.expect("card renders");
|
.expect("card renders");
|
||||||
assert!(card.text().collect::<String>().contains("<b>Compile checked</b>"));
|
let title = card.select(&selector("strong")).next().expect("card title renders");
|
||||||
|
assert_eq!(title.text().collect::<String>(), "<b>Compile checked</b>");
|
||||||
assert!(card.select(&selector("b")).next().is_none());
|
assert!(card.select(&selector("b")).next().is_none());
|
||||||
assert_eq!(card.select(&selector("button[disabled]")).count(), 1);
|
assert_eq!(card.select(&selector("button[disabled]")).count(), 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ mod tests {
|
|||||||
let rows = document.select(&selector("li[data-key]")).collect::<Vec<_>>();
|
let rows = document.select(&selector("li[data-key]")).collect::<Vec<_>>();
|
||||||
assert_eq!(rows.len(), 1);
|
assert_eq!(rows.len(), 1);
|
||||||
assert_eq!(rows[0].value().attr("data-key"), Some("7"));
|
assert_eq!(rows[0].value().attr("data-key"), Some("7"));
|
||||||
assert!(rows[0].text().collect::<String>().contains("<b>Ship v0</b>"));
|
assert_eq!(rows[0].text().collect::<String>(), "<b>Ship v0</b>");
|
||||||
assert!(document.select(&selector("b")).next().is_none());
|
assert!(document.select(&selector("b")).next().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user