|
@@ -60,20 +60,35 @@ describe( 'Creator', () => {
|
|
|
expect( pluginSpy.called ).to.be.true;
|
|
expect( pluginSpy.called ).to.be.true;
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
- it( 'should destroy the UI', () => {
|
|
|
|
|
- const uiSpy = sinon.stub().returns( new Promise( () => {} ) );
|
|
|
|
|
|
|
+ it( 'should destroy the UI (sync)', () => {
|
|
|
|
|
+ const uiSpy = sinon.spy();
|
|
|
|
|
|
|
|
editor.ui = {
|
|
editor.ui = {
|
|
|
destroy: uiSpy
|
|
destroy: uiSpy
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- creator.destroy();
|
|
|
|
|
|
|
+ return creator.destroy()
|
|
|
|
|
+ .then( () => {
|
|
|
|
|
+ expect( uiSpy.called ).to.be.true;
|
|
|
|
|
+ expect( editor.ui ).to.be.null;
|
|
|
|
|
+ } );
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'should destroy the UI (async)', () => {
|
|
|
|
|
+ const uiSpy = sinon.stub().returns( Promise.resolve() );
|
|
|
|
|
|
|
|
- expect( uiSpy.called ).to.be.true;
|
|
|
|
|
- expect( editor.ui ).to.be.null;
|
|
|
|
|
|
|
+ editor.ui = {
|
|
|
|
|
+ destroy: uiSpy
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ return creator.destroy()
|
|
|
|
|
+ .then( () => {
|
|
|
|
|
+ expect( uiSpy.called ).to.be.true;
|
|
|
|
|
+ expect( editor.ui ).to.be.null;
|
|
|
|
|
+ } );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
- it( 'should wait until UI is destroyed', () => {
|
|
|
|
|
|
|
+ it( 'should wait until UI is destroyed (async)', () => {
|
|
|
let resolved = false;
|
|
let resolved = false;
|
|
|
let resolve;
|
|
let resolve;
|
|
|
const uiSpy = sinon.stub().returns(
|
|
const uiSpy = sinon.stub().returns(
|