github.com/golazy/golazy@v0.0.7-0.20221012133820-968fe65a0b65/lazyview/nodes/attr_test.go (about)

     1  package nodes
     2  
     3  import "testing"
     4  
     5  func TestAttrWiteTo(t *testing.T) {
     6  
     7  	test := func(expectation string, key string, value ...string) {
     8  		t.Helper()
     9  		attr := NewAttr(key, value...)
    10  		if attr.String() != expectation {
    11  			t.Errorf("Expected: %q Got %q", expectation, attr.String())
    12  		}
    13  	}
    14  	test("download", "download")
    15  
    16  	test("", "")
    17  
    18  	test("href", "href")
    19  	test("href=\"\"", "href", "")
    20  	test("href=http://google.com", "href", "http://google.com")
    21  	test("style=width:30px", "style", "width:30px")
    22  
    23  }