diff --git a/property_test.go b/property_test.go index 38061f0..ee6f821 100644 --- a/property_test.go +++ b/property_test.go @@ -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)