@@ -17,6 +17,7 @@ const DROPDOWNEDITOR_ICON_CLASS = 'dx-dropdowneditor-icon';
1717const BUTTON_CONTENT_CLASS = 'dx-button-content' ;
1818const QUILL_CONTAINER_CLASS = 'dx-quill-container' ;
1919const STATE_DISABLED_CLASS = 'dx-state-disabled' ;
20+ const FORMAT_ACTIVE_CLASS = 'dx-format-active' ;
2021const HEX_FIELD_CLASS = 'dx-colorview-label-hex' ;
2122const INPUT_CLASS = 'dx-texteditor-input' ;
2223const DIALOG_CLASS = 'dx-formdialog' ;
@@ -183,6 +184,63 @@ export default function() {
183184 assert . strictEqual ( newValue , 'Normal text' , 'Header format is reset' ) ;
184185 } ) ;
185186
187+ test ( 'font format should not be reset after moving to next line' , function ( assert ) {
188+ const $htmlEditor = $ ( '#htmlEditor' ) . dxHtmlEditor ( {
189+ value : '<p>test</p>' ,
190+ toolbar : {
191+ items : [ {
192+ name : 'font' ,
193+ acceptedValues : [ 'Arial' , 'Courier New' , 'Georgia' ] ,
194+ options : {
195+ opened : true
196+ } ,
197+ } ] ,
198+ multiline : false
199+ } ,
200+ } ) ;
201+ const htmlEditor = $htmlEditor . dxHtmlEditor ( 'instance' ) ;
202+ const $formatWidget = $htmlEditor . find ( `.${ TOOLBAR_FORMAT_WIDGET_CLASS } ` ) ;
203+ const $content = $htmlEditor . find ( `.${ HTML_EDITOR_CONTENT_CLASS } ` ) ;
204+ htmlEditor . setSelection ( 4 , 0 ) ;
205+
206+ $ ( `.${ LIST_ITEM_CLASS } ` )
207+ . last ( )
208+ . trigger ( 'dxclick' ) ;
209+
210+
211+ const value = $formatWidget . find ( `.${ INPUT_CLASS } ` ) . val ( ) ;
212+ assert . strictEqual ( value , 'Georgia' , 'Font format is applied' ) ;
213+
214+ nativePointerMock ( ) . simulateEvent ( $content . get ( 0 ) , 'keydown' , { keyCode : ENTER_KEY_CODE } ) ;
215+
216+ const newValue = $formatWidget . find ( `.${ INPUT_CLASS } ` ) . val ( ) ;
217+ assert . strictEqual ( newValue , 'Georgia' , 'Font format is not reset' ) ;
218+ } ) ;
219+
220+ [ 'bold' , 'italic' , 'strike' , 'underline' ] . forEach ( ( formatName ) => {
221+ test ( `${ formatName } format should not be reset after moving to next line` , function ( assert ) {
222+ const $htmlEditor = $ ( '#htmlEditor' ) . dxHtmlEditor ( {
223+ value : '<p>test</p>' ,
224+ toolbar : {
225+ items : [ formatName ] ,
226+ multiline : false
227+ } ,
228+ } ) ;
229+ const htmlEditor = $htmlEditor . dxHtmlEditor ( 'instance' ) ;
230+ const $formatWidget = $htmlEditor . find ( `.${ TOOLBAR_FORMAT_WIDGET_CLASS } ` ) ;
231+ const $content = $htmlEditor . find ( `.${ HTML_EDITOR_CONTENT_CLASS } ` ) ;
232+ htmlEditor . setSelection ( 4 , 0 ) ;
233+
234+ $formatWidget . trigger ( 'dxclick' ) ;
235+
236+ assert . strictEqual ( $formatWidget . hasClass ( FORMAT_ACTIVE_CLASS ) , true , `${ formatName } format is applied` ) ;
237+
238+ nativePointerMock ( ) . simulateEvent ( $content . get ( 0 ) , 'keydown' , { keyCode : ENTER_KEY_CODE } ) ;
239+
240+ assert . strictEqual ( $formatWidget . hasClass ( FORMAT_ACTIVE_CLASS ) , true , `${ formatName } format is not reset` ) ;
241+ } ) ;
242+ } ) ;
243+
186244 test ( 'adaptive menu should be hidden after selecting formatting' , function ( assert ) {
187245 const done = assert . async ( ) ;
188246 const instance = $ ( '#htmlEditor' ) . dxHtmlEditor ( {
0 commit comments