-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RNMobile] Classic block: Add option to convert to blocks (#55461)
* Add option to convert Classic block to blocks in Missing block * Add integration tests for Classic block * Update `react-native-editor` changelog
- Loading branch information
Showing
4 changed files
with
108 additions
and
6 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
packages/block-library/src/freeform/test/__snapshots__/index.native.js.snap
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,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Classic block converts content into blocks 1`] = ` | ||
"<!-- wp:paragraph --> | ||
<p>I'm classic!</p> | ||
<!-- /wp:paragraph -->" | ||
`; |
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,57 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { | ||
fireEvent, | ||
getBlock, | ||
getEditorHtml, | ||
initializeEditor, | ||
screen, | ||
setupCoreBlocks, | ||
within, | ||
} from 'test/helpers'; | ||
|
||
const CLASSIC_BLOCK_HTML = `<p>I'm classic!</p>`; | ||
const DEFAULT_EDITOR_CAPABILITIES = { | ||
unsupportedBlockEditor: true, | ||
canEnableUnsupportedBlockEditor: true, | ||
}; | ||
|
||
setupCoreBlocks(); | ||
|
||
describe( 'Classic block', () => { | ||
it( 'displays option to edit using web editor', async () => { | ||
await initializeEditor( { | ||
initialHtml: CLASSIC_BLOCK_HTML, | ||
capabilities: DEFAULT_EDITOR_CAPABILITIES, | ||
} ); | ||
|
||
const block = getBlock( screen, 'Classic' ); | ||
fireEvent.press( block ); | ||
|
||
// Tap the block to open the unsupported block details | ||
fireEvent.press( within( block ).getByText( 'Unsupported' ) ); | ||
|
||
const actionButton = screen.getByText( 'Edit using web editor' ); | ||
expect( actionButton ).toBeVisible(); | ||
} ); | ||
|
||
it( 'converts content into blocks', async () => { | ||
await initializeEditor( { | ||
initialHtml: CLASSIC_BLOCK_HTML, | ||
capabilities: DEFAULT_EDITOR_CAPABILITIES, | ||
} ); | ||
|
||
const block = getBlock( screen, 'Classic' ); | ||
fireEvent.press( block ); | ||
|
||
// Tap the block to open the unsupported block details | ||
fireEvent.press( within( block ).getByText( 'Unsupported' ) ); | ||
|
||
const actionButton = screen.getByText( 'Convert to blocks' ); | ||
expect( actionButton ).toBeVisible(); | ||
|
||
fireEvent.press( actionButton ); | ||
expect( getEditorHtml() ).toMatchSnapshot(); | ||
} ); | ||
} ); |
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
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
a00a5dd
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.
Flaky tests detected in a00a5dd.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6586229988
📝 Reported issues:
specs/site-editor/multi-entity-saving.test.js
specs/editor/various/pattern-blocks.test.js
specs/editor/various/pattern-blocks.test.js
specs/editor/various/pattern-blocks.test.js
specs/editor/various/pattern-blocks.test.js
specs/editor/various/pattern-blocks.test.js