Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d4e140f
Upgrade React packages to v18
jsnajdr Oct 24, 2022
3cc35fd
Upgrade framer-motion to get React 18 support and updated types
jsnajdr Oct 25, 2022
7af9bf2
React Native: upgrade to 0.69.4
jsnajdr Oct 31, 2022
b9d3d28
React Native: upgrade libraries
jsnajdr Nov 28, 2022
ea93ff0
LinkControl: fix unit tests
jsnajdr Nov 16, 2022
05da41f
Components: fix unit tests
jsnajdr Oct 26, 2022
9408a92
Block Editor: fix unit tests
jsnajdr Oct 27, 2022
382359b
NUX: fix unit tests
jsnajdr Oct 27, 2022
61e8e7a
useSelect: fix unit tests (partially)
jsnajdr Oct 28, 2022
23fb060
LinkSettings test: fix finding blocks by label text
jsnajdr Oct 31, 2022
b712d42
BlockDraggable test: fix finding blocks by label text
jsnajdr Oct 31, 2022
d253cdb
React Native test helpers: fix getting blocks
jsnajdr Oct 31, 2022
637ce64
Block Library tests: fix finding blocks by label text
jsnajdr Oct 31, 2022
6da1678
ToggleGroupControl: fix unit test by waiting for tooltip
jsnajdr Nov 18, 2022
cd42397
File Block: update snapshots to account for empty children
jsnajdr Nov 18, 2022
9f7c332
Embed native tests: improve mocked API response
jsnajdr Nov 21, 2022
4de9c4a
Embed native tests: wait for rich preview to appear
jsnajdr Nov 21, 2022
c9b9bd6
Format Library: fix finding blocks by label text
jsnajdr Nov 21, 2022
7fb330c
Edit Post: fix finding blocks by label text
jsnajdr Nov 21, 2022
4edb25f
Update native snapshots
tyxla Nov 23, 2022
7774a2f
useNestedSettingsUpdate: deoptimize/unbatch dispatching the updateBlo…
jsnajdr Nov 27, 2022
78faaeb
Color Palette: wait for dropdown to appear
jsnajdr Nov 27, 2022
807bcea
Add custom Jest matcher: toBePositionedPopover
jsnajdr Nov 28, 2022
595ce61
Use toBePositionedPopover matcher in tests
jsnajdr Nov 28, 2022
bb2595d
Mobile - Update tests
Oct 5, 2022
36de541
Mobile - Update gitignore
Oct 5, 2022
34c9c7f
Mobile - Update ruby config
Oct 5, 2022
3271c32
[Mobile] - React Native 0.69.4 Upgrade - Android (#43486)
Oct 11, 2022
c0adb62
[Mobile] - React Native 0.69.4 Upgrade - iOS
derekblank Oct 18, 2022
c9c71e7
Mobile - Check for a local bundle running with metro and use a jsbund…
Oct 21, 2022
d016b5d
Remove duplicated import of Gesture handler
Oct 30, 2022
e7bacd7
Remove deprecated initialization for Reanimated
Nov 2, 2022
d19e915
Update Podfile.lock after updating dependencies
Nov 28, 2022
69444f7
Remove React peer deps from packages that don't need them
jsnajdr Nov 30, 2022
259e3bb
Add changelog entries about React 18 upgrade
jsnajdr Nov 30, 2022
16d1ec2
Extract useIsScreenReaderEnabled hook, set state only if enabled=true
jsnajdr Nov 30, 2022
6e704aa
Mobile - Update Podfile.lock
Dec 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Format Library: fix finding blocks by label text
  • Loading branch information
jsnajdr committed Dec 1, 2022
commit c9b9bd68ddc3d86e5508ffe9d350878c05c262be
72 changes: 30 additions & 42 deletions packages/format-library/src/text-color/test/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,90 +32,80 @@ afterAll( () => {

describe( 'Text color', () => {
it( 'shows the text color formatting button in the toolbar', async () => {
const { getByLabelText } = await initializeEditor();
const screen = await initializeEditor();

// Wait for the editor placeholder
const paragraphPlaceholder = await waitFor( () =>
getByLabelText( 'Add paragraph block' )
const paragraphPlaceholder = await screen.findByLabelText(
'Add paragraph block'
);
expect( paragraphPlaceholder ).toBeDefined();
fireEvent.press( paragraphPlaceholder );

// Wait for the block to be created
const paragraphBlock = await waitFor( () =>
getByLabelText( /Paragraph Block\. Row 1/ )
const [ paragraphBlock ] = await screen.findAllByLabelText(
/Paragraph Block\. Row 1/
);
expect( paragraphBlock ).toBeDefined();

// Look for the highlight text color button
const textColorButton = await waitFor( () =>
getByLabelText( 'Text color' )
);
const textColorButton = await screen.findByLabelText( 'Text color' );
expect( textColorButton ).toBeDefined();
} );

it( 'allows toggling the highlight color feature to type new text', async () => {
const { getByLabelText, getByTestId, getByA11yHint } =
await initializeEditor();
const screen = await initializeEditor();

// Wait for the editor placeholder
const paragraphPlaceholder = await waitFor( () =>
getByLabelText( 'Add paragraph block' )
const paragraphPlaceholder = await screen.findByLabelText(
'Add paragraph block'
);
expect( paragraphPlaceholder ).toBeDefined();
fireEvent.press( paragraphPlaceholder );

// Wait for the block to be created
const paragraphBlock = await waitFor( () =>
getByLabelText( /Paragraph Block\. Row 1/ )
const [ paragraphBlock ] = await screen.findAllByLabelText(
/Paragraph Block\. Row 1/
);
expect( paragraphBlock ).toBeDefined();

// Look for the highlight text color button
const textColorButton = await waitFor( () =>
getByLabelText( 'Text color' )
);
const textColorButton = await screen.findByLabelText( 'Text color' );
expect( textColorButton ).toBeDefined();
fireEvent.press( textColorButton );

// Wait for Inline color modal to be visible
const inlineTextColorModal = getByTestId( 'inline-text-color-modal' );
const inlineTextColorModal = screen.getByTestId(
'inline-text-color-modal'
);
await waitFor( () => inlineTextColorModal.props.isVisible );

// Look for the pink color button
const pinkColorButton = await waitFor( () =>
getByA11yHint( COLOR_PINK )
);
const pinkColorButton = await screen.findByA11yHint( COLOR_PINK );
expect( pinkColorButton ).toBeDefined();
fireEvent.press( pinkColorButton );

expect( getEditorHtml() ).toMatchSnapshot();
} );

it( 'allows toggling the highlight color feature to selected text', async () => {
const {
getByLabelText,
getByTestId,
getByPlaceholderText,
getByA11yHint,
} = await initializeEditor();
const screen = await initializeEditor();
const text = 'Hello this is a test';

// Wait for the editor placeholder
const paragraphPlaceholder = await waitFor( () =>
getByLabelText( 'Add paragraph block' )
const paragraphPlaceholder = await screen.findByLabelText(
'Add paragraph block'
);
expect( paragraphPlaceholder ).toBeDefined();
fireEvent.press( paragraphPlaceholder );

// Wait for the block to be created
const paragraphBlock = await waitFor( () =>
getByLabelText( /Paragraph Block\. Row 1/ )
const [ paragraphBlock ] = await screen.findAllByLabelText(
/Paragraph Block\. Row 1/
);
expect( paragraphBlock ).toBeDefined();

// Update TextInput value
const paragraphText = getByPlaceholderText( 'Start writing…' );
const paragraphText = screen.getByPlaceholderText( 'Start writing…' );
fireEvent( paragraphText, 'onSelectionChange', 0, text.length, text, {
nativeEvent: {
eventCount: 1,
Expand All @@ -125,34 +115,32 @@ describe( 'Text color', () => {
} );

// Look for the highlight text color button
const textColorButton = await waitFor( () =>
getByLabelText( 'Text color' )
);
const textColorButton = await screen.findByLabelText( 'Text color' );
expect( textColorButton ).toBeDefined();
fireEvent.press( textColorButton );

// Wait for Inline color modal to be visible
const inlineTextColorModal = getByTestId( 'inline-text-color-modal' );
const inlineTextColorModal = screen.getByTestId(
'inline-text-color-modal'
);
await waitFor( () => inlineTextColorModal.props.isVisible );

// Look for the pink color button
const pinkColorButton = await waitFor( () =>
getByA11yHint( COLOR_PINK )
);
const pinkColorButton = await screen.findByA11yHint( COLOR_PINK );
expect( pinkColorButton ).toBeDefined();
fireEvent.press( pinkColorButton );

expect( getEditorHtml() ).toMatchSnapshot();
} );

it( 'creates a paragraph block with the text color format', async () => {
const { getByLabelText } = await initializeEditor( {
const screen = await initializeEditor( {
initialHtml: TEXT_WITH_COLOR,
} );

// Wait for the block to be created
const paragraphBlock = await waitFor( () =>
getByLabelText( /Paragraph Block\. Row 1/ )
const [ paragraphBlock ] = await screen.findAllByLabelText(
/Paragraph Block\. Row 1/
);
expect( paragraphBlock ).toBeDefined();

Expand Down