Skip to content

Commit

Permalink
Mobile - Columns - Test: Adds testing adding at least 15 columns with…
Browse files Browse the repository at this point in the history
…out limitation
  • Loading branch information
Gerardo committed May 30, 2023
1 parent a072b66 commit c870c74
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,78 @@ exports[`Columns block when using the number of columns setting adds a column bl
<!-- /wp:columns -->"
`;

exports[`Columns block when using the number of columns setting adds at least 15 Column blocks without limitation 1`] = `
"<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->"
`;

exports[`Columns block when using the number of columns setting reaches the minimum limit of number of column blocks 1`] = `
"<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
Expand Down
25 changes: 25 additions & 0 deletions packages/block-library/src/columns/test/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,31 @@ describe( 'Columns block', () => {
expect( getEditorHtml() ).toMatchSnapshot();
} );

it( 'adds at least 15 Column blocks without limitation', async () => {
const screen = await initializeEditor( {
initialHtml: TWO_COLUMNS_BLOCK_HTML,
} );
const { getByLabelText } = screen;

// Get block
const columnsBlock = await getBlock( screen, 'Columns' );
fireEvent.press( columnsBlock );

// Open block settings
await openBlockSettings( screen );

// Update the number of columns
const columnsControl = getByLabelText( /Number of columns/ );

for ( let x = 0; x < 15; x++ ) {
fireEvent( columnsControl, 'accessibilityAction', {
nativeEvent: { actionName: 'increment' },
} );
}

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

it( 'removes a column block when decrementing the value', async () => {
const screen = await initializeEditor( {
initialHtml: TWO_COLUMNS_BLOCK_HTML,
Expand Down

0 comments on commit c870c74

Please sign in to comment.