jodit 3.8.1 → 3.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/.idea/codeStyles/Project.xml +68 -0
  2. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  3. package/.idea/dictionaries/v_chupurnov.xml +10 -0
  4. package/.idea/encodings.xml +4 -0
  5. package/.idea/inspectionProfiles/Project_Default.xml +118 -0
  6. package/.idea/jodit.iml +12 -0
  7. package/.idea/jsLibraryMappings.xml +6 -0
  8. package/.idea/markdown-navigator-enh.xml +29 -0
  9. package/.idea/markdown-navigator.xml +55 -0
  10. package/.idea/misc.xml +6 -0
  11. package/.idea/modules.xml +8 -0
  12. package/.idea/prettier.xml +6 -0
  13. package/.idea/vcs.xml +6 -0
  14. package/.idea/watcherTasks.xml +4 -0
  15. package/.idea/workspace.xml +1264 -0
  16. package/build/jodit.css +2 -2
  17. package/build/jodit.es2018.css +1 -1
  18. package/build/jodit.es2018.en.css +1 -1
  19. package/build/jodit.es2018.en.js +4 -4
  20. package/build/jodit.es2018.en.min.js +2 -2
  21. package/build/jodit.es2018.js +4 -4
  22. package/build/jodit.es2018.min.js +2 -2
  23. package/build/jodit.js +4 -4
  24. package/build/jodit.min.css +1 -1
  25. package/build/jodit.min.js +2 -2
  26. package/package.json +2 -2
  27. package/.travis.yml +0 -7
  28. package/bower.json +0 -33
  29. package/build.js +0 -39
  30. package/docker/Dockerfile +0 -11
  31. package/docker/README.md +0 -45
  32. package/docker/build +0 -3
  33. package/docker/install +0 -7
  34. package/docker/start +0 -3
  35. package/docker/test +0 -3
  36. package/docker/uninstall +0 -3
  37. package/examples/arabic.lang.html +0 -76
  38. package/examples/assets/app.css +0 -175
  39. package/examples/assets/app.js +0 -57
  40. package/examples/assets/download.jpg +0 -0
  41. package/examples/assets/icon.png +0 -0
  42. package/examples/assets/logo.png +0 -0
  43. package/examples/assets/prism.css +0 -200
  44. package/examples/assets/prism.js +0 -1254
  45. package/examples/color-picker.html +0 -139
  46. package/examples/custom-icons.html +0 -173
  47. package/examples/custom-toolbar.html +0 -80
  48. package/examples/example.default.html +0 -75
  49. package/examples/fullsize.html +0 -75
  50. package/examples/index.html +0 -176
  51. package/examples/inline-mode.html +0 -116
  52. package/examples/oneinstance.html +0 -125
  53. package/icons.html +0 -50
  54. package/karma.conf.js +0 -157
  55. package/make.js +0 -10
  56. package/server.js +0 -101
  57. package/test/bootstrap.js +0 -1167
  58. package/test/test.html +0 -102
  59. package/test/test.index.html +0 -11
  60. package/test/tests/acceptance/clipboardTest.js +0 -1234
  61. package/test/tests/acceptance/commandsTest.js +0 -647
  62. package/test/tests/acceptance/creatorTest.js +0 -103
  63. package/test/tests/acceptance/deleteBackSpaceTest.js +0 -1289
  64. package/test/tests/acceptance/dialogTest.js +0 -188
  65. package/test/tests/acceptance/editorTest.js +0 -855
  66. package/test/tests/acceptance/enterTest.js +0 -1088
  67. package/test/tests/acceptance/eventsTest.js +0 -1246
  68. package/test/tests/acceptance/filebrowserTest.js +0 -1309
  69. package/test/tests/acceptance/i18nTest.js +0 -81
  70. package/test/tests/acceptance/iframeTest.js +0 -306
  71. package/test/tests/acceptance/imageTest.js +0 -1649
  72. package/test/tests/acceptance/inlineModeTest.js +0 -826
  73. package/test/tests/acceptance/interfaceTest.js +0 -119
  74. package/test/tests/acceptance/mobileTest.js +0 -229
  75. package/test/tests/acceptance/plugins/classSpan.js +0 -220
  76. package/test/tests/acceptance/plugins/cleanHtml.js +0 -351
  77. package/test/tests/acceptance/plugins/color.js +0 -188
  78. package/test/tests/acceptance/plugins/dragAndDropElement.js +0 -172
  79. package/test/tests/acceptance/plugins/focus.js +0 -115
  80. package/test/tests/acceptance/plugins/font.js +0 -316
  81. package/test/tests/acceptance/plugins/image.js +0 -79
  82. package/test/tests/acceptance/plugins/indent.js +0 -179
  83. package/test/tests/acceptance/plugins/inline-popup.js +0 -578
  84. package/test/tests/acceptance/plugins/insert.js +0 -17
  85. package/test/tests/acceptance/plugins/limit.js +0 -164
  86. package/test/tests/acceptance/plugins/link.js +0 -1640
  87. package/test/tests/acceptance/plugins/orderedList.js +0 -290
  88. package/test/tests/acceptance/plugins/placeholder.js +0 -138
  89. package/test/tests/acceptance/plugins/resizer.js +0 -329
  90. package/test/tests/acceptance/plugins/search.js +0 -623
  91. package/test/tests/acceptance/plugins/size.js +0 -344
  92. package/test/tests/acceptance/plugins/source.js +0 -218
  93. package/test/tests/acceptance/plugins/stat.js +0 -120
  94. package/test/tests/acceptance/plugins/tooltip.js +0 -97
  95. package/test/tests/acceptance/plugins/wrapTextNodes.js +0 -105
  96. package/test/tests/acceptance/pluginsTest.js +0 -2219
  97. package/test/tests/acceptance/selectionTest.js +0 -862
  98. package/test/tests/acceptance/statesTest.js +0 -310
  99. package/test/tests/acceptance/tableTest.js +0 -1988
  100. package/test/tests/acceptance/toolbarTest.js +0 -1747
  101. package/test/tests/acceptance/undoredoTest.js +0 -217
  102. package/test/tests/acceptance/uploaderTest.js +0 -187
  103. package/test/tests/artio.jpg +0 -0
  104. package/test/tests/units/helpersTest.js +0 -771
  105. package/test/tests/units/modules/dom.js +0 -282
  106. package/test/tests/units/objectObserverTest.js +0 -533
  107. package/test/tests/units/popupTest.js +0 -211
  108. package/test/tests/units/positionTest.js +0 -238
  109. package/test/tests/units/styleTest.js +0 -1361
  110. package/webpack.config.js +0 -308
@@ -1,1289 +0,0 @@
1
- /*!
2
- * Jodit Editor (https://xdsoft.net/jodit/)
3
- * Released under MIT see LICENSE.txt in the project root for license information.
4
- * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
- describe('Backspace/Delete key', function () {
7
- let editor, range;
8
-
9
- beforeEach(function () {
10
- editor = getJodit();
11
- editor.value = '<p>test</p>';
12
- range = editor.s.createRange(true);
13
- });
14
-
15
- describe('For non collapsed range', function () {
16
- describe('Select part of text inside P element', function () {
17
- it('Should remove only selected range', function () {
18
- range.setStart(editor.editor.firstChild.firstChild, 2);
19
- range.setEnd(editor.editor.firstChild.firstChild, 4);
20
-
21
- editor.s.selectRange(range);
22
-
23
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
24
-
25
- expect('<p>te</p>').equals(editor.value);
26
- });
27
- });
28
-
29
- describe('Select whole text inside element', function () {
30
- describe('Inside P', function () {
31
- it('Should remove selected range and remove this P', function () {
32
- range.selectNodeContents(editor.editor.firstChild);
33
- editor.s.selectRange(range);
34
-
35
- simulateEvent(
36
- 'keydown',
37
- Jodit.KEY_BACKSPACE,
38
- editor.editor
39
- );
40
-
41
- expect('').equals(editor.value);
42
- });
43
- });
44
-
45
- describe('Inside table cell', function () {
46
- it('Should only remove selected range', function () {
47
- editor.value =
48
- '<table><tbody><tr><td>test</td><td>1</td></tr></tbody></table>';
49
-
50
- range.selectNodeContents(editor.editor.querySelector('td'));
51
- editor.s.selectRange(range);
52
-
53
- simulateEvent(
54
- 'keydown',
55
- Jodit.KEY_BACKSPACE,
56
- editor.editor
57
- );
58
-
59
- expect(
60
- '<table><tbody><tr><td></td><td>1</td></tr></tbody></table>'
61
- ).equals(editor.value.replace('<br>', ''));
62
- });
63
- });
64
- });
65
- });
66
-
67
- describe('Unicode sequences', function () {
68
- describe('BackSpace', function () {
69
- it('Should remove previous unicode sequence before cursor', function () {
70
- editor.value = '<p>a阪😄👌|test</p>';
71
- setCursorToChar(editor);
72
-
73
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
74
- expect(editor.value).equals('<p>a阪😄test</p>');
75
-
76
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
77
- expect(editor.value).equals('<p>a阪test</p>');
78
-
79
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
80
- expect(editor.value).equals('<p>atest</p>');
81
-
82
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
83
- expect(editor.value).equals('<p>test</p>');
84
- });
85
- });
86
-
87
- describe('Delete', function () {
88
- it('Should remove previous unicode sequence before cursor', function () {
89
- editor.value = '<p>stop👌|😄阪test</p>';
90
- setCursorToChar(editor);
91
-
92
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
93
- expect(editor.value).equals('<p>stop👌阪test</p>');
94
-
95
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
96
- expect(editor.value).equals('<p>stop👌test</p>');
97
-
98
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
99
- expect(editor.value).equals('<p>stop👌est</p>');
100
- });
101
- });
102
- });
103
-
104
- describe('Edit simple text', function () {
105
- describe('BackSpace', function () {
106
- it('Should remove previous char before cursor', function () {
107
- range.setStart(editor.editor.firstChild.firstChild, 2);
108
- range.collapse(true);
109
- editor.s.selectRange(range);
110
-
111
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
112
-
113
- expect(editor.value).equals('<p>tst</p>');
114
- });
115
-
116
- describe('With spaces', function () {
117
- it('Should remove previous char before cursor', function () {
118
- editor.value = '<p>a b c d e</p>';
119
- range.setStart(editor.editor.firstChild.firstChild, 6);
120
- range.collapse(true);
121
- editor.s.selectRange(range);
122
-
123
- for (let i = 1; i <= 4; i += 1) {
124
- simulateEvent(
125
- 'keydown',
126
- Jodit.KEY_BACKSPACE,
127
- editor.editor
128
- );
129
- simulateEvent(
130
- 'keyup',
131
- Jodit.KEY_BACKSPACE,
132
- editor.editor
133
- );
134
- simulateEvent(
135
- 'keypress',
136
- Jodit.KEY_BACKSPACE,
137
- editor.editor
138
- );
139
- }
140
-
141
- expect(editor.value).equals('<p>a&nbsp;d e</p>');
142
- });
143
- });
144
-
145
- describe('Text after SPAN and cursor in the left edge of text', function () {
146
- it('Should remove char inside span', function () {
147
- editor.value = '<p><span>AAA</span>test</p>';
148
-
149
- range.setStart(editor.editor.firstChild.lastChild, 0);
150
-
151
- simulateEvent(
152
- 'keydown',
153
- Jodit.KEY_BACKSPACE,
154
- editor.editor
155
- );
156
-
157
- expect(sortAttributes(editor.value)).equals(
158
- '<p><span>AA</span>test</p>'
159
- );
160
- });
161
- });
162
-
163
- describe('Cursor in the outside some element', function () {
164
- it('Should remove last char in the previous element', function () {
165
- editor.value = '<p><strong>123</strong></p>';
166
-
167
- range.setStartAfter(editor.editor.firstChild.firstChild);
168
- editor.s.selectRange(range);
169
-
170
- simulateEvent(
171
- 'keydown',
172
- Jodit.KEY_BACKSPACE,
173
- editor.editor
174
- );
175
-
176
- expect(editor.value).equals('<p><strong>12</strong></p>');
177
-
178
- editor.s.insertHTML(' 1 ');
179
- expect(editor.value).equals(
180
- '<p><strong>12 1 </strong></p>'
181
- );
182
- });
183
- });
184
-
185
- describe('With pressed `ctrl/cmd`', function () {
186
- it('Should remove previous whole part of text before cursor', function () {
187
- editor.value = '<p>Hello evil world</p>';
188
-
189
- range.setStart(editor.editor.firstChild.firstChild, 10);
190
- range.collapse(true);
191
- editor.s.selectRange(range);
192
-
193
- simulateEvent(
194
- 'keydown',
195
- Jodit.KEY_BACKSPACE,
196
- editor.editor,
197
- function (opt) {
198
- opt.ctrlKey = true;
199
- }
200
- );
201
-
202
- expect(editor.value).equals('<p> world</p>');
203
- });
204
-
205
- describe('Delete`', function () {
206
- it('Should remove next whole part of text after cursor', function () {
207
- editor.value = '<p>Hello evil world</p>';
208
-
209
- range.setStart(editor.editor.firstChild.firstChild, 10);
210
- range.collapse(true);
211
- editor.s.selectRange(range);
212
-
213
- simulateEvent(
214
- 'keydown',
215
- Jodit.KEY_DELETE,
216
- editor.editor,
217
- function (opt) {
218
- opt.ctrlKey = true;
219
- }
220
- );
221
-
222
- expect(editor.value).equals('<p>Hello evil</p>');
223
- });
224
- });
225
- });
226
- });
227
-
228
- describe('Delete', function () {
229
- it('Should remove next char after cursor', function () {
230
- range.setStart(editor.editor.firstChild.firstChild, 2);
231
- range.collapse(true);
232
- editor.s.selectRange(range);
233
-
234
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
235
-
236
- expect(editor.value).equals('<p>tet</p>');
237
- });
238
- });
239
-
240
- describe('Near with invisible char', function () {
241
- describe('BackSpace', function () {
242
- it('Should remove previous char and invisible char before cursor', function () {
243
- editor.value = '<p>te' + Jodit.INVISIBLE_SPACE + 'st</p>';
244
-
245
- range.setStart(editor.editor.firstChild.firstChild, 3);
246
- editor.s.selectRange(range);
247
-
248
- simulateEvent(
249
- 'keydown',
250
- Jodit.KEY_BACKSPACE,
251
- editor.editor
252
- );
253
-
254
- expect(editor.value).equals('<p>tst</p>');
255
- });
256
- });
257
-
258
- describe('Delete', function () {
259
- it('Should remove next char and invisible char after cursor', function () {
260
- editor.value = '<p>te' + Jodit.INVISIBLE_SPACE + 'st</p>';
261
-
262
- range.setStart(editor.editor.firstChild.firstChild, 2);
263
- editor.s.selectRange(range);
264
-
265
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
266
-
267
- expect(editor.value).equals('<p>tet</p>');
268
- });
269
- });
270
-
271
- describe('After BackSpace/Delete left empty node', function () {
272
- describe('BackSpace', function () {
273
- it('Should remove whole node', function () {
274
- editor.value = '<p>' + Jodit.INVISIBLE_SPACE + 's</p>';
275
-
276
- range.setStart(editor.editor.firstChild.firstChild, 2);
277
- editor.s.selectRange(range);
278
-
279
- simulateEvent(
280
- 'keydown',
281
- Jodit.KEY_BACKSPACE,
282
- editor.editor
283
- );
284
-
285
- expect(editor.getNativeEditorValue()).equals(
286
- '<p><br></p>'
287
- );
288
- });
289
- });
290
-
291
- describe('Delete', function () {
292
- it('Should remove whole node', function () {
293
- editor.value = '<p>d' + Jodit.INVISIBLE_SPACE + '</p>';
294
-
295
- range.setStart(editor.editor.firstChild.firstChild, 0);
296
- editor.s.selectRange(range);
297
-
298
- simulateEvent(
299
- 'keydown',
300
- Jodit.KEY_DELETE,
301
- editor.editor
302
- );
303
-
304
- expect(editor.getNativeEditorValue()).equals(
305
- '<p><br></p>'
306
- );
307
- });
308
- });
309
- });
310
- });
311
-
312
- describe('Cursor after empty text node', function () {
313
- describe('BackSpace', function () {
314
- it('Should remove this empty text node and first normal char in previous node', function () {
315
- const p = editor.editor.firstChild;
316
-
317
- p.appendChild(
318
- editor.createInside.text(
319
- Jodit.INVISIBLE_SPACE.repeat(4)
320
- )
321
- );
322
-
323
- p.appendChild(
324
- editor.createInside.text(
325
- Jodit.INVISIBLE_SPACE.repeat(4) + 'stop'
326
- )
327
- );
328
-
329
- expect(p.childNodes.length).equals(3);
330
-
331
- range.setStart(p.lastChild, 4);
332
- editor.s.selectRange(range);
333
-
334
- simulateEvent(
335
- 'keydown',
336
- Jodit.KEY_BACKSPACE,
337
- editor.editor
338
- );
339
-
340
- expect(p.childNodes.length).equals(2);
341
- expect(editor.getNativeEditorValue()).equals(
342
- '<p>tesstop</p>'
343
- );
344
- });
345
- });
346
-
347
- describe('Delete', function () {
348
- it('Should remove this empty text node and first normal char in next node', function () {
349
- const p = editor.editor.firstChild;
350
-
351
- p.appendChild(
352
- editor.createInside.text(
353
- Jodit.INVISIBLE_SPACE.repeat(4)
354
- )
355
- );
356
-
357
- p.appendChild(
358
- editor.createInside.text(
359
- Jodit.INVISIBLE_SPACE.repeat(4) + 'stop'
360
- )
361
- );
362
-
363
- expect(p.childNodes.length).equals(3);
364
-
365
- range.setStart(p.firstChild, 4);
366
- editor.s.selectRange(range);
367
-
368
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
369
-
370
- expect(p.childNodes.length).equals(2);
371
- expect(editor.getNativeEditorValue()).equals(
372
- '<p>testtop</p>'
373
- );
374
- });
375
- });
376
- });
377
- });
378
-
379
- describe('Near with some inseparable element', function () {
380
- describe('Backspace', function () {
381
- it('Should remove this element like simple char', function () {
382
- editor.value = '<p>test<img/>test</p>';
383
-
384
- range.setStartAfter(
385
- editor.editor.firstChild.firstChild.nextSibling
386
- );
387
- editor.s.selectRange(range);
388
-
389
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
390
-
391
- expect(editor.value).equals('<p>testtest</p>');
392
- });
393
-
394
- describe('Previous element has contenteditable false', function () {
395
- it('Should remove this element like simple char', function () {
396
- editor.value =
397
- '<p>test<a href="#" contenteditable="false">pop</a>test</p>';
398
-
399
- range.setStartAfter(
400
- editor.editor.firstChild.firstChild.nextSibling
401
- );
402
- editor.s.selectRange(range);
403
-
404
- simulateEvent(
405
- 'keydown',
406
- Jodit.KEY_BACKSPACE,
407
- editor.editor
408
- );
409
-
410
- expect(editor.value).equals('<p>testtest</p>');
411
- });
412
- });
413
- });
414
-
415
- describe('Delete', function () {
416
- it('Should remove this element like simple char', function () {
417
- editor.value = '<p>test<img/>test</p>';
418
-
419
- range.setStartBefore(
420
- editor.editor.firstChild.firstChild.nextSibling
421
- );
422
- editor.s.selectRange(range);
423
-
424
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
425
-
426
- expect(editor.value).equals('<p>testtest</p>');
427
- });
428
-
429
- describe('Next element has contenteditable false', function () {
430
- it('Should remove this element like simple char', function () {
431
- editor.value =
432
- '<p>test<a href="#" contenteditable="false">pop</a>test</p>';
433
-
434
- range.setStartBefore(
435
- editor.editor.firstChild.firstChild.nextSibling
436
- );
437
- editor.s.selectRange(range);
438
-
439
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
440
-
441
- expect(editor.value).equals('<p>testtest</p>');
442
- });
443
- });
444
- });
445
- });
446
-
447
- describe('inside empty P', function () {
448
- describe('Backspace', function () {
449
- it('Should remove empty tag', function () {
450
- editor.value = '<p><br></p>';
451
-
452
- range.setStartBefore(editor.editor.firstChild.firstChild);
453
- editor.s.selectRange(range);
454
-
455
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
456
-
457
- editor.s.insertNode(editor.createInside.text(' 2 '));
458
-
459
- expect(editor.value).equals('<p> 2 </p>');
460
- });
461
-
462
- describe('Near has element', function () {
463
- it('Should remove empty tag and set cursor in previous element', function () {
464
- editor.value =
465
- '<table><tbody>' +
466
- '<tr><td>1</td></tr>' +
467
- '</tbody></table><p><br></p>';
468
-
469
- const range = editor.s.createRange();
470
-
471
- range.setStartBefore(editor.editor.lastChild.firstChild);
472
- editor.s.selectRange(range);
473
-
474
- simulateEvent(
475
- 'keydown',
476
- Jodit.KEY_BACKSPACE,
477
- editor.editor
478
- );
479
-
480
- editor.s.insertNode(editor.createInside.text(' 2 '));
481
-
482
- expect(editor.value).equals(
483
- '<table><tbody>' +
484
- '<tr><td>1 2 </td></tr>' +
485
- '</tbody></table>'
486
- );
487
- });
488
-
489
- describe('For formatted HTML', function () {
490
- it('Should work same', function () {
491
- editor.value = '<p>asdas</p>\n' + '<p><br></p>';
492
-
493
- const range = editor.s.createRange(true);
494
-
495
- range.setStartBefore(
496
- editor.editor.lastChild.firstChild
497
- );
498
-
499
- simulateEvent(
500
- 'keydown',
501
- Jodit.KEY_BACKSPACE,
502
- editor.editor
503
- );
504
-
505
- editor.s.insertNode(editor.createInside.text(' 2 '));
506
-
507
- expect(editor.value).equals('<p>asdas 2 </p>\n');
508
- });
509
- });
510
-
511
- describe('Inside this element and this element empty', function () {
512
- it('Should remove empty this empty element', function () {
513
- editor.value = '';
514
-
515
- editor.s.focus();
516
-
517
- simulateEvent(
518
- 'keydown',
519
- Jodit.KEY_ENTER,
520
- editor.editor
521
- );
522
-
523
- editor.s.insertHTML('b');
524
- expect(editor.value).equals('<p><br></p><p>b<br></p>');
525
-
526
- simulateEvent(
527
- 'keydown',
528
- Jodit.KEY_BACKSPACE,
529
- editor.editor
530
- );
531
- expect(editor.value).equals('<p><br></p><p><br></p>');
532
-
533
- simulateEvent(
534
- 'keydown',
535
- Jodit.KEY_BACKSPACE,
536
- editor.editor
537
- );
538
-
539
- expect(editor.value).equals('<p><br></p>');
540
-
541
- simulateEvent(
542
- 'keydown',
543
- Jodit.KEY_BACKSPACE,
544
- editor.editor
545
- );
546
-
547
- expect(editor.value).equals('');
548
-
549
- simulateEvent(
550
- 'keydown',
551
- Jodit.KEY_BACKSPACE,
552
- editor.editor
553
- );
554
-
555
- expect(editor.value).equals('');
556
- });
557
- });
558
- });
559
- });
560
-
561
- describe('Delete', function () {
562
- it('Should remove empty tag', function () {
563
- editor.value = '<p><br></p>';
564
-
565
- range.setStartAfter(editor.editor.firstChild.firstChild);
566
- editor.s.selectRange(range);
567
-
568
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
569
-
570
- editor.s.insertNode(editor.createInside.text(' 2 '));
571
-
572
- expect(editor.value).equals('<p> 2 </p>');
573
- });
574
-
575
- describe('Near has element', function () {
576
- it('Should remove empty tag and set cursor in next element', function () {
577
- editor.value =
578
- '<p><br></p><table><tbody>' +
579
- '<tr><td></td></tr>' +
580
- '</tbody></table>';
581
-
582
- range.setStartAfter(editor.editor.firstChild.firstChild);
583
- editor.s.selectRange(range);
584
-
585
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
586
-
587
- editor.s.insertNode(editor.createInside.text(' 2 '));
588
-
589
- expect(editor.value).equals(
590
- '<table><tbody>' +
591
- '<tr><td> 2 </td></tr>' +
592
- '</tbody></table>'
593
- );
594
- });
595
- });
596
- });
597
- });
598
-
599
- describe('near empty tag', function () {
600
- describe('BR before P', function () {
601
- it('Should simple remove BR but cursor should leave inside P', function () {
602
- editor.value = '<br><p>test</p>';
603
-
604
- // set cursor in start of element
605
-
606
- range.setStartBefore(editor.editor.lastChild.firstChild);
607
- editor.s.selectRange(range);
608
-
609
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
610
-
611
- editor.s.insertNode(editor.createInside.text(' 2 '));
612
- expect(editor.value).equals('<p> 2 test</p>');
613
- });
614
- });
615
-
616
- describe('HR before P', function () {
617
- it('Should simple remove HR but cursor should leave inside P', function () {
618
- editor.value = '<p>lets</p><hr><p>test</p>';
619
-
620
- const range = editor.s.createRange();
621
-
622
- // set cursor in start of element
623
-
624
- range.selectNodeContents(editor.editor.lastChild);
625
- range.collapse(true);
626
- editor.s.selectRange(range);
627
-
628
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
629
-
630
- editor.s.insertNode(editor.createInside.text(' 2 '));
631
- expect(editor.value).equals('<p>lets</p><p> 2 test</p>');
632
- });
633
-
634
- describe('HR has different display style', function () {
635
- it('Should also remove HR but cursor should leave inside P', function () {
636
- const editor = getJodit({
637
- iframe: true,
638
- iframeStyle:
639
- Jodit.defaultOptions.iframeStyle +
640
- 'hr {display: inline-block;}'
641
- });
642
-
643
- editor.value = '<p>lets</p><hr><p>test</p>';
644
-
645
- const range = editor.s.createRange();
646
-
647
- // set cursor in start of element
648
-
649
- range.selectNodeContents(editor.editor.lastChild);
650
- range.collapse(true);
651
- editor.s.selectRange(range);
652
-
653
- simulateEvent(
654
- 'keydown',
655
- Jodit.KEY_BACKSPACE,
656
- editor.editor
657
- );
658
-
659
- editor.s.insertNode(editor.createInside.text(' 2 '));
660
- expect(editor.value).equals('<p>lets</p><p> 2 test</p>');
661
- });
662
- });
663
- });
664
-
665
- describe('The neighbor is empty H1', function () {
666
- describe('Backspace', function () {
667
- it('Should simple remove this H1', function () {
668
- editor.value = '<h1></h1><p>test</p>';
669
-
670
- range.setStartBefore(editor.editor.lastChild.firstChild);
671
- editor.s.selectRange(range);
672
-
673
- simulateEvent(
674
- 'keydown',
675
- Jodit.KEY_BACKSPACE,
676
- editor.editor
677
- );
678
-
679
- expect(editor.value).equals('<p>test</p>');
680
- });
681
-
682
- describe('H1 with BR', function () {
683
- it('Should simple remove this H1', function () {
684
- const editor = getJodit();
685
-
686
- editor.value = '<h1><br></h1><p>|test</p>';
687
- setCursorToChar(editor);
688
-
689
- simulateEvent(
690
- 'keydown',
691
- Jodit.KEY_BACKSPACE,
692
- editor.editor
693
- );
694
-
695
- expect(editor.value).equals('<p>test</p>');
696
- });
697
- });
698
- });
699
-
700
- describe('Delete', function () {
701
- it('Should simple remove this H1', function () {
702
- const editor = getJodit();
703
-
704
- editor.value = '<p>test|</p><h1></h1>';
705
- setCursorToChar(editor);
706
-
707
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
708
-
709
- expect(editor.value).equals('<p>test</p>');
710
- });
711
-
712
- describe('H1 with BR', function () {
713
- it('Should simple remove this H1', function () {
714
- const editor = getJodit();
715
-
716
- editor.value = '<p>test|</p><h1><br></h1>';
717
- setCursorToChar(editor);
718
- simulateEvent(
719
- 'keydown',
720
- Jodit.KEY_DELETE,
721
- editor.editor
722
- );
723
-
724
- expect(editor.value).equals('<p>test</p>');
725
- });
726
- });
727
- });
728
- });
729
- });
730
-
731
- describe('inside empty TD', function () {
732
- it('Should doing nothing', function () {
733
- const editor = getJodit();
734
-
735
- editor.value =
736
- '<table><tbody>' + '<tr><td></td></tr>' + '</tbody></table>';
737
-
738
- editor.s.setCursorIn(editor.editor.querySelector('td'));
739
-
740
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
741
- expect(
742
- '<table><tbody>' + '<tr><td></td></tr>' + '</tbody></table>'
743
- ).equals(editor.value);
744
-
745
- editor.s.focus();
746
- editor.s.insertNode(editor.createInside.text(' 2 '));
747
-
748
- expect(
749
- '<table><tbody>' + '<tr><td> 2 </td></tr>' + '</tbody></table>'
750
- ).equals(editor.value);
751
- });
752
- });
753
-
754
- describe('after last char inside tag', function () {
755
- describe('inside A', function () {
756
- it('Should remove empty tag and set cursor in previous element', function () {
757
- editor.value = '<p><a href="#test">t</a></p>';
758
-
759
- editor.s.setCursorIn(
760
- editor.editor.firstChild.firstChild,
761
- false
762
- );
763
-
764
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
765
-
766
- expect(editor.value).equals('<p><br></p>');
767
- });
768
- });
769
-
770
- describe('inside P', function () {
771
- it('Should not remove empty tag', function () {
772
- editor.value = '<p>r</p><p>t</p>';
773
-
774
- editor.s.setCursorIn(editor.editor.lastChild, false);
775
-
776
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
777
-
778
- expect(editor.value).equals('<p>r</p><p><br></p>');
779
- });
780
- });
781
- });
782
-
783
- describe('Cursor after/before element', function () {
784
- describe('Backspace key', function () {
785
- it('Should remove that element', function () {
786
- const editor = getJodit();
787
- editor.value = '<p><img src="tests/artio.jpg"/>|test</p>';
788
- setCursorToChar(editor);
789
-
790
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
791
-
792
- expect('<p>test</p>').equals(editor.value);
793
-
794
- editor.s.insertNode(editor.createInside.text(' a '));
795
- expect('<p> a test</p>').equals(editor.value);
796
- });
797
-
798
- describe('After P before Table', function () {
799
- it('Should remove P', function () {
800
- const editor = getJodit();
801
- editor.value =
802
- '<p><br></p><table><tbody><tr><td>1</td></tr></tbody></table>';
803
-
804
- const range = editor.s.createRange();
805
-
806
- range.setStartAfter(editor.editor.firstChild);
807
- range.collapse(true);
808
- editor.s.selectRange(range);
809
-
810
- simulateEvent(
811
- 'keydown',
812
- Jodit.KEY_BACKSPACE,
813
- editor.editor
814
- );
815
-
816
- expect(editor.value).equals(
817
- '<table><tbody><tr><td>1</td></tr></tbody></table>'
818
- );
819
-
820
- editor.s.insertNode(editor.createInside.text(' a '));
821
- expect(editor.value).equals(
822
- '<p> a </p><table><tbody><tr><td>1</td></tr></tbody></table>'
823
- );
824
- });
825
- });
826
- });
827
-
828
- describe('Delete key', function () {
829
- it('Should remove that element', function () {
830
- const editor = getJodit();
831
- editor.value = '<p>test|<img src="tests/artio.jpg"/></p>';
832
- setCursorToChar(editor);
833
-
834
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
835
-
836
- expect('<p>test</p>').equals(editor.value);
837
-
838
- editor.s.insertNode(editor.createInside.text(' a '));
839
- expect('<p>test a </p>').equals(editor.value);
840
- });
841
- });
842
- });
843
-
844
- describe('More cases', function () {
845
- [
846
- '<p><em>ab</em><em>|cd</em></p> => <p><em>a|</em><em>cd</em></p>',
847
- '<table><tbody><tr><td>|ab</td></tr></tbody></table> => <table><tbody><tr><td>|ab</td></tr></tbody></table>',
848
- '<table><tbody><tr><td>ab</td><td>|ab</td></tr></tbody></table> => <table><tbody><tr><td>ab</td><td>|ab</td></tr></tbody></table>',
849
- '<p>ab|cd</p> => <p>a|cd</p>',
850
- '<p>ab<strong>cd</strong>|ef</p> => <p>ab<strong>c|</strong>ef</p>',
851
- '<p>ab<img src="tests/artio.jpg">|cd</p> => <p>ab|cd</p>',
852
- '<p>ab</p>\n <p>|<br></p> => <p>ab|</p>\n ',
853
- '<p>ab</p><p>|cd</p> => <p>ab|cd</p>',
854
- '<p>ab</p>\n<blockquote>|cd</blockquote> => <p>ab|cd</p>\n',
855
- '<p>ab</p>\n<h1>|cd</h1> => <p>ab|cd</p>\n',
856
- '<h1>cd</h1><p>|ab</p> => <h1>cd|ab</h1>',
857
- '<p>ab</p>\n\n\n<p><strong>|cd</strong></p> => <p>ab<strong>|cd</strong></p>\n\n\n',
858
- '<p>ab</p><p><strong>|cd</strong><em>ef</em></p> => <p>ab<strong>|cd</strong><em>ef</em></p>',
859
- '<p><strong>ab</strong></p><p><strong>|cd</strong></p> => <p><strong>ab</strong><strong>|cd</strong></p>',
860
- '<p><strong>ab</strong></p><p><strong><em>|cd</em></strong></p> => <p><strong>ab</strong><strong><em>|cd</em></strong></p>',
861
- '<p><strong>ab</strong></p><p><strong>|cd</strong><em>e</em></p> => <p><strong>ab</strong><strong>|cd</strong><em>e</em></p>',
862
- '<p><a>ab</a></p><p><strong>|cd</strong><em>e</em></p> => <p><a>ab</a><strong>|cd</strong><em>e</em></p>',
863
- '<ol><li>ab</li></ol><p>|cd</p> => <ol><li>ab|cd</li></ol>',
864
- '<p>ab</p><ol><li>|cd</li></ol> => <p>ab</p><p>|cd</p>',
865
- '<ol><li>ab</li><li>|cd</li></ol> => <ol><li>ab|cd</li></ol>',
866
- '<ol><li>ab</li></ol><ul><li>|cd</li><li>e</li></ul> => <ol><li>ab</li></ol><p>|cd</p><ul><li>e</li></ul>'
867
- ].forEach(function (pars) {
868
- const [key, value] = pars.split(' => ');
869
-
870
- describe(`For key "${key}"`, function () {
871
- it(`Should be ${value}`, function () {
872
- editor.value = key;
873
- setCursorToChar(editor);
874
- simulateEvent(
875
- 'keydown',
876
- Jodit.KEY_BACKSPACE,
877
- editor.editor
878
- );
879
- editor.s.insertHTML('|');
880
- expect(sortAttributes(editor.value)).equals(value);
881
- });
882
- });
883
- });
884
- });
885
-
886
- describe('On the edge of two tag', function () {
887
- describe('Backspace', function () {
888
- it('Should connect both elements in one element', function () {
889
- editor.value = '<p>Test</p><p>Test</p>';
890
-
891
- range.setStart(editor.editor.lastChild.firstChild, 0);
892
- editor.s.selectRange(range);
893
-
894
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
895
-
896
- expect(sortAttributes(editor.value)).equals('<p>TestTest</p>');
897
-
898
- editor.s.insertHTML(' a ');
899
- expect(editor.value).equals('<p>Test a Test</p>');
900
- });
901
-
902
- describe('inline elements', function () {
903
- it('Should move cursor inside first element', function () {
904
- editor.value =
905
- '<div><span style="color: rgb(0, 0, 255);">This is</span></div>\n' +
906
- '<div><span style="color: rgb(0, 0, 255);">my line</span></div>';
907
-
908
- range.setStart(
909
- editor.editor.querySelectorAll('span')[1].firstChild,
910
- 0
911
- );
912
- editor.s.selectRange(range);
913
-
914
- simulateEvent(
915
- 'keydown',
916
- Jodit.KEY_BACKSPACE,
917
- editor.editor
918
- );
919
-
920
- expect(sortAttributes(editor.value)).equals(
921
- '<div><span style="color:#0000FF">This is</span><span style="color:#0000FF">my line</span></div>\n'
922
- );
923
-
924
- editor.s.insertHTML(' a ');
925
- expect(sortAttributes(editor.value)).equals(
926
- '<div><span style="color:#0000FF">This is</span><span style="color:#0000FF"> a my line</span></div>\n'
927
- );
928
- });
929
- });
930
-
931
- describe('Several elements', function () {
932
- it('Should connect both elements in one element and move all children in previous element', function () {
933
- editor.value =
934
- '<div><span>This is</span></div>\n' +
935
- '<div><span>|my line</span><strong>test</strong></div>';
936
-
937
- setCursorToChar(editor);
938
-
939
- simulateEvent(
940
- 'keydown',
941
- Jodit.KEY_BACKSPACE,
942
- editor.editor
943
- );
944
-
945
- expect(sortAttributes(editor.value)).equals(
946
- '<div><span>This is</span><span>my line</span><strong>test</strong></div>\n'
947
- );
948
- });
949
-
950
- describe('Different elements', function () {
951
- it('Should move content', function () {
952
- editor.value =
953
- '<div><span>This is</span></div>\n' +
954
- '<div><strong>|my line</strong><strong>test</strong></div>';
955
-
956
- setCursorToChar(editor);
957
-
958
- simulateEvent(
959
- 'keydown',
960
- Jodit.KEY_BACKSPACE,
961
- editor.editor
962
- );
963
-
964
- expect(sortAttributes(editor.value)).equals(
965
- '<div><span>This is</span><strong>my line</strong><strong>test</strong></div>\n'
966
- );
967
- });
968
- });
969
- });
970
-
971
- describe('P after UL and cursor in the left edge of P', function () {
972
- it('Should remove P and move all this content inside last LI', function () {
973
- editor.value =
974
- '<p>AAA</p>\n' +
975
- '<ul>\n' +
976
- ' <li>BBB</li>\n' +
977
- ' <li>BBB</li>\n' +
978
- ' <li>BBB</li>\n' +
979
- '</ul><p>CCC</p>';
980
-
981
- range.setStart(editor.editor.lastChild.firstChild, 0);
982
-
983
- simulateEvent(
984
- 'keydown',
985
- Jodit.KEY_BACKSPACE,
986
- editor.editor
987
- );
988
-
989
- expect(sortAttributes(editor.value)).equals(
990
- '<p>AAA</p>\n' +
991
- '<ul>\n' +
992
- ' <li>BBB</li>\n' +
993
- ' <li>BBB</li>\n' +
994
- ' <li>BBBCCC</li>\n' +
995
- '</ul>'
996
- );
997
-
998
- editor.s.insertHTML(' a ');
999
- expect(editor.value).equals(
1000
- '<p>AAA</p>\n' +
1001
- '<ul>\n' +
1002
- ' <li>BBB</li>\n' +
1003
- ' <li>BBB</li>\n' +
1004
- ' <li>BBB a CCC</li>\n' +
1005
- '</ul>'
1006
- );
1007
- });
1008
- });
1009
-
1010
- describe('H1 after P and cursor in the left edge of H1', function () {
1011
- it('Should remove H1 and move all this content inside last P', function () {
1012
- editor.value = '<p>AAA</p><h1>CCC</h1>';
1013
-
1014
- range.setStart(editor.editor.lastChild.firstChild, 0);
1015
-
1016
- simulateEvent(
1017
- 'keydown',
1018
- Jodit.KEY_BACKSPACE,
1019
- editor.editor
1020
- );
1021
-
1022
- expect(sortAttributes(editor.value)).equals(
1023
- '<p>AAACCC</p>'
1024
- );
1025
- });
1026
- });
1027
-
1028
- describe('Space between two elements', function () {
1029
- it('Should connect both elements in one element', function () {
1030
- editor.value = '<p>Test</p> \n <p>Test</p>';
1031
-
1032
- range.setStart(editor.editor.lastChild.firstChild, 0);
1033
- editor.s.selectRange(range);
1034
-
1035
- simulateEvent(
1036
- 'keydown',
1037
- Jodit.KEY_BACKSPACE,
1038
- editor.editor
1039
- );
1040
-
1041
- expect(sortAttributes(editor.value)).equals(
1042
- '<p>TestTest</p> \n '
1043
- );
1044
-
1045
- editor.s.insertHTML(' a ');
1046
- expect(editor.value).equals('<p>Test a Test</p> \n ');
1047
- });
1048
- });
1049
- });
1050
-
1051
- describe('Delete', function () {
1052
- it('Should connect both elements in one element', function () {
1053
- editor.value = '<p>Test</p><p>Test</p>';
1054
-
1055
- range.setStartAfter(editor.editor.firstChild.firstChild);
1056
- editor.s.selectRange(range);
1057
-
1058
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
1059
-
1060
- expect(sortAttributes(editor.value)).equals('<p>TestTest</p>');
1061
-
1062
- editor.s.insertHTML(' a ');
1063
- expect(editor.value).equals('<p>Test a Test</p>');
1064
- });
1065
- });
1066
- });
1067
-
1068
- describe('In the middle of two UL elements', function () {
1069
- describe('Backspace', function () {
1070
- describe('In first LI of second UL', function () {
1071
- it('Should move content of this LI and put it inside new P', function () {
1072
- editor.value =
1073
- '<ul><li>Test</li></ul><ul><li>|Some text</li></ul>';
1074
-
1075
- setCursorToChar(editor);
1076
-
1077
- simulateEvent(
1078
- 'keydown',
1079
- Jodit.KEY_BACKSPACE,
1080
- editor.editor
1081
- );
1082
-
1083
- expect(sortAttributes(editor.value)).equals(
1084
- '<ul><li>Test</li></ul><p>Some text</p>'
1085
- );
1086
-
1087
- editor.s.insertNode(editor.createInside.text(' a '));
1088
-
1089
- expect(sortAttributes(editor.value)).equals(
1090
- '<ul><li>Test</li></ul><p> a Some text</p>'
1091
- );
1092
- });
1093
- });
1094
-
1095
- describe('In the P element', function () {
1096
- it('Should connect both UL in one element', function () {
1097
- editor.value =
1098
- '<ul><li>Test</li></ul><p>|<br></p><ul><li>Some text</li></ul>';
1099
-
1100
- setCursorToChar(editor);
1101
-
1102
- editor.s.focus();
1103
-
1104
- simulateEvent(
1105
- 'keydown',
1106
- Jodit.KEY_BACKSPACE,
1107
- editor.editor
1108
- );
1109
-
1110
- expect(sortAttributes(editor.value)).equals(
1111
- '<ul><li>Test</li><li>Some text</li></ul>'
1112
- );
1113
-
1114
- editor.s.focus();
1115
- editor.s.insertNode(editor.createInside.text(' a '));
1116
- expect(editor.value).equals(
1117
- '<ul><li>Test a </li><li>Some text</li></ul>'
1118
- );
1119
- });
1120
- });
1121
- });
1122
-
1123
- describe('Delete', function () {
1124
- describe('In last LI of first UL', function () {
1125
- it('Should connect both UL in one element', function () {
1126
- editor.value =
1127
- '<ul><li>Test|</li></ul><ul><li>Some text</li></ul>';
1128
-
1129
- setCursorToChar(editor);
1130
-
1131
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
1132
-
1133
- expect(sortAttributes(editor.value)).equals(
1134
- '<p>Test</p><ul><li>Some text</li></ul>'
1135
- );
1136
-
1137
- editor.s.insertNode(editor.createInside.text(' a '));
1138
-
1139
- expect(sortAttributes(editor.value)).equals(
1140
- '<p>Test a </p><ul><li>Some text</li></ul>'
1141
- );
1142
- });
1143
- });
1144
-
1145
- describe('In the P element', function () {
1146
- it('Should connect both UL in one element', function () {
1147
- editor.value =
1148
- '<ul><li>Test</li><li> </li><li>Some text</li></ul>';
1149
-
1150
- range.setStart(editor.editor.firstChild.childNodes[1], 0);
1151
- editor.s.selectRange(range);
1152
-
1153
- simulateEvent('keydown', Jodit.KEY_ENTER, editor.editor);
1154
-
1155
- expect(sortAttributes(editor.value)).equals(
1156
- '<ul><li>Test</li></ul><p><br></p><ul><li>Some text</li></ul>'
1157
- );
1158
-
1159
- editor.s.focus();
1160
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
1161
-
1162
- expect(sortAttributes(editor.value)).equals(
1163
- '<ul><li>Test</li><li>Some text</li></ul>'
1164
- );
1165
-
1166
- editor.s.focus();
1167
- editor.s.insertNode(editor.createInside.text(' a '));
1168
- expect(editor.value).equals(
1169
- '<ul><li>Test</li><li> a Some text</li></ul>'
1170
- );
1171
- });
1172
- });
1173
- });
1174
- });
1175
-
1176
- describe('Enter backspace/delete in the start of some LI', function () {
1177
- describe('in first LI', function () {
1178
- describe('Enter backspace', function () {
1179
- it('Should remove this LI and move all conntent in P', function () {
1180
- editor.value = '<ul><li>Test</li><li>Some text</li></ul>';
1181
-
1182
- range.setStart(
1183
- editor.editor.firstChild.firstChild.firstChild,
1184
- 0
1185
- );
1186
- editor.s.selectRange(range);
1187
-
1188
- simulateEvent(
1189
- 'keydown',
1190
- Jodit.KEY_BACKSPACE,
1191
- editor.editor
1192
- );
1193
-
1194
- expect('<p>Test</p><ul><li>Some text</li></ul>').equals(
1195
- editor.value
1196
- );
1197
-
1198
- editor.s.insertNode(editor.createInside.text(' a '));
1199
- expect('<p> a Test</p><ul><li>Some text</li></ul>').equals(
1200
- editor.value
1201
- );
1202
- });
1203
- });
1204
-
1205
- describe('Enter delete', function () {
1206
- it('Should remove all text content and after this remove that LI', function () {
1207
- editor.value =
1208
- '<ul><li>' +
1209
- Jodit.INVISIBLE_SPACE +
1210
- '</li><li>Some text</li></ul>';
1211
-
1212
- range.setStart(
1213
- editor.editor.firstChild.firstChild.firstChild,
1214
- 0
1215
- );
1216
- editor.s.selectRange(range);
1217
-
1218
- simulateEvent('keydown', Jodit.KEY_DELETE, editor.editor);
1219
- expect('<ul><li>Some text</li></ul>').equals(editor.value);
1220
-
1221
- editor.s.insertNode(editor.createInside.text(' a '));
1222
- expect('<ul><li> a Some text</li></ul>').equals(
1223
- editor.value
1224
- );
1225
- });
1226
- });
1227
- });
1228
-
1229
- describe('in alone LI', function () {
1230
- it('Should remove this LI and UL and move all content in P', function () {
1231
- editor.value = '<ul><li>Test</li></ul>';
1232
-
1233
- range.setStart(
1234
- editor.editor.firstChild.childNodes[0].firstChild,
1235
- 0
1236
- );
1237
- editor.s.selectRange(range);
1238
-
1239
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
1240
-
1241
- expect('<p>Test</p>').equals(editor.value);
1242
-
1243
- editor.s.insertNode(editor.createInside.text(' a '));
1244
- expect('<p> a Test</p>').equals(editor.value);
1245
- });
1246
- });
1247
-
1248
- it('Should connect this LI with previous', function () {
1249
- editor.value = '<ul><li>Test</li><li>Some text</li></ul>';
1250
-
1251
- range.setStart(
1252
- editor.editor.firstChild.childNodes[1].firstChild,
1253
- 0
1254
- );
1255
-
1256
- editor.s.selectRange(range);
1257
-
1258
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
1259
-
1260
- expect(editor.value).equals('<ul><li>TestSome text</li></ul>');
1261
-
1262
- editor.s.insertNode(editor.createInside.text(' a '));
1263
- expect(editor.value).equals('<ul><li>Test a Some text</li></ul>');
1264
- });
1265
-
1266
- describe('And enter Enter', function () {
1267
- it('Should split this LI on two again', function () {
1268
- editor.value = '<ul><li>Test</li><li>Some text</li></ul>';
1269
-
1270
- range.setStart(
1271
- editor.editor.firstChild.childNodes[1].firstChild,
1272
- 0
1273
- );
1274
- editor.s.selectRange(range);
1275
-
1276
- simulateEvent('keydown', Jodit.KEY_BACKSPACE, editor.editor);
1277
- simulateEvent('keyup', Jodit.KEY_BACKSPACE, editor.editor);
1278
-
1279
- expect('<ul><li>TestSome text</li></ul>').equals(editor.value);
1280
-
1281
- simulateEvent('keydown', Jodit.KEY_ENTER, editor.editor);
1282
-
1283
- expect(editor.value).equals(
1284
- '<ul><li>Test</li><li>Some text</li></ul>'
1285
- );
1286
- });
1287
- });
1288
- });
1289
- });