@@ -9,6 +9,8 @@ import InlineEditorUI from '../src/inlineeditorui';
99import InlineEditorUIView from '../src/inlineeditoruiview' ;
1010
1111import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor' ;
12+ import buildViewConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildviewconverter' ;
13+ import buildModelConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildmodelconverter' ;
1214
1315import InlineEditor from '../src/inlineeditor' ;
1416import Plugin from '@ckeditor/ckeditor5-core/src/plugin' ;
@@ -168,15 +170,34 @@ describe( 'InlineEditor', () => {
168170 return InlineEditor . create ( editorElement , { plugins : [ Paragraph ] } )
169171 . then ( newEditor => {
170172 editor = newEditor ;
173+
174+ const schema = editor . document . schema ;
175+
176+ schema . registerItem ( 'heading' ) ;
177+ schema . allow ( { name : 'heading' , inside : '$root' } ) ;
178+ schema . allow ( { name : '$text' , inside : 'heading' } ) ;
179+
180+ buildModelConverter ( ) . for ( editor . data . modelToView )
181+ . fromElement ( 'heading' )
182+ . toElement ( 'heading' ) ;
183+
184+ buildViewConverter ( ) . for ( editor . data . viewToModel )
185+ . fromElement ( 'heading' )
186+ . toElement ( 'heading' ) ;
187+
188+ buildModelConverter ( ) . for ( editor . editing . modelToView )
189+ . fromElement ( 'heading' )
190+ . toElement ( 'heading-editing-representation' ) ;
171191 } ) ;
172192 } ) ;
173193
174194 it ( 'sets the data back to the editor element' , ( ) => {
175- editor . setData ( '<p>foo </p>' ) ;
195+ editor . setData ( '<p>a </p><heading>b</heading >' ) ;
176196
177197 return editor . destroy ( )
178198 . then ( ( ) => {
179- expect ( editorElement . innerHTML ) . to . equal ( '<p>foo</p>' ) ;
199+ expect ( editorElement . innerHTML )
200+ . to . equal ( '<p>a</p><heading>b</heading>' ) ;
180201 } ) ;
181202 } ) ;
182203 } ) ;
0 commit comments