mirror of
https://github.com/PuerkitoBio/goquery.git
synced 2024-04-21 12:31:36 +00:00
add test to detect a from a call to Text()
This commit is contained in:
@@ -61,3 +61,16 @@ func TestHtml(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNbsp(t *testing.T) {
|
||||
src := `<p>Some text</p>`
|
||||
d, err := NewDocumentFromReader(strings.NewReader(src))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
txt := d.Find("p").Text()
|
||||
ix := strings.Index(txt, "\u00a0")
|
||||
if ix != 4 {
|
||||
t.Errorf("expected a non-breaking space at index 4, got %d", ix)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,8 +492,6 @@ func getChildrenWithSiblingType(parent *html.Node, st siblingType, skipNode *htm
|
||||
// Not a valid node, try again from this one
|
||||
cur = ret
|
||||
}
|
||||
// For Go 1.0 compatibility
|
||||
panic("Unreachable code reached.")
|
||||
}
|
||||
|
||||
for c := iter(nil); c != nil; c = iter(c) {
|
||||
|
||||
Reference in New Issue
Block a user