add tests for End() rollbacks, doc

This commit is contained in:
Martin Angers
2012-09-05 09:35:53 -04:00
parent 3aaca8f8ea
commit 2d885ccd3a
11 changed files with 169 additions and 47 deletions

View File

@@ -14,6 +14,12 @@ func TestFirstEmpty(t *testing.T) {
Doc().Root.Find(".pvk-zzcontentzz").First()
}
func TestFirstRollback(t *testing.T) {
sel := Doc().Root.Find(".pvk-content")
sel2 := sel.First().End()
AssertEqual(t, sel, sel2)
}
func TestLast(t *testing.T) {
sel := Doc().Root.Find(".pvk-content").Last()
AssertLength(t, sel.Nodes, 1)
@@ -25,6 +31,12 @@ func TestLast(t *testing.T) {
}
}
func TestLastRollback(t *testing.T) {
sel := Doc().Root.Find(".pvk-content")
sel2 := sel.Last().End()
AssertEqual(t, sel, sel2)
}
func TestEq(t *testing.T) {
sel := Doc().Root.Find(".pvk-content").Eq(1)
AssertLength(t, sel.Nodes, 1)
@@ -41,6 +53,12 @@ func TestEqNegative(t *testing.T) {
}
}
func TestEqRollback(t *testing.T) {
sel := Doc().Root.Find(".pvk-content")
sel2 := sel.Eq(1).End()
AssertEqual(t, sel, sel2)
}
func TestSlice(t *testing.T) {
sel := Doc().Root.Find(".pvk-content").Slice(0, 2)
@@ -52,6 +70,12 @@ func TestSliceOutOfBounds(t *testing.T) {
Doc().Root.Find(".pvk-content").Slice(2, 12)
}
func TestSliceRollback(t *testing.T) {
sel := Doc().Root.Find(".pvk-content")
sel2 := sel.Slice(0, 2).End()
AssertEqual(t, sel, sel2)
}
func TestGet(t *testing.T) {
sel := Doc().Root.Find(".pvk-content")
node := sel.Get(1)