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 #62 from ckeditor/t/ckeditor5-engine/1207
Browse files Browse the repository at this point in the history
Tests: Changes required by refactoring in ckeditor5-engine.
  • Loading branch information
Piotr Jasiun committed Jan 11, 2018
2 parents fb76fd4 + 2247a3e commit 46ac689
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tests/attributecommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ describe( 'AttributeCommand', () => {
} );

it( 'is false when selection does not have the attribute', () => {
model.change( () => {
doc.selection.setAttribute( attrKey, true );
} );

model.change( () => {
doc.selection.removeAttribute( attrKey );
} );
Expand Down Expand Up @@ -269,7 +273,7 @@ describe( 'AttributeCommand', () => {
expect( getData( model ) ).to.equal( '<p>a[<$text bold="true">bcfo]obar</$text>xyz</p>' );
} );

describe( 'should cause firing model document changesDone event', () => {
describe( 'should cause firing model change event', () => {
let spy;

beforeEach( () => {
Expand All @@ -279,31 +283,31 @@ describe( 'AttributeCommand', () => {
it( 'collapsed selection in non-empty parent', () => {
setData( model, '<p>x[]y</p>' );

doc.on( 'changesDone', spy );
model.document.on( 'change', spy );

command.execute();

expect( spy.calledOnce ).to.be.true;
expect( spy.called ).to.be.true;
} );

it( 'non-collapsed selection', () => {
setData( model, '<p>[xy]</p>' );

doc.on( 'changesDone', spy );
model.document.on( 'change', spy );

command.execute();

expect( spy.calledOnce ).to.be.true;
expect( spy.called ).to.be.true;
} );

it( 'in empty parent', () => {
setData( model, '<p>[]</p>' );

doc.on( 'changesDone', spy );
model.document.on( 'change', spy );

command.execute();

expect( spy.calledOnce ).to.be.true;
expect( spy.called ).to.be.true;
} );
} );
} );
Expand Down

0 comments on commit 46ac689

Please sign in to comment.