add ParentsUntil...() with tests

This commit is contained in:
Martin Angers
2012-09-04 10:39:59 -04:00
parent cfa964cff5
commit d03482bacd
2 changed files with 64 additions and 14 deletions

View File

@@ -74,3 +74,22 @@ func TestParentsFiltered(t *testing.T) {
sel := Doc().Root.Find(".container-fluid").ParentsFiltered("body")
AssertLength(t, sel.Nodes, 1)
}
func TestParentsUntil(t *testing.T) {
sel := Doc().Root.Find(".container-fluid").ParentsUntil("body")
AssertLength(t, sel.Nodes, 6)
}
func TestParentsUntilSelection(t *testing.T) {
sel := Doc().Root.Find(".container-fluid")
sel2 := Doc().Root.Find(".pvk-content")
sel = sel.ParentsUntilSelection(sel2)
AssertLength(t, sel.Nodes, 3)
}
func TestParentsUntilNodes(t *testing.T) {
sel := Doc().Root.Find(".container-fluid")
sel2 := Doc().Root.Find(".pvk-content, .hero-unit")
sel = sel.ParentsUntilNodes(sel2.Nodes...)
AssertLength(t, sel.Nodes, 2)
}