Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
164 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* bender-ckeditor-plugins: wysiwygarea,toolbar,table */ | ||
( function() { | ||
'use strict'; | ||
|
||
function getEditorContentHeight( editor ) { | ||
return editor.ui.space( 'contents' ).$.offsetHeight; | ||
} | ||
|
||
function getEditorOuterHeight( editor ) { | ||
return editor.container.$.offsetHeight; | ||
} | ||
|
||
bender.editor = true; | ||
|
||
bender.test( { | ||
'test resize event': function() { | ||
var editor = this.editor, | ||
lastResizeData = 0; | ||
|
||
editor.on( 'resize', function(e) { | ||
lastResizeData = e.data; | ||
} ); | ||
|
||
editor.resize( 100, 400 ); | ||
assert.areSame( 400, lastResizeData.outerHeight, 'Outer height should be same as passed one in 2nd argument.' ); | ||
assert.areSame( 100, lastResizeData.outerWidth, 'Outer width should be same as passed one in 1st argument.' ); | ||
assert.areSame( getEditorContentHeight( editor ), lastResizeData.contentsHeight, 'Content height should be same as calculated one.' ); | ||
assert.areSame( 400, getEditorOuterHeight( editor ), 'Outer height should be properly set.' ); | ||
|
||
editor.resize( 100, 400, true ); | ||
assert.areSame( getEditorOuterHeight( editor ), lastResizeData.outerHeight, 'Outer height should be same as calculated one.' ); | ||
assert.areSame( 100, lastResizeData.outerWidth, 'Outer width should be same as passed one in 1st argument.' ); | ||
assert.areSame( 400, lastResizeData.contentsHeight, 'Content height should be same as passed one in 2nd argument.' ); | ||
assert.areSame( 400, getEditorContentHeight( editor ), 'Content height should be properly set.' ); | ||
} | ||
} ) | ||
} )(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<textarea id="editor1"><p>The more a thing tends to be permanent, the more it tends to be lifeless.</p></textarea> | ||
<button id="destroy"><span>Destroy editor</span></button> | ||
<button id="create"><span>Create editor</span></button> | ||
<script> | ||
( function() { | ||
var destroyBtn = CKEDITOR.document.getById( 'destroy' ), | ||
createBtn = CKEDITOR.document.getById( 'create' ), | ||
editor1 = null, | ||
storage; | ||
|
||
function destroyEditor() { | ||
editor1.destroy(); | ||
editor1 = null; | ||
|
||
createBtn.on( 'click', createEditor ); | ||
destroyBtn.removeListener( 'click', destroyEditor ); | ||
} | ||
|
||
function createEditor() { | ||
editor1 = CKEDITOR.replace( 'editor1', { | ||
resize_dir: 'both' | ||
} ); | ||
|
||
editor1.on( 'instanceReady', function() { | ||
editor1.on( 'resize', function( e ) { | ||
storage = e.data; | ||
} ); | ||
|
||
destroyBtn.on( 'click', destroyEditor ); | ||
createBtn.removeListener( 'click', createEditor ); | ||
|
||
if ( storage ) { | ||
editor1.resize( storage.outerWidth, storage.outerHeight ); | ||
} | ||
} ); | ||
} | ||
|
||
createEditor(); | ||
}() ); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@bender-tags: 4.5.0, tc | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: wysiwygarea, toolbar, elementspath, resize | ||
|
||
This test checks whether resize event is fired with dimensions as a properties. If so, destroying and creating editor instances should save its size. | ||
|
||
1. Resize editor | ||
2. Destroy and create editor. | ||
|
||
**Expected result:** After creating new editor instance dimensions should be saved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters