Skip to content

Add toBeEnabled matcher #78

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

Merged
merged 7 commits into from
Feb 10, 2019
Merged

Add toBeEnabled matcher #78

merged 7 commits into from
Feb 10, 2019

Conversation

lourenci
Copy link
Contributor

@lourenci lourenci commented Feb 7, 2019

What:

Add toBeEnabled matcher to the library. This PR closes #76.

Why:

It feels more natural to write the specs. Most of us don't like to double negation tests.

How:

I just "negated" the toBeDisabled matcher, including the spec file. To aim that, I extracted the logic to the utils file.

I don't know if that is the better approach to aim that, I don't even know if the utils.js is the better file to contain some "shared" logic to be shared between matcher files. So, it would be good that someone take some time to review that.

Checklist:

  • Documentation
  • Tests
  • Updated Type Definitions
  • Ready to be merged
  • Added myself to contributors table

Copy link
Member

@gnapse gnapse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer if you keep all the to-be-disabled.js file as it was, and added the new toBeEnabled to it, then export both from the same file. I know it kinda breaks this pattern where each matcher has its own source file, but in this case these two are close enough that I think it's warranted. As for the tests, you can also keep a single test, and add new assertions for toBeEnabled that are negations of the equivalent assertion for toBeDisabled.

(Feel free to try to sway me the other way if you feel strongly against this suggestion).

@lourenci
Copy link
Contributor Author

lourenci commented Feb 8, 2019

I don't have any arguments to keep what I've done. The toBeEnabled matcher is just a negated form to toBeDisabled. I'll do that. :)

@lourenci
Copy link
Contributor Author

lourenci commented Feb 8, 2019

@gnapse it's done. :)

@gnapse gnapse merged commit 02c340d into testing-library:master Feb 10, 2019
@gnapse
Copy link
Member

gnapse commented Feb 10, 2019

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lourenci lourenci deleted the add-to-enabled-matcher branch February 10, 2019 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New toBeEnabled() matcher
2 participants