|
|
@@ -17,6 +17,9 @@ import ViewContainerElement from '../../src/view/containerelement';
|
|
|
import ViewUIElement from '../../src/view/uielement';
|
|
|
import ViewText from '../../src/view/text';
|
|
|
|
|
|
+import log from '@ckeditor/ckeditor5-utils/src/log';
|
|
|
+import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
|
|
|
+
|
|
|
import {
|
|
|
downcastElementToElement, downcastAttributeToElement, downcastAttributeToAttribute, downcastMarkerToElement, downcastMarkerToHighlight,
|
|
|
insertElement, insertUIElement, changeAttribute, wrap, removeUIElement,
|
|
|
@@ -264,6 +267,8 @@ describe( 'downcast-helpers', () => {
|
|
|
} );
|
|
|
|
|
|
describe( 'downcastAttributeToAttribute', () => {
|
|
|
+ testUtils.createSinonSandbox();
|
|
|
+
|
|
|
beforeEach( () => {
|
|
|
conversion.for( 'downcast' ).add( downcastElementToElement( { model: 'image', view: 'img' } ) );
|
|
|
} );
|
|
|
@@ -463,6 +468,8 @@ describe( 'downcast-helpers', () => {
|
|
|
|
|
|
// #1587
|
|
|
it( 'config.view and config.model as strings in generic conversion (elements only)', () => {
|
|
|
+ const logSpy = testUtils.sinon.spy( log, 'warn' );
|
|
|
+
|
|
|
conversion.for( 'downcast' ).add( downcastElementToElement( { model: 'paragraph', view: 'p' } ) );
|
|
|
|
|
|
conversion.for( 'downcast' ).add( downcastAttributeToAttribute( { model: 'test', view: 'test' } ) );
|
|
|
@@ -473,6 +480,7 @@ describe( 'downcast-helpers', () => {
|
|
|
} );
|
|
|
|
|
|
expectResult( '<p test="1"></p><p test="2"></p>' );
|
|
|
+ expect( logSpy.callCount ).to.equal( 0 );
|
|
|
|
|
|
model.change( writer => {
|
|
|
writer.removeAttribute( 'test', modelRoot.getChild( 1 ) );
|
|
|
@@ -483,6 +491,8 @@ describe( 'downcast-helpers', () => {
|
|
|
|
|
|
// #1587
|
|
|
it( 'config.view and config.model as strings in generic conversion (elements + text)', () => {
|
|
|
+ const logSpy = testUtils.sinon.spy( log, 'warn' );
|
|
|
+
|
|
|
conversion.for( 'downcast' ).add( downcastElementToElement( { model: 'paragraph', view: 'p' } ) );
|
|
|
|
|
|
conversion.for( 'downcast' ).add( downcastAttributeToAttribute( { model: 'test', view: 'test' } ) );
|
|
|
@@ -496,6 +506,8 @@ describe( 'downcast-helpers', () => {
|
|
|
} );
|
|
|
|
|
|
expectResult( '<p>Foo</p><p test="1">Bar</p>' );
|
|
|
+ expect( logSpy.callCount ).to.equal( 2 );
|
|
|
+ expect( logSpy.alwaysCalledWithMatch( 'conversion-attribute-to-attribute-on-text' ) ).to.true;
|
|
|
|
|
|
model.change( writer => {
|
|
|
writer.removeAttribute( 'test', modelRoot.getChild( 1 ) );
|