How to use the @ckeditor/ckeditor5-engine/src/dev-utils/model.getData function in @ckeditor/ckeditor5-engine

To help you get started, we’ve selected a few @ckeditor/ckeditor5-engine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ckeditor / ckeditor5-table / tests / commands / mergecellcommand.js View on Github external
it( 'should merge table cells', () => {
				setData( model, modelTable( [
					[ '00', '01' ],
					[ '10', '[]11' ]
				] ) );

				command.execute();

				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
					[ '00', { rowspan: 2, contents: '[0111]' } ],
					[ '10' ]
				] ) );
			} );
github ckeditor / ckeditor5-table / tests / commands / mergecellscommand.js View on Github external
it( 'should decrease rowspan if cell overlaps removed row', () => {
				setData( model, modelTable( [
					[ '00', { rowspan: 2, contents: '01' }, { rowspan: 3, contents: '02' } ],
					[ '10' ],
					[ '20', '21' ]
				] ) );

				selectNodes( [
					[ 0, 0, 0 ],
					[ 0, 1, 0 ],
					[ 0, 2, 0 ]
				] );

				command.execute();

				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
					[
						{ rowspan: 2, contents: '[001020]' },
						'01',
						{ rowspan: 2, contents: '02' }
					],
					[ '21' ]
				] ) );
			} );
github ckeditor / ckeditor5-image / tests / imagestyle / imagestyleediting.js View on Github external
it( 'should not convert from view to model if class is not defined', () => {
			editor.setData( '<figure class="image foo-bar"><img src="foo.png"></figure>' );

			expect( getModelData( model, { withoutSelection: true } ) ).to.equal( '<img src="foo.png">' );
			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
				'<figure class="ck ck-widget image"><img src="foo.png"></figure>'
			);
		} );
github ckeditor / ckeditor5-image / tests / imagestyle / imagestyleediting.js View on Github external
it( 'should not convert from view to model when not in image figure', () =&gt; {
			editor.setData( '<figure class="side-class"></figure>' );

			expect( getModelData( model, { withoutSelection: true } ) ).to.equal( '' );
			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal( '' );
		} );
github ckeditor / ckeditor5-image / tests / image / utils.js View on Github external
it( 'should not insert image nor crash when image could not be inserted', () =&gt; {
			model.schema.register( 'other', {
				allowIn: '$root',
				isLimit: true
			} );
			model.schema.extend( '$text', { allowIn: 'other' } );

			editor.conversion.for( 'downcast' ).elementToElement( { model: 'other', view: 'p' } );

			setModelData( model, '[]' );

			model.change( writer =&gt; {
				insertImage( writer, model );
			} );

			expect( getModelData( model ) ).to.equal( '[]' );
		} );
	} );
github ckeditor / ckeditor5-table / tests / converters / table-post-fixer.js View on Github external
it( 'should fix the wrong rowspan attribute of a table cell inside the header', () => {
			const parsed = parse( modelTable( [
				[ { rowspan: 2, contents: '00' }, { rowspan: 3, contents: '01' }, '02' ],
				[ { rowspan: 8, contents: '12' } ],
				[ '20', '21', '22' ]
			], { headingRows: 2 } ), model.schema );

			model.change( writer => {
				writer.remove( Range.createIn( root ) );
				writer.insert( parsed, root );
			} );

			expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formattedModelTable( [
				[ { rowspan: 2, contents: '00' }, { rowspan: 2, contents: '01' }, '02' ],
				[ '12' ],
				[ '20', '21', '22' ]
			], { headingRows: 2 } ) );
		} );
github ckeditor / ckeditor5-core / tests / editor / standardeditor.js View on Github external
it( 'should set data of the first root', () => {
			editor.model.document.createRoot();
			editor.model.document.createRoot( '$root', 'secondRoot' );

			editor.editing.createRoot( 'div' );
			editor.editing.createRoot( 'div', 'secondRoot' );

			editor.setData( 'foo' );

			expect( getData( editor.model, { rootName: 'main', withoutSelection: true } ) ).to.equal( 'foo' );
		} );
	} );
github ckeditor / ckeditor5-table / tests / tableediting.js View on Github external
it( 'should convert table', () =&gt; {
				editor.setData( '<table><tbody><tr><td>foo</td></tr></tbody></table>' );

				expect( getModelData( model, { withoutSelection: true } ) )
					.to.equal( 'foo<table></table>' );
			} );
		} );
github ckeditor / ckeditor5-image / tests / image / converters.js View on Github external
function expectModel( data ) {
			expect( getModelData( model, { withoutSelection: true } ) ).to.equal( data );
		}
github ckeditor / ckeditor5-media-embed / tests / mediaembedediting.js View on Github external
.then( newEditor =&gt; {
								newEditor.setData(
									'<figure class="media"></figure>' +
									'<figure class="media"></figure>' );

								expect( getModelData( newEditor.model, { withoutSelection: true } ) )
									.to.equal( '' );

								return newEditor.destroy();
							} );
					} );