@@ -11,6 +11,9 @@ import UndoUI from '../src/undoui';
1111import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview' ;
1212import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils' ;
1313
14+ import undoIcon from '../theme/icons/undo.svg' ;
15+ import redoIcon from '../theme/icons/redo.svg' ;
16+
1417describe ( 'UndoUI' , ( ) => {
1518 let editor , editorElement ;
1619
@@ -35,6 +38,66 @@ describe( 'UndoUI', () => {
3538 testButton ( 'undo' , 'Undo' , 'CTRL+Z' ) ;
3639 testButton ( 'redo' , 'Redo' , 'CTRL+Y' ) ;
3740
41+ describe ( 'icons' , ( ) => {
42+ describe ( 'left–to–right UI' , ( ) => {
43+ it ( 'should display the right icon for undo' , ( ) => {
44+ const undoButton = editor . ui . componentFactory . create ( 'undo' ) ;
45+
46+ expect ( undoButton . icon ) . to . equal ( undoIcon ) ;
47+ } ) ;
48+
49+ it ( 'should display the right icon for redo' , ( ) => {
50+ const redoButton = editor . ui . componentFactory . create ( 'redo' ) ;
51+
52+ expect ( redoButton . icon ) . to . equal ( redoIcon ) ;
53+ } ) ;
54+ } ) ;
55+
56+ describe ( 'right–to–left UI' , ( ) => {
57+ it ( 'should display the right icon for undo' , ( ) => {
58+ const element = document . createElement ( 'div' ) ;
59+ document . body . appendChild ( element ) ;
60+
61+ return ClassicTestEditor
62+ . create ( element , {
63+ plugins : [ UndoEditing , UndoUI ] ,
64+ language : 'ar'
65+ } )
66+ . then ( newEditor => {
67+ const undoButton = newEditor . ui . componentFactory . create ( 'undo' ) ;
68+
69+ expect ( undoButton . icon ) . to . equal ( redoIcon ) ;
70+
71+ return newEditor . destroy ( ) ;
72+ } )
73+ . then ( ( ) => {
74+ element . remove ( ) ;
75+ } ) ;
76+ } ) ;
77+
78+ it ( 'should display the right icon for redo' , ( ) => {
79+ const element = document . createElement ( 'div' ) ;
80+ document . body . appendChild ( element ) ;
81+
82+ return ClassicTestEditor
83+ . create ( element , {
84+ plugins : [ UndoEditing , UndoUI ] ,
85+ language : 'ar'
86+ } )
87+ . then ( newEditor => {
88+ const redoButton = newEditor . ui . componentFactory . create ( 'redo' ) ;
89+
90+ expect ( redoButton . icon ) . to . equal ( undoIcon ) ;
91+
92+ return newEditor . destroy ( ) ;
93+ } )
94+ . then ( ( ) => {
95+ element . remove ( ) ;
96+ } ) ;
97+ } ) ;
98+ } ) ;
99+ } ) ;
100+
38101 function testButton ( featureName , label , featureKeystroke ) {
39102 describe ( `${ featureName } button` , ( ) => {
40103 let button ;
0 commit comments