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 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from ckeditor/t/35
Other: Updated view attribute elements priorities to ensure proper order in which attribute elements are applied. Closes #35.
- Loading branch information
Showing
8 changed files
with
196 additions
and
69 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
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
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
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,89 @@ | ||
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/* global document */ | ||
|
||
import Font from '../src/font'; | ||
import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset'; | ||
import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; | ||
import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; | ||
import env from '@ckeditor/ckeditor5-utils/src/env'; | ||
|
||
describe( 'Integration test Font', () => { | ||
let element, editor, model; | ||
|
||
beforeEach( () => { | ||
element = document.createElement( 'div' ); | ||
document.body.appendChild( element ); | ||
|
||
return ClassicTestEditor | ||
.create( element, { | ||
plugins: [ Font, ArticlePluginSet ] | ||
} ) | ||
.then( newEditor => { | ||
editor = newEditor; | ||
model = editor.model; | ||
} ); | ||
} ); | ||
|
||
afterEach( () => { | ||
element.remove(); | ||
|
||
return editor.destroy(); | ||
} ); | ||
|
||
describe( 'in-between font plugin features', () => { | ||
it( 'should render one span element for all types of font features', () => { | ||
setModelData( model, | ||
'<paragraph>' + | ||
'<$text fontColor="#123456" fontBackgroundColor="rgb(10,20,30)" fontSize="big" fontFamily="Arial">foo</$text>' + | ||
'</paragraph>' | ||
); | ||
|
||
if ( !env.isEdge ) { | ||
expect( editor.getData() ).to.equal( | ||
'<p>' + | ||
'<span ' + | ||
'class="text-big" ' + | ||
'style="font-family:Arial, Helvetica, sans-serif;background-color:rgb(10,20,30);color:#123456;"' + | ||
'>foo' + | ||
'</span>' + | ||
'</p>' | ||
); | ||
} else { | ||
// Edge sorts attributes of an element. | ||
expect( editor.getData() ).to.equal( | ||
'<p>' + | ||
'<span ' + | ||
'class="text-big" ' + | ||
'style="font-family:Arial, Helvetica, sans-serif;color:#123456;background-color:rgb(10,20,30);"' + | ||
'>foo' + | ||
'</span>' + | ||
'</p>' | ||
); | ||
} | ||
} ); | ||
} ); | ||
|
||
describe( 'between font plugin and other', () => { | ||
it( 'should render elements wrapped in proper order', () => { | ||
setModelData( model, | ||
'<paragraph>' + | ||
'<$text bold="true" linkHref="foo" fontColor="red" fontSize="big">foo</$text>' + | ||
'</paragraph>' | ||
); | ||
|
||
expect( editor.getData() ).to.equal( | ||
'<p>' + | ||
'<a href="foo">' + | ||
'<span class="text-big" style="color:red;">' + | ||
'<strong>foo</strong>' + | ||
'</span>' + | ||
'</a>' + | ||
'</p>' | ||
); | ||
} ); | ||
} ); | ||
} ); |
Oops, something went wrong.