|
|
@@ -12,6 +12,9 @@ import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
|
|
|
import IndentEditing from '../src/indentediting';
|
|
|
import IndentUI from '../src/indentui';
|
|
|
|
|
|
+import indentIcon from '../theme/icons/indent.svg';
|
|
|
+import outdentIcon from '../theme/icons/outdent.svg';
|
|
|
+
|
|
|
describe( 'IndentUI', () => {
|
|
|
let editor, element;
|
|
|
|
|
|
@@ -49,7 +52,6 @@ describe( 'IndentUI', () => {
|
|
|
|
|
|
expect( indentButton ).to.be.instanceOf( ButtonView );
|
|
|
expect( indentButton.label ).to.equal( 'Increase indent' );
|
|
|
- expect( indentButton.icon ).to.match( /<svg / );
|
|
|
} );
|
|
|
|
|
|
it( 'should set up button for outdent', () => {
|
|
|
@@ -57,7 +59,66 @@ describe( 'IndentUI', () => {
|
|
|
|
|
|
expect( outdentButton ).to.be.instanceOf( ButtonView );
|
|
|
expect( outdentButton.label ).to.equal( 'Decrease indent' );
|
|
|
- expect( outdentButton.icon ).to.match( /<svg / );
|
|
|
+ } );
|
|
|
+
|
|
|
+ describe( 'icons', () => {
|
|
|
+ describe( 'left–to–right UI', () => {
|
|
|
+ it( 'should display the right icon for indent', () => {
|
|
|
+ const indentButton = editor.ui.componentFactory.create( 'indent' );
|
|
|
+
|
|
|
+ expect( indentButton.icon ).to.equal( indentIcon );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should display the right icon for outdent', () => {
|
|
|
+ const outdentButton = editor.ui.componentFactory.create( 'outdent' );
|
|
|
+
|
|
|
+ expect( outdentButton.icon ).to.equal( outdentIcon );
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+
|
|
|
+ describe( 'right–to–left UI', () => {
|
|
|
+ it( 'should display the right icon for indent', () => {
|
|
|
+ const element = document.createElement( 'div' );
|
|
|
+ document.body.appendChild( element );
|
|
|
+
|
|
|
+ return ClassicTestEditor
|
|
|
+ .create( element, {
|
|
|
+ plugins: [ IndentUI, IndentEditing ],
|
|
|
+ language: 'ar'
|
|
|
+ } )
|
|
|
+ .then( newEditor => {
|
|
|
+ const indentButton = newEditor.ui.componentFactory.create( 'indent' );
|
|
|
+
|
|
|
+ expect( indentButton.icon ).to.equal( outdentIcon );
|
|
|
+
|
|
|
+ return newEditor.destroy();
|
|
|
+ } )
|
|
|
+ .then( () => {
|
|
|
+ element.remove();
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should display the right icon for outdent', () => {
|
|
|
+ const element = document.createElement( 'div' );
|
|
|
+ document.body.appendChild( element );
|
|
|
+
|
|
|
+ return ClassicTestEditor
|
|
|
+ .create( element, {
|
|
|
+ plugins: [ IndentUI, IndentEditing ],
|
|
|
+ language: 'ar'
|
|
|
+ } )
|
|
|
+ .then( newEditor => {
|
|
|
+ const outdentButton = newEditor.ui.componentFactory.create( 'outdent' );
|
|
|
+
|
|
|
+ expect( outdentButton.icon ).to.equal( indentIcon );
|
|
|
+
|
|
|
+ return newEditor.destroy();
|
|
|
+ } )
|
|
|
+ .then( () => {
|
|
|
+ element.remove();
|
|
|
+ } );
|
|
|
+ } );
|
|
|
+ } );
|
|
|
} );
|
|
|
|
|
|
it( 'should execute indent command on button execute', () => {
|