Skip to content

Commit

Permalink
Add unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Mar 15, 2019
1 parent 70759fb commit c765b6e
Show file tree
Hide file tree
Showing 2 changed files with 434 additions and 16 deletions.
59 changes: 43 additions & 16 deletions packages/block-editor/src/store/test/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,31 @@
* Internal dependencies
*/
import {
replaceBlocks,
startTyping,
stopTyping,
clearSelectedBlock,
enterFormattedText,
exitFormattedText,
toggleSelection,
hideInsertionPoint,
insertBlock,
insertBlocks,
mergeBlocks,
multiSelect,
removeBlock,
removeBlocks,
replaceBlock,
replaceBlocks,
replaceInnerBlocks,
resetBlocks,
updateBlockAttributes,
updateBlock,
selectBlock,
selectPreviousBlock,
showInsertionPoint,
startMultiSelect,
startTyping,
stopMultiSelect,
multiSelect,
clearSelectedBlock,
replaceBlock,
insertBlock,
insertBlocks,
showInsertionPoint,
hideInsertionPoint,
mergeBlocks,
removeBlocks,
removeBlock,
stopTyping,
toggleBlockMode,
toggleSelection,
updateBlock,
updateBlockAttributes,
updateBlockListSettings,
} from '../actions';
import { select } from '../controls';
Expand Down Expand Up @@ -346,4 +347,30 @@ describe( 'actions', () => {
} );
} );
} );

describe( 'replaceInnerBlocks', () => {
const block = {
clientId: 'ribs',
};

it( 'should return the REPLACE_INNER_BLOCKS action with default values set', () => {
expect( replaceInnerBlocks( 'root', [ block ] ) ).toEqual( {
type: 'REPLACE_INNER_BLOCKS',
blocks: [ block ],
rootClientId: 'root',
time: expect.any( Number ),
updateSelection: true,
} );
} );

it( 'should return the REPLACE_INNER_BLOCKS action with updateSelection false', () => {
expect( replaceInnerBlocks( 'root', [ block ], false ) ).toEqual( {
type: 'REPLACE_INNER_BLOCKS',
blocks: [ block ],
rootClientId: 'root',
time: expect.any( Number ),
updateSelection: false,
} );
} );
} );
} );
Loading

0 comments on commit c765b6e

Please sign in to comment.