Skip to content

Commit

Permalink
Tests improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dumluregn committed Jul 28, 2023
1 parent b11ca0c commit 044ca7e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/ckeditor5-find-and-replace/tests/replaceallcommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe( 'ReplaceAllCommand', () => {
expect( getData( editor.model, { withoutSelection: true } ) ).to.equal( '<paragraph>Aaa Boo Coo Daa</paragraph>' );
} );

it( 'should one undo step restore every text occurrences replaced by `replace all` in the document at once.', () => {
it( 'should restore every text occurrences replaced by `replace all` in the document at one undo step', () => {
setData( model, '<paragraph>Foo bar baz</paragraph><paragraph>Foo bar baz</paragraph><paragraph>Foo bar baz</paragraph>' );

editor.execute( 'replaceAll', 'new', 'bar' );
Expand All @@ -167,7 +167,7 @@ describe( 'ReplaceAllCommand', () => {
expect( editor.getData() ).to.equal( '<p>Foo bar baz</p><p>Foo bar baz</p><p>Foo bar baz</p>' );
} );

it( 'should one undo step restore every text occurrences replaced by `replace all` in multiple roots at once.', async () => {
it( 'should restore every text occurrences replaced by `replace all` in multiple roots at one undo step', async () => {
class MultiRootEditor extends ModelTestEditor {
constructor( config ) {
super( config );
Expand All @@ -179,20 +179,20 @@ describe( 'ReplaceAllCommand', () => {
const multiRootEditor = await MultiRootEditor
.create( { plugins: [ FindAndReplaceEditing, Paragraph, UndoEditing ] } );

setData( multiRootEditor.model, '<paragraph>Foo bar baz</paragraph>' );
setData( multiRootEditor.model, '<paragraph>Foo bar baz</paragraph>', { rootName: 'second' } );
setData( multiRootEditor.model, '<paragraph>Foo bar baz</paragraph>', { rootName: 'main' } );
setData( multiRootEditor.model, '<paragraph>Ra baz baz</paragraph>', { rootName: 'second' } );

const { results } = multiRootEditor.execute( 'find', 'z' );

multiRootEditor.execute( 'replaceAll', 'r', results );

expect( multiRootEditor.getData() ).to.equal( '<p>Foo bar bar</p>' );
expect( multiRootEditor.getData( { rootName: 'second' } ) ).to.equal( '<p>Foo bar bar</p>' );
expect( multiRootEditor.getData( { rootName: 'main' } ) ).to.equal( '<p>Foo bar bar</p>' );
expect( multiRootEditor.getData( { rootName: 'second' } ) ).to.equal( '<p>Ra bar bar</p>' );

multiRootEditor.execute( 'undo' );

expect( multiRootEditor.getData() ).to.equal( '<p>Foo bar baz</p>' );
expect( multiRootEditor.getData( { rootName: 'second' } ) ).to.equal( '<p>Foo bar baz</p>' );
expect( multiRootEditor.getData( { rootName: 'main' } ) ).to.equal( '<p>Foo bar baz</p>' );
expect( multiRootEditor.getData( { rootName: 'second' } ) ).to.equal( '<p>Ra baz baz</p>' );

await multiRootEditor.destroy();
} );
Expand Down

0 comments on commit 044ca7e

Please sign in to comment.