Skip to content
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: Update Heading block E2E test #46220

Merged
merged 3 commits into from Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/block-library/src/block/test/edit.native.js
Expand Up @@ -24,7 +24,7 @@ const getMockedReusableBlock = ( id ) => ( {
content: {
raw: `
<!-- wp:heading -->
<h2>First Reusable block</h2>
<h2 class="wp-block-heading">First Reusable block</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
Expand Down
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Heading block inserts block 1`] = `
"<!-- wp:heading -->
<h2 class=\\"wp-block-heading\\"></h2>
<!-- /wp:heading -->"
`;
44 changes: 44 additions & 0 deletions packages/block-library/src/heading/test/index.native.js
@@ -0,0 +1,44 @@
/**
* External dependencies
*/
import {
fireEvent,
getEditorHtml,
initializeEditor,
addBlock,
getBlock,
} from 'test/helpers';

/**
* WordPress dependencies
*/
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
import { registerCoreBlocks } from '@wordpress/block-library';

beforeAll( () => {
// Register all core blocks
registerCoreBlocks();
} );

afterAll( () => {
// Clean up registered blocks
getBlockTypes().forEach( ( block ) => {
unregisterBlockType( block.name );
} );
} );

describe( 'Heading block', () => {
it( 'inserts block', async () => {
const screen = await initializeEditor();

// Add block
await addBlock( screen, 'Heading' );

// Get block
const headingBlock = await getBlock( screen, 'Heading' );
fireEvent.press( headingBlock );
expect( headingBlock ).toBeVisible();

expect( getEditorHtml() ).toMatchSnapshot();
} );
} );
Expand Up @@ -143,7 +143,7 @@ exports.audioBlockPlaceholder = `<!-- wp:audio {"id":5} -->
<!-- /wp:audio -->`;

exports.headerBlockEmpty = `<!-- wp:heading -->
<h2></h2>
<h2 class="wp-block-heading"></h2>
<!-- /wp:heading -->`;

exports.separatorBlockEmpty = `<!-- wp:separator -->
Expand Down