-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[Mobile] Add unit tests for willTrimSpaces function in RichText #15552
[Mobile] Add unit tests for willTrimSpaces function in RichText #15552
Conversation
…led text." This reverts commit 0731689. Upstream changes make this implementation no longer necessary.
…tenberg-repo' into try/add-unit-test-willTrimSpaces
f507d2b
to
3fe59f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question:
We added the .native.js
ignore pattern, but this test has extension .native.js
, and it's meant to be run by stand-alone gutenberg repo.
Wouldn't this config actually ignore this test?
/** | ||
* Internal dependencies | ||
*/ | ||
import { RichText } from '../index.native'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imported from ../index.native
because I was originally using this within the gutenberg
test pipeline (without altering the jest config). I'm unsure whether this will be necessary if we plan to introduce a separate mobile-specific jest configuration which resolves all *.native.js
files to their *.js
key-names in the dependency map. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running with gutenberg-mobile
tooling, importing ../index
will be enough 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @etoledom ! Fixed ✔️
Indeed. When I set out to add these unit tests, I envisioned running them side by side as part of the normal pipeline in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @mkevins - Looks great! 🎉
* Moving paragraph native test to gutenberg repo * Rename native tests folder from __native_tests__ to test To be able to use the same structure already in place. * Ignore .native.js files on unit tests * Move native code block test to gutenberg repo. * Moved native link modal tests to gutenberg repo * Moved mobile media progress tests to gutenberg repo. * Moved mobile media upload tests to gutenberg repo * Renamed mobile paragraph block tests to be the same as the file it tests * [Mobile] Add unit tests for willTrimSpaces function in RichText (#15552) * Add unit test for willTrimSpaces. * Fix willTripSpaces to report false for no outer spaces on styled text. * Ignore gutenberg-mobile unit tests in gutenberg test pipeline * Revert "Fix willTripSpaces to report false for no outer spaces on styled text." This reverts commit 0731689. Upstream changes make this implementation no longer necessary. * Fix lint issues * Import RichText without native extension * Remove stubs from rich-text __mocks__ * Update native paragraph test * Update mobile link tests
Description
This PR adds unit tests to specify the behavior for the
willTrimSpaces
function in RichText (https://github.com/WordPress/gutenberg/pull/15021/files#diff-4828a21853e899e5a36faecfa96d83e8R631). Unit tests should help in addressing some edge cases, such as the one described here: wordpress-mobile/gutenberg-mobile#903 (comment).The changes will also fix the regression of this issue #14957 described here: wordpress-mobile/gutenberg-mobile#903.How has this been tested?
The tests are run from the
gutenberg-mobile
repository withyarn test
, or specifically:yarn test gutenberg/packages/block-editor/src/components/rich-text/test/index.native.js
.Types of changes
Bug (regression) fix, andtests added.Checklist: