|
@@ -30,6 +30,12 @@ beforeEach( () => {
|
|
|
command = new Command( editor );
|
|
command = new Command( editor );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
|
|
+afterEach( () => {
|
|
|
|
|
+ // Might be redundant if editor destroys the commands.
|
|
|
|
|
+ command.destroy();
|
|
|
|
|
+ editor.destroy();
|
|
|
|
|
+} );
|
|
|
|
|
+
|
|
|
describe( 'constructor', () => {
|
|
describe( 'constructor', () => {
|
|
|
it( 'should create a new command instance, that is enabled and bound to given editor', () => {
|
|
it( 'should create a new command instance, that is enabled and bound to given editor', () => {
|
|
|
expect( command ).to.have.property( 'editor' ).equal( editor );
|
|
expect( command ).to.have.property( 'editor' ).equal( editor );
|
|
@@ -59,6 +65,16 @@ describe( 'constructor', () => {
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
|
|
+describe( 'destroy', () => {
|
|
|
|
|
+ it( 'should stop listening', () => {
|
|
|
|
|
+ sinon.spy( command, 'stopListening' );
|
|
|
|
|
+
|
|
|
|
|
+ command.destroy();
|
|
|
|
|
+
|
|
|
|
|
+ expect( command.stopListening.calledOnce ).to.be.true;
|
|
|
|
|
+ } );
|
|
|
|
|
+} );
|
|
|
|
|
+
|
|
|
describe( 'refreshState', () => {
|
|
describe( 'refreshState', () => {
|
|
|
it( 'should fire refreshState event', () => {
|
|
it( 'should fire refreshState event', () => {
|
|
|
let spy = sinon.spy();
|
|
let spy = sinon.spy();
|