jasmine-jquery icon indicating copy to clipboard operation
jasmine-jquery copied to clipboard

Improved error messages for toHaveAttr, will address issue # 184

Open jesperronn opened this issue 10 years ago • 4 comments

...use of failure.

Different error messages if

  • element not found
  • attribute not found
  • incorrect attribute value

See issue #184

jesperronn avatar Mar 20 '14 21:03 jesperronn

Please let me know if this is the way we want to present error messages, and I can modify some more matchers.

In my opinion, it makes it much easier -- and faster -- to find errors.

One caveat: I don't know how I can actually write tests that verify text displayed when failures. Can somebody help out?

(I added tests in the bottom in and xdescribe() block so that the build wouldn't fail

jesperronn avatar Mar 20 '14 21:03 jesperronn

@RLovelett, I think your suggestion is great :) +1

jesperronn avatar Mar 30 '14 21:03 jesperronn

this looks fine to me, but i think all the relevant matchers should be consistent. do you mind updating them all to be the same? also i wouldn't worry about testing what message is shown since it won't really help much imo.

travisjeffery avatar Feb 07 '15 10:02 travisjeffery

@travisjeffery Totally agree that mactchers should behave consistently, and therefore all matchers should be fixed. Also, I may want more eyes on the nature of my suggested fix in this pull-request. For my taste, it's a lot of code and if statements.

Perhaps somebody has suggestions to make it leaner and prettier?

jesperronn avatar Feb 07 '15 13:02 jesperronn