Skip to content

Commit

Permalink
fix(attribute): treat null like undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed Feb 9, 2021
1 parent 8952388 commit 7465a62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/assertions/attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const attribute = (client, chai, utils, options) =>
elements.map(async element => {
const value = await element.getAttribute(attribute)
values.push(value)
return value !== undefined
return value != null
})
)).filter(Boolean)

Expand Down
6 changes: 3 additions & 3 deletions test/assertions/attribute-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('attribute', () => {

beforeEach(() => {
fakeElement1.getAttribute.withArgs('foo').resolves(elementAttribute)
fakeElement1.getAttribute.withArgs('bar').resolves(undefined)
fakeElement1.getAttribute.withArgs('bar').resolves(null)
fakeClient.$$.withArgs('.some-selector').resolves([fakeElement1])
})

Expand Down Expand Up @@ -168,9 +168,9 @@ describe('attribute', () => {
fakeElement1.getAttribute.resolves(elementAttribute1)
fakeElement2.getAttribute.resolves(elementAttribute2)
fakeElement1.getAttribute.withArgs('foo').resolves(elementAttribute1)
fakeElement1.getAttribute.withArgs('bar').resolves(undefined)
fakeElement1.getAttribute.withArgs('bar').resolves(null)
fakeElement2.getAttribute.withArgs('foo').resolves(elementAttribute2)
fakeElement2.getAttribute.withArgs('bar').resolves(undefined)
fakeElement2.getAttribute.withArgs('bar').resolves(null)
fakeClient.$$.withArgs('.some-selector').resolves([
fakeElement1,
fakeElement2,
Expand Down

0 comments on commit 7465a62

Please sign in to comment.