add new test requesting inside a Selector node

master
kirbylife 2021-01-30 21:20:00 -06:00
parent 1cf010b5a0
commit c27ee1640b
1 changed files with 14 additions and 0 deletions

View File

@ -43,6 +43,11 @@ fn complex_selectors() {
<li class='item' id='item-2'>2</li>
<li class='item' id='item-3'>3</li>
</ul>
<div>
<a href='#'>non link</a>
<a href='http://localhost'>link</a>
<a href='#'>non link</a>
</div>
</body>
</html>
"
@ -61,4 +66,13 @@ fn complex_selectors() {
assert_eq!(node.attr("class").unwrap(), "item");
assert!(node.attr("id").unwrap().contains(&text));
}
let div = sel.css_once::<Selector>("div").unwrap();
for node in div.css::<Selector>("a").iter() {
if node.attr("href").unwrap() == "#" {
assert_eq!(node.content(), "non link");
} else {
assert_eq!(node.content(), "link");
}
}
}