1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
/* bender-tags: editor, dialog, 4473 */
/* bender-ckeditor-plugins: dialog */
var errorMsg = 'error!';
bender.test( {
// (#4473)
'test validator cssLength should accept passed argument': function() {
var positiveResult = CKEDITOR.dialog.validate.cssLength( errorMsg )( '10pt' );
var negativeResult = CKEDITOR.dialog.validate.cssLength( errorMsg )( 'solid' );
assert.isTrue( positiveResult );
assert.areSame( errorMsg, negativeResult );
},
// (#4473)
'test validator htmlLength should accept passed argument': function() {
var result = CKEDITOR.dialog.validate.htmlLength( errorMsg )( '10px' );
var negativeResult = CKEDITOR.dialog.validate.htmlLength( errorMsg )( 'solid' );
assert.isTrue( result );
assert.areSame( errorMsg, negativeResult );
},
// (#4473)
'test validator equals should accept passed argument': function() {
var result = CKEDITOR.dialog.validate.equals( 'foo', errorMsg )( 'foo' );
var negativeResult = CKEDITOR.dialog.validate.equals( 'foo', errorMsg )( 'baz' );
assert.isTrue( result );
assert.areSame( errorMsg, negativeResult );
},
// (#4473)
'test validator notEqual should accept passed argument': function() {
var result = CKEDITOR.dialog.validate.notEqual( 'foo', errorMsg )( 'baz' );
var negativeResult = CKEDITOR.dialog.validate.notEqual( 'foo', errorMsg )( 'foo' );
assert.isTrue( result );
assert.areSame( errorMsg, negativeResult );
},
// (#4473)
'test validator inlineStyle should accept passed argument': function() {
var result = CKEDITOR.dialog.validate.inlineStyle( errorMsg )( 'height: 10px; width: 20px;' );
var resultFromEmpty = CKEDITOR.dialog.validate.inlineStyle( errorMsg )( '' );
var negativeResult = CKEDITOR.dialog.validate.inlineStyle( errorMsg )( 'test' );
assert.isTrue( result );
assert.isTrue( resultFromEmpty );
assert.areSame( errorMsg, negativeResult );
},
'test validator integer should accept passed argument': function() {
var result = CKEDITOR.dialog.validate.integer( errorMsg )( '123' );
var negativeResult = CKEDITOR.dialog.validate.integer( errorMsg )( '123.321' );
assert.isTrue( result );
assert.areSame( errorMsg, negativeResult );
},
'test validator notEmpty should accept passed argument': function() {
var result = CKEDITOR.dialog.validate.notEmpty( errorMsg )( 'test' );
var negativeResult = CKEDITOR.dialog.validate.notEmpty( errorMsg )( ' ' );
assert.isTrue( result );
assert.areSame( errorMsg, negativeResult );
},
'test validator number should accept passed argument': function() {
var result = CKEDITOR.dialog.validate.number( errorMsg )( '123' );
var negativeResult = CKEDITOR.dialog.validate.number( errorMsg )( 'test' );
assert.isTrue( result );
assert.areSame( errorMsg, negativeResult );
},
'test validator regex should accept passed argument': function() {
var result = CKEDITOR.dialog.validate.regex( /^\d*$/, errorMsg )( '123' );
var negativeResult = CKEDITOR.dialog.validate.regex( /^\d*$/, errorMsg )( '123.321' );
assert.isTrue( result );
assert.areSame( errorMsg, negativeResult );
}
} );
|