jasmine-jquery
jasmine-jquery copied to clipboard
Improved error messages for toHaveAttr, will address issue # 184
...use of failure.
Different error messages if
- element not found
- attribute not found
- incorrect attribute value
See issue #184
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
@RLovelett, I think your suggestion is great :) +1
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 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?