shithub: opossum

ref: 62eb07e1cb10966e0d7e7a001e615ad26c616160
dir: opossum/style/experimental_test.go

View raw version
package style

import (
	"github.com/chris-ramon/douceur/css"
	"testing"
)

func TestBackgroundImageUrl(t *testing.T) {
	suffix := ""
	for _, quote := range []string{"", "'", `"`} {
		url := "/foo.png"
		decl := css.Declaration{
			Value: "url(" + quote + url + quote + ")" + suffix,
		}
		imgUrl, ok := backgroundImageUrl(decl)
		if !ok {
			t.Fatalf("not ok")
		}
		if imgUrl != url {
			t.Fatalf("expected %+v but got %+v", url, imgUrl)
		}
	}
}