-
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
Merged
mkevins
merged 9 commits into
rnmobile/move-mobile-tests-to-gutenberg-repo
from
try/add-unit-test-willTrimSpaces
May 22, 2019
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9deae78
Add unit test for willTrimSpaces.
mkevins 0731689
Fix willTripSpaces to report false for no outer spaces on styled text.
mkevins 95305c8
Ignore gutenberg-mobile unit tests in gutenberg test pipeline
mkevins 2c8e9af
Revert "Fix willTripSpaces to report false for no outer spaces on sty…
mkevins 3fe59f2
Merge remote-tracking branch 'origin/rnmobile/move-mobile-tests-to-gu…
mkevins fc2f729
Fix lint issues
mkevins aca6ffd
Import RichText without native extension
mkevins fe70c14
Merge branch 'rnmobile/move-mobile-tests-to-gutenberg-repo' into try/…
mkevins 7172601
Remove stubs from rich-text __mocks__
mkevins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
packages/block-editor/src/components/rich-text/test/__mocks__/react-native-aztec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export default class RCTAztecView { | ||
} |
2 changes: 2 additions & 0 deletions
2
packages/block-editor/src/components/rich-text/test/__mocks__/react-native.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export class View {}; | ||
export class Platform {}; |
31 changes: 31 additions & 0 deletions
31
packages/block-editor/src/components/rich-text/test/index.native.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { RichText } from '../index.native'; | ||
|
||
describe( 'RichText Native', () => { | ||
let richText; | ||
|
||
beforeEach( () => { | ||
richText = new RichText( { multiline: false } ); | ||
} ); | ||
|
||
it ( 'exists', () => { | ||
expect( richText ); | ||
} ); | ||
|
||
describe( 'willTrimSpaces', () => { | ||
it( 'exists', () => { | ||
expect( richText.willTrimSpaces ); | ||
} ); | ||
|
||
it( 'is a function', () => { | ||
expect( typeof richText.willTrimSpaces === 'function' ); | ||
} ); | ||
|
||
it( 'reports false for styled text with no outer spaces', () => { | ||
let html = '<p><b>Hello</b> <strong>Hello</strong> WorldWorld!</p>'; | ||
expect( richText.willTrimSpaces( html ) ).toBe( false ); | ||
} ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thegutenberg
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 ✔️