Skip to content

Conversation

walbo
Copy link
Member

@walbo walbo commented May 19, 2022

What?

Add unit tests to CheckboxControl

Why?

CheckboxControl is missing unit tests. Follow-up on #40915 (comment)

How?

Added unit tests.

Testing Instructions

Run npm run test-unit packages/components/src/checkbox-control and confirm all tests passes.

@walbo walbo added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Package] Components /packages/components labels May 19, 2022
@walbo walbo requested a review from ciampo May 19, 2022 18:36
@walbo walbo requested a review from ajitbohra as a code owner May 19, 2022 18:36
Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

Thank you @walbo for working on this!

Would you mind using the recently added @testing-library/user-event instead of fireEvent ? You can see an example of unit tests written that way for the UnitControl component

Thank you!

@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label May 20, 2022
@walbo
Copy link
Member Author

walbo commented May 20, 2022

@ciampo Updated the PR to use @testing-library/user-event

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

Thank you @walbo !

I left a few more comments, but I believe after addressing those, this PR will be ready to be merged!

Petter Walbø Johnsgård and others added 2 commits May 20, 2022 21:32
Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
@walbo
Copy link
Member Author

walbo commented May 20, 2022

Thanks for the great feedback @ciampo! Much appreciated. Have implemented the suggestions.

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

I just left one more comment (which I missed during my previous review) — I'll apply it myself (hope it's ok!)

Otherwise, LGTM 🚀 Thank you for contributing to the components package!

@ciampo ciampo merged commit 0a45d04 into trunk May 23, 2022
@ciampo ciampo deleted the add/checkbox-control-unit-tests branch May 23, 2022 09:57
@github-actions github-actions bot added this to the Gutenberg 13.4 milestone May 23, 2022
westonruter added a commit that referenced this pull request May 23, 2022
…p-tests-config

* 'trunk' of github.com:WordPress/gutenberg: (88 commits)
  Components: refactor `AlignmentMatrixControl` to pass `exhaustive-deps` (#41167)
  [RNMobile] Add 'Insert from URL' option to Image block (#40334)
  [RNMobile] Improvements to Getting Started Guides (#40964)
  Post Author Name: Add to and from Post Author transformations (#41151)
  CheckboxControl: Add unit tests (#41165)
  Improve inline documentation (#41209)
  Mobile Release v1.76.1 (#41196)
  Use explicit type definitions for entity configuration (#40995)
  Scripts: Convert file extension to js in `block.json` during build (#41068)
  Reflects revert in 6446878 (#41221)
  get_style_nodes should be compatible with parent method. (#41217)
  Gallery: Opt-in to axial (column/row) block spacing controls (#41175)
  Table of Contents block: convert line breaks to spaces in headings. (#41206)
  Add support for button elements to theme.json (#40260)
  Global Styles: Load block CSS conditionally (#41160)
  Update URL (#41188)
  Improve autocompleter performance (#41197)
  Site Editor: Set min-width for styles preview (#41198)
  Remove Navigation Editor screen from experiments page (#40878)
  Fix broken Page title for pages created inline within in Nav block (#41063)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants