291
291
} ) ;
292
292
} ,
293
293
294
+ 'test nestedEditable auto paragraphing (limited by widgetDef.allowedContent)' : function ( ) {
295
+ var editor = this . editor ;
296
+
297
+ editor . widgets . add ( 'autoparagraphtest' , {
298
+ allowedContent : 'div' ,
299
+ editables : {
300
+ foo : {
301
+ selector : '#foo' ,
302
+ allowedContent : 'br'
303
+ }
304
+ }
305
+ } ) ;
306
+
307
+ this . editorBot . setData ( '<p>x</p><div data-widget="autoparagraphtest" id="w1"><div id="foo">foo</div></div>' , function ( ) {
308
+ var widget = getWidgetById ( editor , 'w1' ) ,
309
+ editable = widget . editables . foo ,
310
+ range ;
311
+
312
+ // Move focus to the editable and place selection at the end of its contents.
313
+ // This should fire 'selectionChange' event and execute editable.fixDom() method.
314
+ editable . focus ( ) ;
315
+ range = editor . createRange ( ) ;
316
+ range . moveToPosition ( editable , CKEDITOR . POSITION_BEFORE_END ) ;
317
+ range . select ( ) ;
318
+
319
+ // Since allowedContent is 'br' auto paragraphing should not be performed.
320
+ assert . areEqual ( CKEDITOR . ENTER_BR , editable . enterMode , 'Enter mode should be CKEDTIOR.ENTER_BR.' ) ;
321
+ assert . areEqual ( 'foo' , editable . getData ( ) , 'Test data should not be changed.' ) ;
322
+ } ) ;
323
+ } ,
324
+
325
+ 'test nestedEditable auto paragraphing (limited by config.enterMode)' : function ( ) {
326
+ bender . editorBot . create ( {
327
+ name : 'testautoparagraphingconfigentermode' ,
328
+ creator : 'inline' ,
329
+ config : {
330
+ enterMode : CKEDITOR . ENTER_BR ,
331
+ on : {
332
+ pluginsLoaded : function ( evt ) {
333
+ evt . editor . widgets . add ( 'autoparagraphtest' , {
334
+ editables : {
335
+ foo : {
336
+ selector : '#foo'
337
+ }
338
+ }
339
+ } ) ;
340
+
341
+ evt . editor . filter . allow ( 'div[data-widget,id]' ) ;
342
+ }
343
+ }
344
+ }
345
+ } , function ( bot ) {
346
+ var editor = bot . editor ;
347
+
348
+ bot . setData ( '<p>x</p><div data-widget="autoparagraphtest" id="w1"><div id="foo">foo</div></div>' , function ( ) {
349
+ var widget = getWidgetById ( editor , 'w1' ) ,
350
+ editable = widget . editables . foo ,
351
+ range ;
352
+
353
+ // Move focus to the editable and place selection at the end of its contents.
354
+ // This should fire 'selectionChange' event and execute editable.fixDom() method.
355
+ editable . focus ( ) ;
356
+ range = editor . createRange ( ) ;
357
+ range . moveToPosition ( editable . getFirst ( ) , CKEDITOR . POSITION_BEFORE_END ) ;
358
+ range . select ( ) ;
359
+
360
+ // Since allowedContent is 'br' auto paragraphing should not be performed.
361
+ assert . areEqual ( CKEDITOR . ENTER_BR , editable . enterMode , 'Enter mode should be CKEDTIOR.ENTER_BR.' ) ;
362
+ assert . areEqual ( 'foo' , editable . getData ( ) , 'Test data should not be changed.' ) ;
363
+ } ) ;
364
+ } ) ;
365
+ } ,
366
+
367
+ 'test nestedEditable auto paragraphing (limited by config.autoParagraph)' : function ( ) {
368
+ bender . editorBot . create ( {
369
+ name : 'testautoparagraphingconfigautoparagraph' ,
370
+ creator : 'inline' ,
371
+ config : {
372
+ autoParagraph : false ,
373
+ on : {
374
+ pluginsLoaded : function ( evt ) {
375
+ evt . editor . widgets . add ( 'autoparagraphtest' , {
376
+ editables : {
377
+ foo : {
378
+ selector : '#foo'
379
+ }
380
+ }
381
+ } ) ;
382
+
383
+ evt . editor . filter . allow ( 'div[data-widget,id]' ) ;
384
+ }
385
+ }
386
+ }
387
+ } , function ( bot ) {
388
+ var editor = bot . editor ;
389
+
390
+ bot . setData ( '<p>x</p><div data-widget="autoparagraphtest" id="w1"><div id="foo">foo</div></div>' , function ( ) {
391
+ var widget = getWidgetById ( editor , 'w1' ) ,
392
+ editable = widget . editables . foo ,
393
+ range ;
394
+
395
+ // Move focus to the editable and place selection at the end of its contents.
396
+ // This should fire 'selectionChange' event and execute editable.fixDom() method.
397
+ editable . focus ( ) ;
398
+ range = editor . createRange ( ) ;
399
+ range . moveToPosition ( editable . getFirst ( ) , CKEDITOR . POSITION_BEFORE_END ) ;
400
+ range . select ( ) ;
401
+
402
+ // Since allowedContent is 'br' auto paragraphing should not be performed.
403
+ assert . areEqual ( CKEDITOR . ENTER_P , editable . enterMode , 'Enter mode should be CKEDTIOR.ENTER_P.' ) ;
404
+ assert . areEqual ( 'foo' , editable . getData ( ) , 'Test data should not be changed.' ) ;
405
+ } ) ;
406
+ } ) ;
407
+ } ,
408
+
294
409
'test nestedEditable.setData - data processor integration' : function ( ) {
295
410
var editor = this . editor ,
296
411
data = '<p>Foo</p><div data-widget="testsetdata1" id="w1"><p>A</p><p id="foo">B</p></div>' ;
1383
1498
} ) ;
1384
1499
}
1385
1500
} ) ;
1386
- } ) ( ) ;
1501
+ } ) ( ) ;
0 commit comments