|
@@ -83,7 +83,7 @@ describe( 'Conversion', () => {
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
- describe( 'converters', () => {
|
|
|
|
|
|
|
+ describe.only( 'converters', () => {
|
|
|
let viewDispatcher, model, schema, conversion, modelRoot, viewRoot;
|
|
let viewDispatcher, model, schema, conversion, modelRoot, viewRoot;
|
|
|
|
|
|
|
|
beforeEach( () => {
|
|
beforeEach( () => {
|
|
@@ -700,7 +700,7 @@ describe( 'Conversion', () => {
|
|
|
|
|
|
|
|
describe( 'for( \'upcast\' )', () => {
|
|
describe( 'for( \'upcast\' )', () => {
|
|
|
describe( 'elementToElement()', () => {
|
|
describe( 'elementToElement()', () => {
|
|
|
- it( 'adds downcast converter', () => {
|
|
|
|
|
|
|
+ it( 'adds upcast converter', () => {
|
|
|
conversion.for( 'upcast' ).elementToElement( { model: 'paragraph', view: 'p' } );
|
|
conversion.for( 'upcast' ).elementToElement( { model: 'paragraph', view: 'p' } );
|
|
|
// TODO this shouldn't be required
|
|
// TODO this shouldn't be required
|
|
|
conversion.for( 'downcast' ).elementToElement( { model: 'paragraph', view: 'p' } );
|
|
conversion.for( 'downcast' ).elementToElement( { model: 'paragraph', view: 'p' } );
|
|
@@ -708,6 +708,18 @@ describe( 'Conversion', () => {
|
|
|
testUpcast( '<p>foo</p>', '<paragraph>foo</paragraph>' );
|
|
testUpcast( '<p>foo</p>', '<paragraph>foo</paragraph>' );
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ describe( 'elementToAttribute()', () => {
|
|
|
|
|
+ it( 'adds upcast converter', () => {
|
|
|
|
|
+ conversion.for( 'upcast' ).elementToElement( { model: 'paragraph', view: 'p' } );
|
|
|
|
|
+ conversion.for( 'downcast' ).elementToElement( { model: 'paragraph', view: 'p' } );
|
|
|
|
|
+
|
|
|
|
|
+ conversion.for( 'upcast' ).elementToAttribute( { model: 'bold', view: 'strong' } );
|
|
|
|
|
+ conversion.for( 'downcast' ).attributeToElement( { model: 'bold', view: 'strong' } );
|
|
|
|
|
+
|
|
|
|
|
+ testUpcast( '<p><strong>Foo</strong> bar</p>', '<paragraph><$text bold="true">Foo</$text> bar</paragraph>' );
|
|
|
|
|
+ } );
|
|
|
|
|
+ } );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
function testDowncast( input, expectedView ) {
|
|
function testDowncast( input, expectedView ) {
|