summaryrefslogtreecommitdiff
path: root/html/html_test.go
blob: defdc1002ed48e6cd1b525a6ff65121c0fbe95cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package html

import (
	"testing"

	"github.com/stretchr/testify/require"
	. "github.com/vektah/goparsify"
)

func TestParse(t *testing.T) {
	result, _, err := Parse(`<body>hello <p color="blue">world</p></body>`)
	require.NoError(t, err)
	require.Equal(t, Tag{Name: "body", Attributes: map[string]string{}, Body: []Node{
		"hello ",
		Tag{Name: "p", Attributes: map[string]string{"color": "blue"}, Body: []Node{"world"}},
	}}, result)
}