Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Removed testing stubs as these stubs will not catch anything in the n…
Browse files Browse the repository at this point in the history
…on-debug mode.
  • Loading branch information
ma2ciek committed Sep 19, 2019
1 parent 4734f18 commit 13b5f16
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
5 changes: 2 additions & 3 deletions tests/model/documentselection.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,14 +600,13 @@ describe( 'DocumentSelection', () => {
} );

it( 'should do nothing when trying to set selection to the graveyard', () => {
const consoleWarnStub = sinon.stub( console, 'warn' );
// Catches the 'Trying to add a Range that is in the graveyard root. Range rejected.' warning in the CK_DEBUG mode.
sinon.stub( console, 'warn' );

const range = new Range( new Position( model.document.graveyard, [ 0 ] ) );
selection._setTo( range );

expect( selection._ranges ).to.deep.equal( [] );
sinon.assert.calledOnce( consoleWarnStub );
sinon.assert.calledWith( consoleWarnStub, 'Trying to add a Range that is in the graveyard root. Range rejected.' );
} );

it( 'should detach removed ranges', () => {
Expand Down
5 changes: 2 additions & 3 deletions tests/model/operation/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ describe( 'transform', () => {
};

it( 'should throw an error when one of operations is invalid', () => {
const consoleWarnStub = sinon.stub( console, 'warn' );
// Catches the 'Error during operation transformation!' warning in the CK_DEBUG mode.
sinon.stub( console, 'warn' );

const nodeA = new Node();
const nodeB = new Node();
Expand All @@ -85,8 +86,6 @@ describe( 'transform', () => {
baRelation: null
} );
} ).to.throw( TypeError );

sinon.assert.calledWith( consoleWarnStub, 'Error during operation transformation!' );
} );

describe( 'InsertOperation', () => {
Expand Down
10 changes: 3 additions & 7 deletions tests/view/observer/selectionobserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,16 @@ describe( 'SelectionObserver', () => {
} );

const selectionChangeSpy = sinon.spy();
const consoleWarnStub = sinon.stub( console, 'warn' );

// Catches the "Selection change observer detected an infinite rendering loop." warning in the CK_DEBUG mode.
sinon.stub( console, 'warn' );

viewDocument.on( 'selectionChange', selectionChangeSpy );

return new Promise( resolve => {
viewDocument.on( 'selectionChangeDone', () => {
expect( selectionChangeSpy.callCount ).to.equal( 60 );

sinon.assert.called( consoleWarnStub );
sinon.assert.calledWith(
consoleWarnStub,
'Selection change observer detected an infinite rendering loop.'
);

resolve();
} );

Expand Down
6 changes: 2 additions & 4 deletions tests/view/view/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,16 +473,14 @@ describe( 'view', () => {
} );

it( 'should not crash when there is no selection', () => {
const consoleWarnStub = sinon.stub( console, 'warn' );
// Catches the `There is no selection in any editable to focus.` warning in the CK_DEBUG mode.
sinon.stub( console, 'warn' );

view.change( writer => {
writer.setSelection( null );
} );

view.focus();

sinon.assert.calledOnce( consoleWarnStub );
sinon.assert.calledWith( consoleWarnStub, 'There is no selection in any editable to focus.' );
} );
} );

Expand Down

0 comments on commit 13b5f16

Please sign in to comment.