Skip to content
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

feat: Deprecate toBeEmpty in favour of toBeEmptyDOMElement (#216) #254

Merged
merged 1 commit into from May 28, 2020
Merged

feat: Deprecate toBeEmpty in favour of toBeEmptyDOMElement (#216) #254

merged 1 commit into from May 28, 2020

Conversation

DanielaValero
Copy link
Contributor

What:

  • Add deprecation note to toBeEmpty
  • Create toBeEmptyDomElement to replace toBeEmpty
  • Document changes

Why:
This is an alternative solution that allows users of jest-dom and jest-extended to check for emptiness of strings, etc. And DOM elements, using different matchers.

How:

  • The code of toBeEmptyDomElement is a copy of toBeEmpty, the only changes in there is the name.

Checklist:

  • Documentation
  • Tests
  • [N/A] Updated Type Definitions
  • [?] Ready to be merged

@codecov
Copy link

codecov bot commented May 24, 2020

Codecov Report

Merging #254 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #254   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        23    +1     
  Lines          305       309    +4     
  Branches        73        73           
=========================================
+ Hits           305       309    +4     
Impacted Files Coverage Δ
src/to-be-empty-dom-element.js 100.00% <100.00%> (ø)
src/to-be-empty.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 85cf707...e770bd2. Read the comment docs.

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.

Looks god.

I have only one doubt about the name. I wonder if it should be toBeEmptyDOMElement. I really wouldn't mind it like it is now, but I realized we also have toBeInTheDOM (which has been deprecated for a long while now, and I think it's time to remove it in breaking change release already, so maybe this is not a big deal).

@DanielaValero
Copy link
Contributor Author

Hi @gnapse so should I leave it with this name? I could do another PR to remove toBeInTeDOM

What is the usual process to merge a PR? one approval and I merge myself? two approvals and the second approver merges?

@gnapse
Copy link
Member

gnapse commented May 27, 2020

I'd rename this to toBeEmptyDOMElement regardless of the future removal of toBeInTheDOM. As @KevinHerklotz pointed out above, it is a better reflection of the words in the phrase.

@DanielaValero the removal of toBeInTheDOM is an independent issue. If you still want to take a crack at it, please do so, but do not do it to remove the discrepancy only. And thanks a lot!

@DanielaValero
Copy link
Contributor Author

DanielaValero commented May 28, 2020

Hi @gnapse, about the renaming, sure, it took me a while to notice the part needs renaming is to make DOM all uppercase.

If I might suggest yo an improving area when giving feedback, in the case of renaming or typos, authors of the code not necessarily notice when they did the typo or renaming bit, and it helps a lot to point out specifically what is the part. i.e: Dom -> DOM 🙂

As of the toBeInTheDom I suggested I could do it in a separate PR definitely not with the goal of removing the discrepancy, I meant it more to offer help because you mentioned can be removed.

Thanks for the clarification on the feedback!

The renaming is done, please check again. :)

In order to prevent name clashes with jest-extended, the toBeEmpty will
have from now on a more specific name.
@gnapse
Copy link
Member

gnapse commented May 28, 2020

@DanielaValero sorry. Yes, I assumed it was evident when it is not. Will keep that in mind. I realize I never mentioned the fact that this word is an acronym even, which would've given the clue about the all-caps vs. capitalized difference.

I meant it more to offer help because you mentioned can be removed.

Sure. Your help is greatly appreciated.

I'll review it all shortly. Thanks!

@gnapse gnapse changed the title feat: Deprecate toBeEmpty in favour of toBeEmptyDomElement (#216) feat: Deprecate toBeEmpty in favour of toBeEmptyDOMElement (#216) May 28, 2020
@gnapse gnapse merged commit 927c5a4 into testing-library:master May 28, 2020
@gnapse
Copy link
Member

gnapse commented May 28, 2020

@all-contributors add @DanielaValero for code, test, docs

@allcontributors
Copy link
Contributor

@gnapse

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

@gnapse
Copy link
Member

gnapse commented May 28, 2020

🎉 This PR is included in version 5.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@charliematters
Copy link

Is there an ETA on this arriving in the @types repo?

@darekkay
Copy link
Contributor

darekkay commented Jun 3, 2020

@gnapse @charliematters The types PR is merged and a new package version is released, so we only have to update the version here, right? If yes, I can provide a quick PR.

@gnapse
Copy link
Member

gnapse commented Jun 3, 2020

Yes, please. Do so. Thanks!

@darekkay darekkay mentioned this pull request Jun 3, 2020
4 tasks
darekkay added a commit to darekkay/dashboard that referenced this pull request Jun 3, 2020
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.

None yet

4 participants