|
|
@@ -9,7 +9,7 @@ import {
|
|
|
getShorthandValues,
|
|
|
isColor,
|
|
|
isLength,
|
|
|
- isLineStyle
|
|
|
+ isLineStyle, isPercentage
|
|
|
} from '../../../src/view/styles/utils';
|
|
|
|
|
|
describe( 'Styles utils', () => {
|
|
|
@@ -159,6 +159,16 @@ describe( 'Styles utils', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
+ describe( 'isPercentage()', () => {
|
|
|
+ it( 'returns true valid values', () => {
|
|
|
+ testValues( [ '1%', '100%', '1123.1312%', '0.9876%' ], isPercentage );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'returns false for not a percentage values', () => {
|
|
|
+ testValues( [ '0', '1px', '1000px', '1.1px', '345.457px', '.457px' ], value => !isPercentage( value ) );
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+
|
|
|
describe( 'getBoxSidesShorthandValue()', () => {
|
|
|
it( 'should output one value for same values', () => {
|
|
|
expect( getBoxSidesShorthandValue( { top: 'foo', right: 'foo', bottom: 'foo', left: 'foo' } ) ).to.equal( 'foo' );
|