Skip to content

Commit

Permalink
Tests: add unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
hub33k committed May 7, 2020
1 parent dce3f26 commit 90a3be4
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/core/creators/themedui.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,37 @@

assert.areSame( 'cke_' + editor.name, editor.container.getId() );
assert.areSame( editor.ui.space( 'contents' ), editor.ui.contentsElement );
},

// (#1883)
'test css units': function() {
var editor = this.editor,
lastResizeData = 0,
unitsToTest = [
// absolute lengths
'cm', 'mm', 'q', 'in', 'pc', 'pt', 'px'
];

editor.on( 'resize', function( evt ) {
lastResizeData = evt.data;
} );

for ( var i = 0; i < unitsToTest.length; i++ ) {
var width = 20 + unitsToTest[i],
height = 50 + unitsToTest[i];

editor.resize( width, height );
assert.areSame( CKEDITOR.tools.convertToPx( height ), lastResizeData.outerHeight );
assert.areSame( CKEDITOR.tools.convertToPx( width ), lastResizeData.outerWidth );
assert.areSame( getEditorContentHeight( editor ), lastResizeData.contentsHeight );
assert.areSame( CKEDITOR.tools.convertToPx( height ), getEditorOuterHeight( editor ) );

editor.resize( width, height, true );
assert.areSame( getEditorOuterHeight( editor ), lastResizeData.outerHeight );
assert.areSame( CKEDITOR.tools.convertToPx( width ), lastResizeData.outerWidth );
assert.areSame( getEditorContentHeight( editor ), lastResizeData.contentsHeight );
assert.areSame( CKEDITOR.tools.convertToPx( height ), getEditorContentHeight( editor ) );
}
}
} );
} )();

0 comments on commit 90a3be4

Please sign in to comment.