|
@@ -22,7 +22,7 @@ import {
|
|
|
} from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
|
|
} from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
|
|
|
|
|
|
|
|
describe( 'BlockQuote integration', () => {
|
|
describe( 'BlockQuote integration', () => {
|
|
|
- let editor, model, element;
|
|
|
|
|
|
|
+ let editor, model, element, viewDocument;
|
|
|
|
|
|
|
|
beforeEach( () => {
|
|
beforeEach( () => {
|
|
|
element = document.createElement( 'div' );
|
|
element = document.createElement( 'div' );
|
|
@@ -35,6 +35,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
.then( newEditor => {
|
|
.then( newEditor => {
|
|
|
editor = newEditor;
|
|
editor = newEditor;
|
|
|
model = editor.model;
|
|
model = editor.model;
|
|
|
|
|
+ viewDocument = editor.editing.view.document;
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
@@ -57,7 +58,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
|
|
|
|
|
setModelData( model, '<paragraph>x</paragraph><paragraph>[]</paragraph><paragraph>x</paragraph>' );
|
|
setModelData( model, '<paragraph>x</paragraph><paragraph>[]</paragraph><paragraph>x</paragraph>' );
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'enter', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'enter', data );
|
|
|
|
|
|
|
|
// Only enter command should be executed.
|
|
// Only enter command should be executed.
|
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
@@ -71,7 +72,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
|
|
|
|
|
setModelData( model, '<blockQuote><paragraph>xx[]</paragraph></blockQuote>' );
|
|
setModelData( model, '<blockQuote><paragraph>xx[]</paragraph></blockQuote>' );
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'enter', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'enter', data );
|
|
|
|
|
|
|
|
// Only enter command should be executed.
|
|
// Only enter command should be executed.
|
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
@@ -85,7 +86,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
|
|
|
|
|
setModelData( model, '<blockQuote><paragraph>[]xx</paragraph></blockQuote>' );
|
|
setModelData( model, '<blockQuote><paragraph>[]xx</paragraph></blockQuote>' );
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'enter', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'enter', data );
|
|
|
|
|
|
|
|
// Only enter command should be executed.
|
|
// Only enter command should be executed.
|
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
@@ -99,7 +100,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
|
|
|
|
|
setModelData( model, '<blockQuote><paragraph>[</paragraph><paragraph>]</paragraph></blockQuote>' );
|
|
setModelData( model, '<blockQuote><paragraph>[</paragraph><paragraph>]</paragraph></blockQuote>' );
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'enter', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'enter', data );
|
|
|
|
|
|
|
|
// Only enter command should be executed.
|
|
// Only enter command should be executed.
|
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
@@ -119,7 +120,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
'<paragraph>x</paragraph>'
|
|
'<paragraph>x</paragraph>'
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'enter', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'enter', data );
|
|
|
|
|
|
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
|
|
|
|
|
@@ -139,7 +140,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
|
|
|
|
|
setModelData( model, '<paragraph>x</paragraph><blockQuote><paragraph>[]</paragraph></blockQuote><paragraph>x</paragraph>' );
|
|
setModelData( model, '<paragraph>x</paragraph><blockQuote><paragraph>[]</paragraph></blockQuote><paragraph>x</paragraph>' );
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'enter', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'enter', data );
|
|
|
|
|
|
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
|
expect( execSpy.calledOnce ).to.be.true;
|
|
expect( execSpy.calledOnce ).to.be.true;
|
|
@@ -158,7 +159,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
'<paragraph>x</paragraph>'
|
|
'<paragraph>x</paragraph>'
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'enter', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'enter', data );
|
|
|
|
|
|
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
|
expect( execSpy.calledOnce ).to.be.true;
|
|
expect( execSpy.calledOnce ).to.be.true;
|
|
@@ -183,7 +184,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
'<paragraph>x</paragraph>'
|
|
'<paragraph>x</paragraph>'
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'enter', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'enter', data );
|
|
|
|
|
|
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
expect( data.preventDefault.called ).to.be.true;
|
|
|
expect( execSpy.calledOnce ).to.be.true;
|
|
expect( execSpy.calledOnce ).to.be.true;
|
|
@@ -208,7 +209,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
'<paragraph>x</paragraph>'
|
|
'<paragraph>x</paragraph>'
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'enter', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'enter', data );
|
|
|
|
|
|
|
|
sinon.assert.calledOnce( scrollSpy );
|
|
sinon.assert.calledOnce( scrollSpy );
|
|
|
sinon.assert.callOrder( execSpy, scrollSpy );
|
|
sinon.assert.callOrder( execSpy, scrollSpy );
|
|
@@ -233,7 +234,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
'<paragraph>d</paragraph>'
|
|
'<paragraph>d</paragraph>'
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'delete', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'delete', data );
|
|
|
|
|
|
|
|
expect( getModelData( model ) ).to.equal(
|
|
expect( getModelData( model ) ).to.equal(
|
|
|
'<blockQuote><paragraph>a</paragraph><paragraph>b[]c</paragraph></blockQuote>' +
|
|
'<blockQuote><paragraph>a</paragraph><paragraph>b[]c</paragraph></blockQuote>' +
|
|
@@ -250,7 +251,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
'<paragraph>y</paragraph>'
|
|
'<paragraph>y</paragraph>'
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'delete', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'delete', data );
|
|
|
|
|
|
|
|
expect( getModelData( model ) ).to.equal(
|
|
expect( getModelData( model ) ).to.equal(
|
|
|
'<paragraph>x[]a</paragraph>' +
|
|
'<paragraph>x[]a</paragraph>' +
|
|
@@ -269,7 +270,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
'<paragraph>y</paragraph>'
|
|
'<paragraph>y</paragraph>'
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'delete', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'delete', data );
|
|
|
|
|
|
|
|
expect( getModelData( model ) ).to.equal(
|
|
expect( getModelData( model ) ).to.equal(
|
|
|
'<paragraph>x</paragraph>' +
|
|
'<paragraph>x</paragraph>' +
|
|
@@ -288,7 +289,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
'<paragraph>y</paragraph>'
|
|
'<paragraph>y</paragraph>'
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'delete', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'delete', data );
|
|
|
|
|
|
|
|
expect( getModelData( model ) ).to.equal(
|
|
expect( getModelData( model ) ).to.equal(
|
|
|
'<paragraph>x</paragraph>' +
|
|
'<paragraph>x</paragraph>' +
|
|
@@ -306,7 +307,7 @@ describe( 'BlockQuote integration', () => {
|
|
|
'<paragraph>y</paragraph>'
|
|
'<paragraph>y</paragraph>'
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- editor.editing.view.fire( 'delete', data );
|
|
|
|
|
|
|
+ viewDocument.fire( 'delete', data );
|
|
|
|
|
|
|
|
expect( getModelData( model ) ).to.equal(
|
|
expect( getModelData( model ) ).to.equal(
|
|
|
'<paragraph>x[]</paragraph>' +
|
|
'<paragraph>x[]</paragraph>' +
|