mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-20 06:01:12 -06:00
Issue 831 (#1480)
* Check actual is not null or undefined rather than a falsy value This fixes an issue when checking if actual was an empty string * Add test to check empty string attributes are handled as expected
This commit is contained in:
committed by
Brian Mann
parent
ba73e1cc5d
commit
ae794d1f8c
@@ -224,7 +224,7 @@ $chaiJquery = (chai, chaiUtils, callbacks = {}) ->
|
||||
assert(
|
||||
@,
|
||||
attr,
|
||||
actual and actual is val,
|
||||
actual? and actual is val,
|
||||
message,
|
||||
negatedMessage,
|
||||
val,
|
||||
|
||||
@@ -657,6 +657,18 @@ describe "src/cy/commands/assertions", ->
|
||||
cy.get("body").then ($body) ->
|
||||
expect($body).to.exist
|
||||
|
||||
it "matches empty string attributes", (done) ->
|
||||
cy.on "log:added", (attrs, log) =>
|
||||
if attrs.name is "assert"
|
||||
cy.removeAllListeners("log:added")
|
||||
|
||||
expect(log.get("message")).to.eq "expected **<input>** to have attribute **value** with the value **''**"
|
||||
done()
|
||||
|
||||
cy.$$("body").prepend $("<input value='' />")
|
||||
cy.get("input").eq(0).then ($input) ->
|
||||
expect($input).to.have.attr('value', '')
|
||||
|
||||
describe "without selector", ->
|
||||
it "exists", (done) ->
|
||||
cy.on "log:added", (attrs, log) =>
|
||||
|
||||
Reference in New Issue
Block a user