add new test requesting inside a Selector node
parent
1cf010b5a0
commit
c27ee1640b
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue