/**
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/
/* globals document */
import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
import PasteFromOffice from '../../../src/pastefromoffice';
import { setData, stringify } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
import { pasteHtml } from '../../_utils/utils';
import simple from '../../_data/spacing/simple/input.word2016.html';
import singleLine from '../../_data/spacing/single-line/input.word2016.html';
import multiLine from '../../_data/spacing/multi-line/input.word2016.html';
describe( 'Spacing – integration', () => {
let element, editor, insertedModel;
before( () => {
element = document.createElement( 'div' );
document.body.appendChild( element );
return ClassicTestEditor
.create( element, { plugins: [ Clipboard, Paragraph, Bold, Italic, Underline, PasteFromOffice ] } )
.then( editorInstance => {
editor = editorInstance;
const model = editor.model;
const insertContent = model.insertContent;
sinon.stub( editor.model, 'insertContent' ).callsFake( ( content, selection ) => {
// Save model string representation now as it may change after `insertContent()` function call
// so accessing it later may not work as it may have empty/changed structure.
insertedModel = stringify( content );
insertContent.call( model, content, selection );
} );
} );
} );
beforeEach( () => {
setData( editor.model, '
Foo Bar
// // which should result in the same output as pasting: // //Foo Bar
it( 'pastes line with single space', () => { const expectedModel = '
//
// 2Foo
// 3Bar4
2Foo 3Bar4
it( 'pastes single line with multiple spaces', () => { const expectedModel = '2Foo 3Bar4
03
21
2Foo 3Bar4
//03
//21
it( 'pastes multiple lines with multiple spaces', () => { const expectedModel = '