INNER CODE UNIT · Go
TestCollapse_EmptyTextNode
JohannesKaufmann/html-to-markdown · collapse/collapse_test.go:111
func TestCollapse_EmptyTextNode(t *testing.T) {
bodyNode := &html.Node{
Type: html.ElementNode,
Data: "body",
}
emptyText := &html.Node{
Type: html.TextNode,
// An empty text node. This shouldn't happen normally
// by the native `html.Parse` but could happen when
// other libraries (like `go-trafilatura`) manipulate the dom.
Data: "",
}
spanNode := &html.Node{
Type: html.ElementNode,
Data: "span",
}
helloText := &html.Node{
Type: html.TextNode,