diff --git a/query.go b/query.go index 0f43939..7697ff3 100644 --- a/query.go +++ b/query.go @@ -209,9 +209,10 @@ func Attributes(sel interface{}, attributes *map[string]string, opts ...QueryOpt }, opts...) } -// AttributesAll retrieves the element attributes for every nodes matching the +// AttributesAll retrieves the element attributes for all nodes matching the // selector. -// selector should be ByQueryAll +// +// Note: this should be used with the ByQueryAll selector option. func AttributesAll(sel interface{}, attributes *[]map[string]string, opts ...QueryOption) Action { if attributes == nil { panic("attributes cannot be nil") diff --git a/query_test.go b/query_test.go index aa0b7c1..28a5d15 100644 --- a/query_test.go +++ b/query_test.go @@ -448,14 +448,14 @@ func TestSetAttributes(t *testing.T) { exp map[string]string }{ {`//*[@id="icon-brankas"]`, BySearch, - map[string]string{"data-url": "brankas"}, + map[string]string{"data-url": "brankas"}, map[string]string{ "alt": "Brankas - Easy Money Management", "id": "icon-brankas", "src": "images/brankas.png", "data-url": "brankas"}}, {"body > img:first-child", ByQuery, - map[string]string{"data-url": "brankas"}, + map[string]string{"data-url": "brankas"}, map[string]string{ "alt": "Brankas - Easy Money Management", "id": "icon-brankas", @@ -463,7 +463,7 @@ func TestSetAttributes(t *testing.T) { "data-url": "brankas", }}, {"body > img:nth-child(2)", ByQueryAll, - map[string]string{"width": "100", "height": "200"}, + map[string]string{"width": "100", "height": "200"}, map[string]string{ "alt": `How people build software`, "id": "icon-github", @@ -472,7 +472,7 @@ func TestSetAttributes(t *testing.T) { "height": "200", }}, {"#icon-github", ByID, - map[string]string{"width": "100", "height": "200"}, + map[string]string{"width": "100", "height": "200"}, map[string]string{ "alt": "How people build software", "id": "icon-github",