diff --git a/packages/ckeditor5-admonition/tests/blockquote.js b/packages/ckeditor5-admonition/tests/blockquote.js
deleted file mode 100644
index 722525bff..000000000
--- a/packages/ckeditor5-admonition/tests/blockquote.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
-
-import BlockQuote from '../src/blockquote.js';
-import BlockQuoteEditing from '../src/blockquoteediting.js';
-import BlockQuoteUI from '../src/blockquoteui.js';
-
-describe( 'BlockQuote', () => {
- it( 'requires BlockQuoteEditing and BlockQuoteUI', () => {
- expect( BlockQuote.requires ).to.deep.equal( [ BlockQuoteEditing, BlockQuoteUI ] );
- } );
-} );
diff --git a/packages/ckeditor5-admonition/tests/blockquotecommand.js b/packages/ckeditor5-admonition/tests/blockquotecommand.js
deleted file mode 100644
index 08a8197bc..000000000
--- a/packages/ckeditor5-admonition/tests/blockquotecommand.js
+++ /dev/null
@@ -1,648 +0,0 @@
-/**
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
-
-import BlockQuoteEditing from '../src/blockquoteediting.js';
-import BlockQuoteCommand from '../src/blockquotecommand.js';
-
-import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor.js';
-import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model.js';
-import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view.js';
-
-import Command from '@ckeditor/ckeditor5-core/src/command.js';
-
-describe( 'BlockQuoteCommand', () => {
- let editor, model, command;
-
- beforeEach( () => {
- return VirtualTestEditor
- .create( {
- plugins: [ BlockQuoteEditing ]
- } )
- .then( newEditor => {
- editor = newEditor;
-
- model = editor.model;
-
- model.schema.register( 'paragraph', { inheritAllFrom: '$block' } );
- model.schema.register( 'heading', { inheritAllFrom: '$block' } );
- model.schema.register( 'widget' );
-
- model.schema.extend( 'widget', {
- allowIn: '$root',
- allowChildren: '$text',
- isLimit: true,
- isObject: true
- } );
-
- editor.conversion.for( 'downcast' ).elementToElement( { model: 'paragraph', view: 'p' } );
- editor.conversion.for( 'downcast' ).elementToElement( { model: 'heading', view: 'h' } );
- editor.conversion.for( 'downcast' ).elementToElement( { model: 'widget', view: 'widget' } );
-
- command = editor.commands.get( 'blockQuote' );
- } );
- } );
-
- afterEach( async () => {
- await editor.destroy();
- } );
-
- it( 'is a command', () => {
- expect( BlockQuoteCommand.prototype ).to.be.instanceOf( Command );
- expect( command ).to.be.instanceOf( Command );
- } );
-
- describe( 'value', () => {
- it( 'is false when selection is not in a block quote', () => {
- setModelData( model, '
' ); - - expect( command ).to.have.property( 'value', false ); - } ); - - it( 'is false when selection starts in a blockless space', () => { - model.schema.extend( '$text', { allowIn: '$root' } ); - - setModelData( model, 'x[]x' ); - - expect( command ).to.have.property( 'value', false ); - } ); - - it( 'is true when selection is in a block quote', () => { - setModelData( model, 'y]y
' ); - - expect( command ).to.have.property( 'value', true ); - } ); - - it( 'is true when selection starts in a block quote', () => { - setModelData( model, 'x[]x
x[x
' ); - - expect( command ).to.have.property( 'isEnabled', true ); - } ); - - it( 'is true when selection starts in a block which can be wrapped with blockQuote', () => { - setModelData( model, 'x[]x
' + - 'x[]x
abc
x{}x
def
' - ); - } ); - - it( 'should wrap multiple blocks', () => { - setModelData( - model, - '' + - '' - ); - - expect( getViewData( editor.editing.view ) ).to.equal( - 'a[bc ' + - 'xx ' + - 'de]f ' + - '
' - ); - } ); - - it( 'should merge with an existing quote', () => { - setModelData( - model, - 'a{bc xx
de}f
' + - 'x]x yy
' + - '' + - 'abc ' + - '[x]x ' + - 'yy ' + - '
abc {x}x
yy
def
' - ); - } ); - - it( 'should not merge with a quote preceding the current block', () => { - setModelData( - model, - '' + - 'abc
' + - 'abc
' - ); - - expect( getViewData( editor.editing.view ) ).to.equal( - 'x[]x
' + - 'abc
' - ); - } ); - - it( 'should not merge with a quote following the current block', () => { - setModelData( - model, - 'x{}x
' - ); - - editor.execute( 'blockQuote' ); - - expect( getModelData( model ) ).to.equal( - 'abc
' + - 'x[]x
' - ); - - expect( getViewData( editor.editing.view ) ).to.equal( - 'abc
' + - 'x{}x
' - ); - } ); - - it( 'should merge with an existing quote (more blocks)', () => { - setModelData( - model, - 'abc
' + - 'x]x
' + - '' + - 'abc ' + - 'def ' + - '[x]x ' + - '
abc def
{x}x
ghi
' - ); - } ); - - it( 'should not wrap non-block content', () => { - setModelData( - model, - '' + - '' + - '[abc ' + - '
' + - '' - ); - - // Selection incorrectly trimmed. - expect( getViewData( editor.editing.view ) ).to.equal( - 'de]f ' + - '
[abc
' - ); - } ); - - it( 'should correctly wrap and merge groups of blocks', () => { - setModelData( - model, - 'de}f
' + - 'ghi
' + - '[abc
' + - 'def ghi
' - ); - - // Selection incorrectly trimmed. - expect( getViewData( editor.editing.view ) ).to.equal( - 'jk]l
' + - '[abc
' + - 'def
ghi
' - ); - } ); - - it( 'should correctly merge a couple of subsequent quotes', () => { - setModelData( - model, - 'jk}l
' + - 'def
' + - 'jkl
' + - '' + - 'abc ' + - 'def ' + - 'ghi ' + - 'jkl ' + - '[mn]o ' + - '
x
' + - '' + - '' + - 'abc
' + - 'def
' + - 'ghi
' + - 'jkl
' + - '{mn}o
' + - '
y
' - ); - } ); - - it( 'should not wrap a block which can not be in a quote', () => { - // blockQuote is allowed in root, but fooBlock can not be inside blockQuote. - model.schema.register( 'fooBlock', { inheritAllFrom: '$block' } ); - model.schema.addChildCheck( ( ctx, childDef ) => { - if ( ctx.endsWith( 'blockQuote' ) && childDef.name == 'fooBlock' ) { - return false; - } - } ); - - editor.conversion.for( 'downcast' ).elementToElement( { model: 'fooBlock', view: 'fooblock' } ); - - setModelData( - model, - '' + - '' + - 'abc ' + - '
' + - '' - ); - } ); - - it( 'should not wrap a block which parent does not allow quote inside itself', () => { - // blockQuote is not be allowed in fooWrapper, but fooBlock can be inside blockQuote. - model.schema.register( 'fooWrapper' ); - model.schema.register( 'fooBlock', { inheritAllFrom: '$block' } ); - - model.schema.extend( 'fooWrapper', { allowIn: '$root' } ); - model.schema.extend( 'fooBlock', { allowIn: 'fooWrapper' } ); - - editor.conversion.for( 'downcast' ).elementToElement( { model: 'fooWrapper', view: 'foowrapper' } ); - editor.conversion.for( 'downcast' ).elementToElement( { model: 'fooBlock', view: 'fooblock' } ); - - setModelData( - model, - 'de]f ' + - '
' + - '' + - 'abc ' + - '
' + - '' - ); - } ); - - it( 'should handle forceValue = true param', () => { - setModelData( - model, - 'de]f ' + - '
' + - '' + - 'x[x ' + - '
' + - '' - ); - - expect( getViewData( editor.editing.view ) ).to.equal( - 'x[x ' + - 'd]ef ' + - '
' - ); - } ); - } ); - - describe( 'removing quote', () => { - it( 'should unwrap a single block', () => { - setModelData( - model, - 'x{x
d}ef
' + - 'x[]x
abc
x{}x
def
' - ); - } ); - - it( 'should unwrap multiple blocks', () => { - setModelData( - model, - '' + - '' - ); - - editor.execute( 'blockQuote' ); - - expect( getModelData( model ) ).to.equal( - 'a[bc ' + - 'xx ' + - 'de]f ' + - '
a{bc
xx
de}f
' - ); - } ); - - it( 'should unwrap only the selected blocks - at the beginning', () => { - setModelData( - model, - '' + - '' + - 'a[b]c ' + - 'xx ' + - '
' + - '' + - 'xx ' + - '
xx
a{b}c
xx
yy
' - ); - } ); - - it( 'should unwrap only the selected blocks - at the end', () => { - setModelData( - model, - '' + - '' + - 'abc ' + - 'x[x ' + - '
' + - '' + - 'abc ' + - '
abc
x{x
de}f
' - ); - } ); - - it( 'should unwrap only the selected blocks - in the middle', () => { - setModelData( - model, - '' + - '' + - 'abc ' + - 'c[]de ' + - 'fgh ' + - '
' + - 'abc
' + - 'fgh
xx
' + - '' + - 'abc
c{}de
' + - '' + - 'fgh
xx
' - ); - } ); - - it( 'should remove multiple quotes', () => { - setModelData( - model, - '' + - 'a[bc
' + - 'def ghi
' - ); - - editor.execute( 'blockQuote' ); - - expect( getModelData( model ) ).to.equal( - 'de]f ghi
' - ); - - expect( getViewData( editor.editing.view ) ).to.equal( - 'ghi
a{bc
' + - 'xx
' + - 'def
ghi
' + - 'yy
' + - 'de}f
' + - '' - ); - } ); - - it( 'should handle forceValue = false param', () => { - setModelData( - model, - 'ghi
' + - '' - ); - - editor.execute( 'blockQuote', { forceValue: false } ); - - // Incorrect selection. - expect( getModelData( model ) ).to.equal( - 'x]x ' + - '
a{bc}
xx
' - ); - } ); - } ); - } ); -} ); diff --git a/packages/ckeditor5-admonition/tests/blockquoteediting.js b/packages/ckeditor5-admonition/tests/blockquoteediting.js deleted file mode 100644 index 54a0ea821..000000000 --- a/packages/ckeditor5-admonition/tests/blockquoteediting.js +++ /dev/null @@ -1,196 +0,0 @@ -/** - * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. - * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license - */ - -import BlockQuoteEditing from '../src/blockquoteediting.js'; -import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph.js'; -import ListEditing from '@ckeditor/ckeditor5-list/src/list/listediting.js'; -import BoldEditing from '@ckeditor/ckeditor5-basic-styles/src/bold/boldediting.js'; - -import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor.js'; -import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model.js'; - -import BlockQuoteCommand from '../src/blockquotecommand.js'; - -describe( 'BlockQuoteEditing', () => { - let editor, model; - - beforeEach( () => { - return VirtualTestEditor - .create( { - plugins: [ BlockQuoteEditing, Paragraph, BoldEditing ] - } ) - .then( newEditor => { - editor = newEditor; - model = editor.model; - } ); - } ); - - afterEach( () => { - return editor.destroy(); - } ); - - it( 'should have pluginName', () => { - expect( BlockQuoteEditing.pluginName ).to.equal( 'BlockQuoteEditing' ); - } ); - - it( 'adds a blockQuote command', () => { - expect( editor.commands.get( 'blockQuote' ) ).to.be.instanceOf( BlockQuoteCommand ); - } ); - - it( 'allows for blockQuote in the $root', () => { - expect( model.schema.checkChild( [ '$root' ], 'blockQuote' ) ).to.be.true; - } ); - - it( 'allows for $block in blockQuote', () => { - expect( model.schema.checkChild( [ '$root', 'blockQuote' ], '$block' ) ).to.be.true; - expect( model.schema.checkChild( [ '$root', 'blockQuote' ], 'paragraph' ) ).to.be.true; - } ); - - it( 'allows for blockQuote in blockQuote', () => { - expect( model.schema.checkChild( [ '$root', 'blockQuote' ], 'blockQuote' ) ).to.be.true; - } ); - - it( 'does not break when checking an unregisterd item', () => { - expect( model.schema.checkChild( [ '$root', 'blockQuote' ], 'foo' ) ).to.be.false; - } ); - - it( 'inherits attributes from $container', () => { - model.schema.extend( '$container', { - allowAttributes: 'foo' - } ); - - expect( model.schema.checkAttribute( 'blockQuote', 'foo' ) ).to.be.true; - } ); - - it( 'adds converters to the data pipeline', () => { - const data = ''; - - editor.setData( data ); - - expect( getModelData( model ) ).to.equal( 'x
' ); - expect( editor.getData() ).to.equal( data ); - } ); - - it( 'adds a converter to the view pipeline', () => { - setModelData( model, '[]x
' ); - - expect( editor.getData() ).to.equal( 'x
' ); - } ); - - it( 'allows list items inside blockQuote', () => { - return VirtualTestEditor - .create( { - plugins: [ BlockQuoteEditing, Paragraph, ListEditing ] - } ) - .then( editor => { - editor.setData( 'x
' ); - - expect( editor.getData() ).to.equal( '
- xx
' ); - - return editor.destroy(); - } ); - } ); - - it( 'should remove empty blockQuote elements', () => { - setModelData( model, '
- xx
Foo
' ); - } ); - - it( 'should remove blockQuotes which became empty', () => { - setModelData( model, '' ); - - model.change( writer => { - const root = model.document.getRoot(); - const bq = root.getChild( 0 ); - - writer.remove( writer.createRangeIn( bq ) ); - } ); - - expect( editor.getData( { trim: 'none' } ) ).to.equal( 'Foo
' ); // Autoparagraphed. - } ); - - it( 'should not unwrap a blockQuote if it was inserted into another blockQuote', () => { - setModelData( model, '
' ); - - model.change( writer => { - const root = model.document.getRoot(); - const bq = writer.createElement( 'blockQuote' ); - const p = writer.createElement( 'paragraph' ); - - writer.insertText( 'Bar', p, 0 ); //Foo
Bar
. - writer.insert( p, bq, 0 ); //. - writer.insert( bq, root.getChild( 0 ), 1 ); // Insert afterBar
Foo
. - } ); - - expect( editor.getData() ).to.equal( '' ); - } ); - - it( 'should not unwrap nested blockQuote if it was wrapped into another blockQuote', () => { - setModelData( model, 'Foo
Bar
Foo
' ); - } ); - - it( 'postfixer should do nothing on attribute change', () => { - // This is strictly a 100% CC test. - setModelData( model, 'Foo
Bar
' ); - - model.change( writer => { - const root = model.document.getRoot(); - const p = root.getChild( 0 ).getChild( 0 ); - - writer.setAttribute( 'bold', true, writer.createRangeIn( p ) ); - } ); - - expect( editor.getData() ).to.equal( 'Foo
' ); - } ); - - describe( 'nested blockQuote forbidden by custom rule', () => { - // Nested block quotes are supported since https://github.com/ckeditor/ckeditor5/issues/9210, so let's check - // if the editor will not blow up in case nested block quotes are forbidden by custom scheme rule. - beforeEach( () => { - model.schema.addChildCheck( ( ctx, childDef ) => { - if ( ctx.endsWith( 'blockQuote' ) && childDef.name == 'blockQuote' ) { - return false; - } - } ); - } ); - - it( 'should unwrap a blockQuote if it was inserted into another blockQuote', () => { - setModelData( model, 'Foo
' ); - - model.change( writer => { - const root = model.document.getRoot(); - const bq = writer.createElement( 'blockQuote' ); - const p = writer.createElement( 'paragraph' ); - - writer.insertText( 'Bar', p, 0 ); //Foo
Bar
. - writer.insert( p, bq, 0 ); //. - writer.insert( bq, root.getChild( 0 ), 1 ); // Insert afterBar
Foo
. - } ); - - expect( editor.getData() ).to.equal( '' ); - } ); - - it( 'should unwrap nested blockQuote if it was wrapped into another blockQuote', () => { - setModelData( model, 'Foo
Bar
Foo
' ); - } ); - } ); -} ); diff --git a/packages/ckeditor5-admonition/tests/blockquoteui.js b/packages/ckeditor5-admonition/tests/blockquoteui.js deleted file mode 100644 index e7fe92bb1..000000000 --- a/packages/ckeditor5-admonition/tests/blockquoteui.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. - * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license - */ - -/* global document */ - -import BlockQuoteEditing from '../src/blockquoteediting.js'; -import BlockQuoteUI from '../src/blockquoteui.js'; - -import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor.js'; - -describe( 'BlockQuoteUI', () => { - let editor, command, element, button; - - beforeEach( () => { - element = document.createElement( 'div' ); - document.body.appendChild( element ); - - return ClassicTestEditor - .create( element, { - plugins: [ BlockQuoteEditing, BlockQuoteUI ] - } ) - .then( newEditor => { - editor = newEditor; - command = editor.commands.get( 'blockQuote' ); - } ); - } ); - - afterEach( () => { - element.remove(); - - return editor.destroy(); - } ); - - describe( 'toolbar block quote button', () => { - beforeEach( () => { - button = editor.ui.componentFactory.create( 'blockQuote' ); - } ); - - it( 'has the base properties', () => { - expect( button ).to.have.property( 'label', 'Block quote' ); - expect( button ).to.have.property( 'icon' ); - expect( button ).to.have.property( 'tooltip', true ); - expect( button ).to.have.property( 'isToggleable', true ); - } ); - - it( 'has isOn bound to command\'s value', () => { - command.value = false; - expect( button ).to.have.property( 'isOn', false ); - - command.value = true; - expect( button ).to.have.property( 'isOn', true ); - } ); - - testButton(); - } ); - - describe( 'menu bar block quote button', () => { - beforeEach( () => { - button = editor.ui.componentFactory.create( 'menuBar:blockQuote' ); - } ); - - it( 'has the base properties', () => { - expect( button ).to.have.property( 'label', 'Block quote' ); - expect( button ).to.have.property( 'icon' ); - expect( button ).to.have.property( 'isToggleable', true ); - } ); - - testButton(); - } ); - - function testButton() { - it( 'has isEnabled bound to command\'s isEnabled', () => { - command.isEnabled = true; - expect( button ).to.have.property( 'isEnabled', true ); - - command.isEnabled = false; - expect( button ).to.have.property( 'isEnabled', false ); - } ); - - it( 'executes command when it\'s executed', () => { - const spy = sinon.stub( editor, 'execute' ); - - button.fire( 'execute' ); - - expect( spy.calledOnce ).to.be.true; - expect( spy.args[ 0 ][ 0 ] ).to.equal( 'blockQuote' ); - } ); - } -} ); diff --git a/packages/ckeditor5-admonition/tests/integration.js b/packages/ckeditor5-admonition/tests/integration.js deleted file mode 100644 index 1146dedc3..000000000 --- a/packages/ckeditor5-admonition/tests/integration.js +++ /dev/null @@ -1,830 +0,0 @@ -/** - * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. - * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license - */ - -/* global document */ - -import BlockQuote from '../src/blockquote.js'; -import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph.js'; -import Image from '@ckeditor/ckeditor5-image/src/image.js'; -import ImageCaption from '@ckeditor/ckeditor5-image/src/imagecaption.js'; -import LegacyList from '@ckeditor/ckeditor5-list/src/legacylist.js'; -import Enter from '@ckeditor/ckeditor5-enter/src/enter.js'; -import Delete from '@ckeditor/ckeditor5-typing/src/delete.js'; -import Heading from '@ckeditor/ckeditor5-heading/src/heading.js'; -import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold.js'; -import Table from '@ckeditor/ckeditor5-table/src/table.js'; - -import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor.js'; -import { - parse as parseModel, - getData as getModelData, - setData as setModelData -} from '@ckeditor/ckeditor5-engine/src/dev-utils/model.js'; - -describe( 'BlockQuote integration', () => { - let editor, model, element, viewDocument; - - beforeEach( () => { - element = document.createElement( 'div' ); - document.body.appendChild( element ); - - return ClassicTestEditor - .create( element, { - plugins: [ BlockQuote, Paragraph, Bold, Image, ImageCaption, LegacyList, Enter, Delete, Heading, Table ] - } ) - .then( newEditor => { - editor = newEditor; - model = editor.model; - viewDocument = editor.editing.view.document; - } ); - } ); - - afterEach( () => { - element.remove(); - - return editor.destroy(); - } ); - - describe( 'enter key support', () => { - function fakeEventData() { - return { - preventDefault: sinon.spy() - }; - } - - it( 'does nothing if selection is in an empty block but not in a block quote', () => { - const data = fakeEventData(); - const execSpy = sinon.spy( editor, 'execute' ); - - setModelData( model, 'Foo
Bar
' ); - - viewDocument.fire( 'enter', data ); - - // Only enter command should be executed. - expect( data.preventDefault.called ).to.be.true; - expect( execSpy.calledOnce ).to.be.true; - expect( execSpy.args[ 0 ][ 0 ] ).to.equal( 'enter' ); - } ); - - it( 'does nothing if selection is in a non-empty block (at the beginning) in a block quote', () => { - const data = fakeEventData(); - const execSpy = sinon.spy( editor, 'execute' ); - - setModelData( model, 'xx[]
' ); - - viewDocument.fire( 'enter', data ); - - // Only enter command should be executed. - expect( data.preventDefault.called ).to.be.true; - expect( execSpy.calledOnce ).to.be.true; - expect( execSpy.args[ 0 ][ 0 ] ).to.equal( 'enter' ); - } ); - - it( 'does nothing if selection is not collapsed', () => { - const data = fakeEventData(); - const execSpy = sinon.spy( editor, 'execute' ); - - setModelData( model, '[]xx
' ); - - viewDocument.fire( 'enter', data ); - - // Only enter command should be executed. - expect( data.preventDefault.called ).to.be.true; - expect( execSpy.calledOnce ).to.be.true; - expect( execSpy.args[ 0 ][ 0 ] ).to.equal( 'enter' ); - } ); - - it( 'does not interfere with a similar handler in the list feature', () => { - const data = fakeEventData(); - - setModelData( model, - '[ ]
' + - '' + - 'a ' + - '[] ' + - '
' + - '' + - 'a ' + - '[] ' + - '
[]
' + - 'a [] b
' + - 'a
' + - 'b
' + - 'a []
' + - 'a
' + - 'a []
' + - 'a b
' + - 'a b[]c
' + - '[]a b
' + - 'b
' + - 'a b
' + - '[]c d
' + - 'a b[]c d
' + - 'a
' + - '[]
' + - 'a
' + - '[]
' + - '[] foo
' + - 'foo
' + - '[]
' + - '[]
' ); - - viewDocument.fire( 'delete', data ); - - // Only delete command should be executed. - expect( data.preventDefault.called ).to.be.true; - expect( execSpy.calledOnce ).to.be.true; - expect( execSpy.args[ 0 ][ 0 ] ).to.equal( 'delete' ); - } ); - - it( 'does nothing if selection is in a non-empty block (at the beginning) in a block quote', () => { - const data = fakeEventData(); - const execSpy = sinon.spy( editor, 'execute' ); - - setModelData( model, 'xx[]
' ); - - viewDocument.fire( 'delete', data ); - - // Only delete command should be executed. - expect( data.preventDefault.called ).to.be.true; - expect( execSpy.calledOnce ).to.be.true; - expect( execSpy.args[ 0 ][ 0 ] ).to.equal( 'delete' ); - } ); - - it( 'does nothing if selection is not collapsed', () => { - const data = fakeEventData(); - const execSpy = sinon.spy( editor, 'execute' ); - - setModelData( model, '[]xx
' ); - - viewDocument.fire( 'delete', data ); - - // Only delete command should be executed. - expect( data.preventDefault.called ).to.be.true; - expect( execSpy.calledOnce ).to.be.true; - expect( execSpy.args[ 0 ][ 0 ] ).to.equal( 'delete' ); - } ); - } ); - - // Historically, due to problems with schema, images were not quotable. - // These tests were left here to confirm that after schema was fixed, images are properly quotable. - describe( 'compatibility with images', () => { - it( 'quotes a simple image', () => { - const element = document.createElement( 'div' ); - document.body.appendChild( element ); - - // We can't load ImageCaption in this test because it adds[ ]
' + - '' - ); - - element.remove(); - return editor.destroy(); - } ); - } ); - - it( 'quotes an image with caption', () => { - setModelData( model, - 'fo[o ' + - '' + - ' b]ar ' + - '
' + - '' - ); - } ); - - it( 'adds an image to an existing quote', () => { - setModelData( model, - 'fo[o ' + - '' + - ' ' + - 'xxx ' + - 'b]ar ' + - '
' - ); - - editor.execute( 'blockQuote' ); - - // Selection incorrectly trimmed. - expect( getModelData( model ) ).to.equal( - 'b]ar
' + - '' - ); - } ); - - it( 'wraps paragraph+image', () => { - setModelData( model, - 'foo ' + - '' + - ' ' + - 'xxx ' + - '[b]ar ' + - '
' - ); - } ); - - it( 'unwraps paragraph+image', () => { - setModelData( model, - '[foo ] foo
' - ); - - editor.execute( 'blockQuote' ); - - expect( getModelData( model ) ).to.equal( - '[foo ] foo
[' - ); - } ); - - it( 'unwraps image+paragraph', () => { - setModelData( model, - '[foo foo]
[' - ); - } ); - } ); - - // When blockQuote with a paragraph was pasted into a list item, the item contained the paragraph. It was invalid. - // There is a test which checks whether blockQuote will split the list items instead of merging with. - describe( 'compatibility with lists', () => { - it( 'does not merge the paragraph with list item', () => { - setModelData( model, 'foo foo]
xxx
' + - '' + - 'xxx ' + - '
[' - ); - } ); - - it( 'unwraps whole table', () => { - setModelData( - model, - ']
foo
[' - ); - - editor.execute( 'blockQuote' ); - - expect( getModelData( model ) ).to.equal( - '[]
foo
' + - '' + - 'xyz'; - - editor.setData( data ); - - expect( editor.getData() ).to.equal( - 'foobar' + - '
' + - '' + - 'foobar
' + - '
xyz
' - ); - } ); - - it( 'text directly in block quote', () => { - const data = - '' + - 'foobar' + - '' + - 'xyz'; - - editor.setData( data ); - - expect( editor.getData() ).to.equal( - '
' + - '' + - 'foobar
' + - '
xyz
' - ); - } ); - - it( 'text after block quote in div', () => { - const data = - '' + - 'foobar' + - '' + - '
' + - '' + - 'foobar
' + - '
xyz
' - ); - } ); - - it( 'text inside block quote in and after div', () => { - const data = - '' + - '' + - 'xyz'; - - editor.setData( data ); - - expect( editor.getData() ).to.equal( - 'foobar' + - '
' + - '' + - 'foo
bar
' + - '
xyz
' - ); - } ); - - it( 'text inside block quote in div split by heading', () => { - const data = - '' + - '' + - 'xyz'; - - editor.setData( data ); - - expect( editor.getData() ).to.equal( - 'foo' + - 'bar
baz
' + - '' + - 'foo
bar
baz
' + - '
xyz
' - ); - } ); - } ); -} ); diff --git a/packages/ckeditor5-admonition/tests/manual/blockquote.html b/packages/ckeditor5-admonition/tests/manual/blockquote.html deleted file mode 100644 index b8ea9f6b2..000000000 --- a/packages/ckeditor5-admonition/tests/manual/blockquote.html +++ /dev/null @@ -1,25 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus consequat placerat. Vestibulum id tellus et mauris sagittis tincidunt quis id mauris. Curabitur consectetur lectus sit amet tellus mattis, non lobortis leo interdum.
---Nulla finibus consequat placerat. Vestibulum id tellus et mauris sagittis tincidunt quis id mauris. Curabitur consectetur lectus sit amet tellus mattis, non lobortis leo interdum.
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus consequat placerat.
-Vestibulum id tellus et mauris sagittis tincidunt quis id mauris. Curabitur consectetur lectus sit amet tellus mattis, non lobortis leo interdum.
---Nulla finibus consequat placerat. Vestibulum id tellus et mauris sagittis tincidunt quis id mauris.
--
-- Curabitur consectetur lectus sit amet tellus mattis, non lobortis leo interdum.
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus consequat placerat. Vestibulum id tellus et mauris sagittis tincidunt quis id mauris. Curabitur consectetur lectus sit amet tellus mattis, non lobortis leo interdum.
---Nulla finibus consequat placerat. Vestibulum id tellus et mauris sagittis tincidunt quis id mauris.
---Curabitur consectetur lectus sit amet tellus mattis, non lobortis leo interdum.
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla finibus consequat placerat. Vestibulum id tellus et mauris sagittis tincidunt quis id mauris. Curabitur consectetur lectus sit amet tellus mattis, non lobortis leo interdum.
-Nested block quotes (in the data):
- ---Nulla finibus consequat placerat. Vestibulum id tellus et mauris sagittis tincidunt quis id mauris.
---Curabitur consectetur lectus sit amet tellus mattis, non lobortis leo interdum.
---Vestibulum id tellus et mauris sagittis tincidunt quis id mauris. Curabitur consectetur lectus sit amet tellus mattis, non lobortis leo interdum.
-