|
|
@@ -22,6 +22,7 @@ import {
|
|
|
getLocalizedColorErrorText,
|
|
|
getLocalizedLengthErrorText,
|
|
|
lengthFieldValidator,
|
|
|
+ lineWidthFieldValidator,
|
|
|
colorFieldValidator,
|
|
|
fillToolbar
|
|
|
} from '../../src/ui/utils';
|
|
|
@@ -245,6 +246,7 @@ describe( 'UI Utils', () => {
|
|
|
expect( lengthFieldValidator( '1px' ) ).to.be.true;
|
|
|
expect( lengthFieldValidator( '12em' ) ).to.be.true;
|
|
|
expect( lengthFieldValidator( ' 12em ' ) ).to.be.true;
|
|
|
+ expect( lengthFieldValidator( '45%' ) ).to.be.true;
|
|
|
} );
|
|
|
|
|
|
it( 'should pass for number without unit', () => {
|
|
|
@@ -265,6 +267,40 @@ describe( 'UI Utils', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
+ describe( 'lineWidthFieldValidator()', () => {
|
|
|
+ it( 'should pass for an empty value', () => {
|
|
|
+ expect( lineWidthFieldValidator( '' ) ).to.be.true;
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should pass for white spaces', () => {
|
|
|
+ expect( lineWidthFieldValidator( ' ' ) ).to.be.true;
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should pass for lengths', () => {
|
|
|
+ expect( lineWidthFieldValidator( '1px' ) ).to.be.true;
|
|
|
+ expect( lineWidthFieldValidator( '12em' ) ).to.be.true;
|
|
|
+ expect( lineWidthFieldValidator( ' 12em ' ) ).to.be.true;
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should pass for number without unit', () => {
|
|
|
+ expect( lineWidthFieldValidator( '1' ) ).to.be.true;
|
|
|
+ expect( lineWidthFieldValidator( '12.1' ) ).to.be.true;
|
|
|
+ expect( lineWidthFieldValidator( '0.125 ' ) ).to.be.true;
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should not pass for invalid number values', () => {
|
|
|
+ expect( lineWidthFieldValidator( '.1 ' ) ).to.be.false;
|
|
|
+ expect( lineWidthFieldValidator( '45. ' ) ).to.be.false;
|
|
|
+ expect( lineWidthFieldValidator( '45.1.1 ' ) ).to.be.false;
|
|
|
+ expect( lineWidthFieldValidator( '45%' ) ).to.be.false;
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should pass for lengths surrounded by white spaces', () => {
|
|
|
+ expect( lineWidthFieldValidator( '3px ' ) ).to.be.true;
|
|
|
+ expect( lineWidthFieldValidator( ' 12em ' ) ).to.be.true;
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+
|
|
|
describe( 'getBorderStyleDefinitions()', () => {
|
|
|
let view, locale, definitions;
|
|
|
|