Finalize documentation

This commit is contained in:
Martin Angers
2021-06-14 09:06:47 -04:00
parent ee8a7e0a3a
commit b3953ef42a
2 changed files with 26 additions and 10 deletions

View File

@@ -231,6 +231,13 @@ func TestSingle(t *testing.T) {
t.Fatalf("want %q, got %q", "1", text)
}
// Verify semantic equivalence
sel1 := doc.Find("div").First()
sel2 := doc.FindMatcher(Single("div"))
if sel1.Text() != sel2.Text() {
t.Fatalf("want sel1 to equal sel2")
}
// Here, the Single has no effect as the selector is used to filter
// from the existing selection, not to find nodes in the document.
divs := doc.Find("div")