Skip to content

Commit

Permalink
Adds tests for isContainerGroupBlock function
Browse files Browse the repository at this point in the history
Note these test will need updating when we land #15774
  • Loading branch information
getdave committed Jun 3, 2019
1 parent c3bdf0f commit b2519fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/blocks/src/api/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export const isWildcardBlockTransform = ( t ) => t && t.type === 'block' && t.bl
* @param {string} name the name of the Block to test against
* @return {boolean} whether or not the Block is the container Block type
*/
const isContainerGroupBlock = ( name ) => name === 'core/group';
export const isContainerGroupBlock = ( name ) => name === 'core/group';

/**
* Determines whether the provided Blocks are a multi Block selection
Expand Down
11 changes: 11 additions & 0 deletions packages/blocks/src/api/test/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
getBlockTransforms,
findTransform,
isWildcardBlockTransform,
isContainerGroupBlock,
} from '../factory';
import {
getBlockType,
Expand Down Expand Up @@ -1452,4 +1453,14 @@ describe( 'block factory', () => {
expect( isWildcardBlockTransform( invalidWildcardBlockTransform ) ).toBe( false );
} );
} );

describe( 'isContainerGroupBlock', () => {
it( 'should return true when passed block name matches "core/group"', () => {
expect( isContainerGroupBlock( 'core/group' ) ).toBe( true );
} );

it( 'should return false when passed block name does not match "core/group"', () => {
expect( isContainerGroupBlock( 'core/some-test-name' ) ).toBe( false );
} );
} );
} );

0 comments on commit b2519fa

Please sign in to comment.