.Find("#foot #nf6").Nodes, 0) assertLength(t, doc.Find("body > #nf6:first-child").Nodes, 1) printSel(t, doc.Selection) } func TestBeforeWithRemoved(t *testing.T) { doc := Doc2Clone() s := doc.Find("#main").Remove() s.Before("#nf6") assertLength(t, s.Find("#nf6").Nodes, 0) assertLength(t, doc.Find("#nf6").Nodes, 0) printSel(t, doc.Selection) } func TestBeforeSelection(t *testing.T) { doc := Doc2Clone() doc.Find("#main").BeforeSelection(doc.Find("#nf1, #nf2")) assertLength(t, doc.Find("#main #nf1, #main #nf2").Nodes, 0) assertLength(t, doc.Find("#foot #nf1, #foot #nf2").Nodes, 0) assertLength(t, doc.Find("body > #nf1:first-child, #nf1 + #nf2").Nodes, 2) printSel(t, doc.Selection) } func TestBeforeHtml(t *testing.T) { doc := Doc2Clone() doc.Find("#main").BeforeHtml("new node") assertLength(t, doc.Find("body > strong:first-child").Nodes, 1) printSel(t, doc.Selection) } func TestBeforeHtmlContext(t *testing.T) { doc := loadString(t, `
| Before1 |
| Before2 |