Selection.AttrOr test

This commit is contained in:
Piotr Kowalczuk
2015-04-17 00:38:27 +02:00
parent 23904f6805
commit c416dcdfae
+8
View File
@@ -14,6 +14,14 @@ func TestAttrExists(t *testing.T) {
}
}
func TestAttrOr(t *testing.T) {
if val := Doc().Find("a").AttrOr("fake-attribute", "alternative"); val != "alternative" {
t.Error("Expected an alternative value for 'fake-attribute' attribute.")
} else {
t.Logf("Value returned for not existing attribute: %v.", val)
}
}
func TestAttrNotExist(t *testing.T) {
if val, ok := Doc().Find("div.row-fluid").Attr("href"); ok {
t.Errorf("Expected no value for the href attribute, got %v.", val)