Skip to content

Commit

Permalink
Add test for no property match for given path
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Oct 18, 2022
1 parent 87c6c55 commit a691f88
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/block-editor/src/hooks/test/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,24 @@ describe( 'omitStyle', () => {
expect( omitStyle( undefined, 'color' ) ).toEqual( undefined );
expect( omitStyle( null, 'color' ) ).toEqual( null );
} );

it( 'should ignore a missing object property', () => {
const style1 = { typography: {} };
expect( omitStyle( style1, 'color' ) ).toEqual( style1 );

const style2 = { color: { text: '#d92828' } };
expect( omitStyle( style2, 'color.something' ) ).toEqual( style2 );

const style3 = {
border: {
radius: {
topLeft: '10px',
topRight: '0.5rem',
},
},
};
expect(
omitStyle( style3, [ [ 'border', 'radius', 'bottomLeft' ] ] )
).toEqual( style3 );
} );
} );

0 comments on commit a691f88

Please sign in to comment.