Skip to content

Commit

Permalink
fix: rename query selctor helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
crhntr committed May 14, 2024
1 parent daa56ae commit 14d666f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions domtest/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type ElementAssertion struct {
element spec.Element
}

func QuerySelect(t T, parent spec.ElementQueries, query string) ElementAssertion {
func QuerySelector(t T, parent spec.ElementQueries, query string) ElementAssertion {
t.Helper()
element := parent.QuerySelector(query)
require.NotNil(t, element)
Expand Down Expand Up @@ -54,7 +54,7 @@ type ElementNodeListAssertions struct {
list spec.NodeList[spec.Element]
}

func QuerySelectAll(t T, parent spec.ElementQueries, query string) ElementNodeListAssertions {
func QuerySelectorAll(t T, parent spec.ElementQueries, query string) ElementNodeListAssertions {
t.Helper()
list := parent.QuerySelectorAll(query)
require.NotZero(t, list.Length())
Expand Down
12 changes: 6 additions & 6 deletions domtest/assert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestQuerySelect(t *testing.T) {
tst := new(fakes.T)
document := domtest.String(t, documentText)

domtest.QuerySelect(tst, document, `head title`).
domtest.QuerySelector(tst, document, `head title`).
TextContentEquals(tst, "Test Data")

assert.Zero(t, tst.FailNowCallCount())
Expand All @@ -50,7 +50,7 @@ func TestQuerySelect(t *testing.T) {
tst := new(fakes.T)
document := domtest.String(t, documentText)

domtest.QuerySelect(tst, document, `body p`).
domtest.QuerySelector(tst, document, `body p`).
TextContentEquals(tst, "Hello, world!").
HasAttributeValue(tst, "id", "greeting")

Expand All @@ -61,7 +61,7 @@ func TestQuerySelect(t *testing.T) {
tst := new(fakes.T)
document := domtest.String(t, documentText)

domtest.QuerySelectAll(tst, document, `body ul li`).
domtest.QuerySelectorAll(tst, document, `body ul li`).
LengthEquals(tst, 3).
HasAttribute(tst, "data-index").
HasAttributeValue(tst, "data-selected", "false").
Expand All @@ -74,7 +74,7 @@ func TestQuerySelect(t *testing.T) {
tst := new(fakes.T)
document := domtest.String(t, documentText)

domtest.QuerySelectAll(tst, document, `#texts>div`).
domtest.QuerySelectorAll(tst, document, `#texts>div`).
LengthEquals(tst, 4).
TextContentEquals(tst, "text")

Expand All @@ -85,7 +85,7 @@ func TestQuerySelect(t *testing.T) {
tst := new(fakes.T)
document := domtest.String(t, documentText)

domtest.QuerySelectAll(tst, document, `#texts>div`).
domtest.QuerySelectorAll(tst, document, `#texts>div`).
LengthEquals(tst, 10000)

assert.Equal(t, 1, tst.FailNowCallCount())
Expand All @@ -95,7 +95,7 @@ func TestQuerySelect(t *testing.T) {
tst := new(fakes.T)
document := domtest.String(t, documentText)

domtest.QuerySelectAll(tst, document, `[data-index]`).
domtest.QuerySelectorAll(tst, document, `[data-index]`).
HasAttributeValues(tst, map[string]string{
"data-selected": "false",
"class": "happy-item",
Expand Down

0 comments on commit 14d666f

Please sign in to comment.