Skip to content

Commit

Permalink
Add JS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong committed Aug 18, 2022
1 parent 2f1d687 commit a7562f1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/block-editor/src/hooks/test/gap.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,28 @@ describe( 'gap', () => {
...blockGapValue,
} );
} );
it( 'should unwrap var: values from a string into a CSS var() function', () => {
const expectedValue = {
top: 'var(--wp--preset--spacing--60)',
left: 'var(--wp--preset--spacing--60)',
};
expect(
getGapBoxControlValueFromStyle( 'var:preset|spacing|60' )
).toEqual( expectedValue );
} );
it( 'should unwrap var: values from an object into a CSS var() function', () => {
const expectedValue = {
top: 'var(--wp--preset--spacing--20)',
left: 'var(--wp--preset--spacing--60)',
};
const blockGapValue = {
top: 'var:preset|spacing|20',
left: 'var:preset|spacing|60',
};
expect( getGapBoxControlValueFromStyle( blockGapValue ) ).toEqual(
expectedValue
);
} );
} );
describe( 'getGapCSSValue()', () => {
it( 'should return `null` if argument is falsey', () => {
Expand Down

0 comments on commit a7562f1

Please sign in to comment.