This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added missing view.Document to ViewDocumentFragment.
- Loading branch information
Showing
2 changed files
with
68 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/* global document */ | ||
|
||
import Title from '../src/title'; | ||
import Heading from '../src/heading.js'; | ||
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; | ||
import Enter from '@ckeditor/ckeditor5-enter/src/enter'; | ||
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold'; | ||
|
||
import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; | ||
import { getData as getModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; | ||
|
||
describe( 'Title integration', () => { | ||
let editor, model, doc, element; | ||
|
||
beforeEach( () => { | ||
element = document.createElement( 'div' ); | ||
document.body.appendChild( element ); | ||
|
||
return ClassicTestEditor | ||
.create( element, { | ||
plugins: [ Paragraph, Heading, Enter, Bold, Title ] | ||
} ) | ||
.then( newEditor => { | ||
editor = newEditor; | ||
model = editor.model; | ||
doc = model.document; | ||
} ); | ||
} ); | ||
|
||
afterEach( () => { | ||
element.remove(); | ||
|
||
return editor.destroy(); | ||
} ); | ||
|
||
describe( 'getBody()', () => { | ||
// See: https://github.com/ckeditor/ckeditor5/issues/6427 | ||
it( 'does not blow up when applying basic styles', () => { | ||
editor.setData( '<h1>Title</h1><p>Foo</p>' ); | ||
|
||
editor.model.change( writer => { | ||
writer.setSelection( doc.getRoot().getChild( 1 ), 'on' ); | ||
} ); | ||
|
||
editor.execute( 'bold' ); | ||
|
||
expect( editor.plugins.get( Title ).getBody() ).to.equal( | ||
'<p><strong>Foo</strong></p>' | ||
); | ||
|
||
expect( getModelData( model ) ).to.equal( | ||
'<title><title-content>Title</title-content></title><paragraph>[<$text bold="true">Foo</$text>]</paragraph>' | ||
); | ||
} ); | ||
} ); | ||
} ); |