diff --git a/packages/blocks/src/store/test/reducer.js b/packages/blocks/src/store/test/reducer.js index 5664f9d876cb6..7c5dcbf861fc6 100644 --- a/packages/blocks/src/store/test/reducer.js +++ b/packages/blocks/src/store/test/reducer.js @@ -108,12 +108,12 @@ describe( 'blockStyles', () => { expect( blockStyles( undefined, {} ) ).toEqual( {} ); } ); - it( 'should add a new block styles', () => { + it( 'should add new block styles for a single block type', () => { const original = deepFreeze( {} ); let state = blockStyles( original, { type: 'ADD_BLOCK_STYLES', - blockName, + blockNames: [ blockName ], styles: [ { name: 'fancy' } ], } ); @@ -123,7 +123,7 @@ describe( 'blockStyles', () => { state = blockStyles( state, { type: 'ADD_BLOCK_STYLES', - blockName, + blockNames: [ blockName ], styles: [ { name: 'lightbox' } ], } ); @@ -132,6 +132,32 @@ describe( 'blockStyles', () => { } ); } ); + it( 'should add block styles for array of block types', () => { + const original = deepFreeze( {} ); + + let state = blockStyles( original, { + type: 'ADD_BLOCK_STYLES', + blockNames: [ 'core/group', 'core/columns' ], + styles: [ { name: 'dark' } ], + } ); + + expect( state ).toEqual( { + 'core/group': [ { name: 'dark' } ], + 'core/columns': [ { name: 'dark' } ], + } ); + + state = blockStyles( state, { + type: 'ADD_BLOCK_STYLES', + blockNames: [ 'core/group' ], + styles: [ { name: 'light' } ], + } ); + + expect( state ).toEqual( { + 'core/group': [ { name: 'dark' }, { name: 'light' } ], + 'core/columns': [ { name: 'dark' } ], + } ); + } ); + it( 'should prepend block styles when adding a block', () => { const original = deepFreeze( { [ blockName ]: [ { name: 'fancy' } ],