Skip to content

jest-dom/prefer-empty wrong detection, and wrong fix. #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RIP21 opened this issue Jul 6, 2020 · 11 comments · Fixed by #63
Closed

jest-dom/prefer-empty wrong detection, and wrong fix. #61

RIP21 opened this issue Jul 6, 2020 · 11 comments · Fixed by #63
Assignees
Labels
bug Something isn't working released

Comments

@RIP21
Copy link

RIP21 commented Jul 6, 2020

  • eslint-plugin-jest-dom version: 3.0.1
  • node version: 12.16.1
  • npm version: 6.13.4

Broken fix and detection
This is detected as error

const DONT_KNOW_TEXT = "Don't know"
expect(textarea.innerHTML).toBe(DONT_KNOW_TEXT)

Fixes to

expect(textarea).toBeEmpty()
@nickserv nickserv added the bug Something isn't working label Jul 7, 2020
@benmonro benmonro self-assigned this Jul 9, 2020
@benmonro
Copy link
Member

benmonro commented Jul 9, 2020

🎉 This issue has been resolved in version 3.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@benmonro
Copy link
Member

@all-contributors please add @RIP21 for bugs

@allcontributors
Copy link
Contributor

@benmonro

I've put up a pull request to add @RIP21! 🎉

@benmonro
Copy link
Member

benmonro commented Jul 12, 2020

@RIP21 I believe all of the issues you reported should be fixed now. Mind confirming in the latest release? Much appreciation for the issues you reported and all the great examples, I was able to use them for the tests...

@RIP21
Copy link
Author

RIP21 commented Jul 12, 2020

@benmonro awesome. Thank you very much! You're legend :) I'll update on Monday and see how it goes :)

@atsikov
Copy link

atsikov commented Aug 5, 2020

@benmonro I'm afraid this is not fully fixed. Template strings are not properly handled.

expect(statusText.innerHTML).toBe(`${value}%`)

Still pops up as an error

@benmonro
Copy link
Member

benmonro commented Aug 5, 2020

@atsikov thank you for reporting, I hadn't considered that use case. will have a fix published shortly

@benmonro
Copy link
Member

benmonro commented Aug 5, 2020

@atsikov fix released in 3.1.6 can you please update and let me know if it fixes your issue and/or any other issues I may have missed? many thanks -Ben

@atsikov
Copy link

atsikov commented Aug 5, 2020

Wow @benmonro that was fast! 🚀
Thanks a lot, templates with params are now treated as non-empty values.

However it still shows an error in case template doesn't have params.
Sure it's not a common case, but probably worth fixing as well.

expect(statusText.innerHTML).toBe(`Complete`) // note backticks

@benmonro
Copy link
Member

benmonro commented Aug 5, 2020

ah yeah ok that actually might take a bit more work, will have to look at that tonight, as a work around you can use ' or " for now.

@benmonro
Copy link
Member

benmonro commented Aug 9, 2020

@atsikov sorry for the delay, 3.1.7 should address your issue, but please do let me know if you find another!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants