|
@@ -13,7 +13,7 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
|
|
|
import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
|
|
import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
|
|
|
|
|
|
|
|
describe( 'ImageStyleUI', () => {
|
|
describe( 'ImageStyleUI', () => {
|
|
|
- let editor;
|
|
|
|
|
|
|
+ let editor, editorElement;
|
|
|
|
|
|
|
|
const styles = [
|
|
const styles = [
|
|
|
{ name: 'style 1', title: 'Style 1 title', icon: 'style1-icon', isDefault: true },
|
|
{ name: 'style 1', title: 'Style 1 title', icon: 'style1-icon', isDefault: true },
|
|
@@ -22,7 +22,7 @@ describe( 'ImageStyleUI', () => {
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
beforeEach( () => {
|
|
beforeEach( () => {
|
|
|
- const editorElement = global.document.createElement( 'div' );
|
|
|
|
|
|
|
+ editorElement = global.document.createElement( 'div' );
|
|
|
global.document.body.appendChild( editorElement );
|
|
global.document.body.appendChild( editorElement );
|
|
|
|
|
|
|
|
return ClassicTestEditor
|
|
return ClassicTestEditor
|
|
@@ -38,6 +38,7 @@ describe( 'ImageStyleUI', () => {
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
afterEach( () => {
|
|
afterEach( () => {
|
|
|
|
|
+ editorElement.remove();
|
|
|
return editor.destroy();
|
|
return editor.destroy();
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
@@ -91,11 +92,12 @@ describe( 'ImageStyleUI', () => {
|
|
|
}
|
|
}
|
|
|
} )
|
|
} )
|
|
|
.then( newEditor => {
|
|
.then( newEditor => {
|
|
|
- editor = newEditor;
|
|
|
|
|
-
|
|
|
|
|
- const buttonView = editor.ui.componentFactory.create( 'imageStyle:style 1' );
|
|
|
|
|
|
|
+ const buttonView = newEditor.ui.componentFactory.create( 'imageStyle:style 1' );
|
|
|
|
|
|
|
|
expect( buttonView.label ).to.equal( 'Default title' );
|
|
expect( buttonView.label ).to.equal( 'Default title' );
|
|
|
|
|
+
|
|
|
|
|
+ editorElement.remove();
|
|
|
|
|
+ return newEditor.destroy();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
@@ -113,7 +115,9 @@ describe( 'ImageStyleUI', () => {
|
|
|
} )
|
|
} )
|
|
|
.then( newEditor => {
|
|
.then( newEditor => {
|
|
|
expect( newEditor.config.get( 'image.toolbar' ) ).to.deep.equal( [ 'foo', 'bar' ] );
|
|
expect( newEditor.config.get( 'image.toolbar' ) ).to.deep.equal( [ 'foo', 'bar' ] );
|
|
|
- newEditor.destroy();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ editorElement.remove();
|
|
|
|
|
+ return newEditor.destroy();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
@@ -124,9 +128,7 @@ describe( 'ImageStyleUI', () => {
|
|
|
plugins: [ ImageStyleUI ]
|
|
plugins: [ ImageStyleUI ]
|
|
|
} )
|
|
} )
|
|
|
.then( newEditor => {
|
|
.then( newEditor => {
|
|
|
- editor = newEditor;
|
|
|
|
|
-
|
|
|
|
|
- const plugin = editor.plugins.get( ImageStyleUI );
|
|
|
|
|
|
|
+ const plugin = newEditor.plugins.get( ImageStyleUI );
|
|
|
|
|
|
|
|
expect( plugin.localizedDefaultStylesTitles ).to.deep.equal( {
|
|
expect( plugin.localizedDefaultStylesTitles ).to.deep.equal( {
|
|
|
'Full size image': 'Full size image',
|
|
'Full size image': 'Full size image',
|
|
@@ -135,6 +137,8 @@ describe( 'ImageStyleUI', () => {
|
|
|
'Centered image': 'Centered image',
|
|
'Centered image': 'Centered image',
|
|
|
'Right aligned image': 'Right aligned image'
|
|
'Right aligned image': 'Right aligned image'
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ return newEditor.destroy();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|