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

Commit

Permalink
Merge pull request #1511 from ckeditor/t/ckeditor5/1218
Browse files Browse the repository at this point in the history
Tests: Fixed failing tests after upgrading Sinon. See ckeditor/ckeditor5#1218.
  • Loading branch information
pomek authored Aug 24, 2018
2 parents 6de6a00 + 57ed24c commit 3eb66fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
13 changes: 6 additions & 7 deletions tests/dev-utils/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ import Position from '../../src/model/position';
import count from '@ckeditor/ckeditor5-utils/src/count';

describe( 'model test utils', () => {
let model, document, root, selection, sandbox;
let model, document, root, selection;

beforeEach( () => {
model = new Model();
document = model.document;
root = document.createRoot();
selection = document.selection;
sandbox = sinon.sandbox.create();

model.change( writer => {
writer.setSelection( null );
Expand Down Expand Up @@ -51,12 +50,12 @@ describe( 'model test utils', () => {
} );

afterEach( () => {
sandbox.restore();
sinon.restore();
} );

describe( 'getData', () => {
it( 'should use stringify method', () => {
const stringifySpy = sandbox.spy( getData, '_stringify' );
const stringifySpy = sinon.spy( getData, '_stringify' );
root._appendChild( new Element( 'b', null, new Text( 'btext' ) ) );

expect( getData( model, { withoutSelection: true } ) ).to.equal( '<b>btext</b>' );
Expand All @@ -65,7 +64,7 @@ describe( 'model test utils', () => {
} );

it( 'should use stringify method with selection', () => {
const stringifySpy = sandbox.spy( getData, '_stringify' );
const stringifySpy = sinon.spy( getData, '_stringify' );
root._appendChild( new Element( 'b', null, new Text( 'btext' ) ) );
model.change( writer => {
writer.setSelection( Range.createFromParentsAndOffsets( root, 0, root, 1 ) );
Expand All @@ -84,7 +83,7 @@ describe( 'model test utils', () => {

describe( 'setData', () => {
it( 'should use parse method', () => {
const parseSpy = sandbox.spy( setData, '_parse' );
const parseSpy = sinon.spy( setData, '_parse' );
const options = {};
const data = '<b>btext</b>text';

Expand All @@ -97,7 +96,7 @@ describe( 'model test utils', () => {
} );

it( 'should use parse method with selection', () => {
const parseSpy = sandbox.spy( setData, '_parse' );
const parseSpy = sinon.spy( setData, '_parse' );
const options = {};
const data = '[<b>btext</b>]';

Expand Down
16 changes: 5 additions & 11 deletions tests/dev-utils/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,14 @@ import createViewRoot from '../view/_utils/createroot';

describe( 'view test utils', () => {
describe( 'getData, setData', () => {
let sandbox;

beforeEach( () => {
sandbox = sinon.sandbox.create();
} );

afterEach( () => {
sandbox.restore();
sinon.restore();
} );

describe( 'getData', () => {
it( 'should use stringify method', () => {
const element = document.createElement( 'div' );
const stringifySpy = sandbox.spy( getData, '_stringify' );
const stringifySpy = sinon.spy( getData, '_stringify' );
const view = new View();
const viewDocument = view.document;
const options = {
Expand All @@ -62,7 +56,7 @@ describe( 'view test utils', () => {

it( 'should use stringify method with selection', () => {
const element = document.createElement( 'div' );
const stringifySpy = sandbox.spy( getData, '_stringify' );
const stringifySpy = sinon.spy( getData, '_stringify' );
const view = new View();
const viewDocument = view.document;
const options = { showType: false, showPriority: false };
Expand Down Expand Up @@ -97,7 +91,7 @@ describe( 'view test utils', () => {
const view = new View();
const viewDocument = view.document;
const data = 'foobar<b>baz</b>';
const parseSpy = sandbox.spy( setData, '_parse' );
const parseSpy = sinon.spy( setData, '_parse' );

createAttachedRoot( viewDocument, document.createElement( 'div' ) );
setData( view, data );
Expand All @@ -116,7 +110,7 @@ describe( 'view test utils', () => {
const view = new View();
const viewDocument = view.document;
const data = '[<b>baz</b>]';
const parseSpy = sandbox.spy( setData, '_parse' );
const parseSpy = sinon.spy( setData, '_parse' );

createAttachedRoot( viewDocument, document.createElement( 'div' ) );
setData( view, data );
Expand Down

0 comments on commit 3eb66fa

Please sign in to comment.