|
@@ -73,6 +73,16 @@ describe( 'PendingActions', () => {
|
|
|
pendingActions.add( {} );
|
|
pendingActions.add( {} );
|
|
|
} ).to.throw( CKEditorError, /^pendingactions-add-invalid-message/ );
|
|
} ).to.throw( CKEditorError, /^pendingactions-add-invalid-message/ );
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'should fire add event with added item', () => {
|
|
|
|
|
+ const spy = sinon.spy();
|
|
|
|
|
+
|
|
|
|
|
+ pendingActions.on( 'add', spy );
|
|
|
|
|
+
|
|
|
|
|
+ const action = pendingActions.add( 'Some action' );
|
|
|
|
|
+
|
|
|
|
|
+ sinon.assert.calledWith( spy, sinon.match.any, action );
|
|
|
|
|
+ } );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
describe( 'remove()', () => {
|
|
describe( 'remove()', () => {
|
|
@@ -90,6 +100,18 @@ describe( 'PendingActions', () => {
|
|
|
|
|
|
|
|
expect( pendingActions ).to.have.property( 'isPending', false );
|
|
expect( pendingActions ).to.have.property( 'isPending', false );
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'should fire remove event with removed item', () => {
|
|
|
|
|
+ const spy = sinon.spy();
|
|
|
|
|
+
|
|
|
|
|
+ pendingActions.on( 'remove', spy );
|
|
|
|
|
+
|
|
|
|
|
+ const action = pendingActions.add( 'Some action' );
|
|
|
|
|
+
|
|
|
|
|
+ pendingActions.remove( action );
|
|
|
|
|
+
|
|
|
|
|
+ sinon.assert.calledWith( spy, sinon.match.any, action );
|
|
|
|
|
+ } );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
describe( 'iterator', () => {
|
|
describe( 'iterator', () => {
|