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,344 +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('Test editor size plugin', function () {
7
- it('should show resize handler in right-bottom corner and allow resize editor by vertical', function () {
8
- const editor = getJodit({
9
- height: 300,
10
- iframe: true
11
- });
12
-
13
- expect(
14
- editor.container.querySelectorAll('.jodit-editor__resize').length
15
- ).equals(1);
16
- });
17
-
18
- describe('Sizes', function () {
19
- describe('Set calc expression as height', function () {
20
- it('Should set editor height by option', function () {
21
- getBox().style.height = '400px';
22
-
23
- const editor = getJodit({
24
- height: 'calc(100% - 20px)'
25
- });
26
-
27
- editor.value = '<p>test</p>'.repeat(100);
28
- expect(editor.container.offsetHeight).equals(380);
29
- });
30
- });
31
-
32
- describe('Set fixed height', function () {
33
- it('Should set editor height by option', function () {
34
- const area = appendTestArea();
35
- const editor = new Jodit(area, {
36
- height: 300
37
- });
38
-
39
- editor.value = '<p>test</p>'.repeat(100);
40
-
41
- expect(editor.container.offsetHeight).equals(300);
42
- });
43
-
44
- it('Should set editor height by option for iframe', function () {
45
- const editor = getJodit({
46
- height: 300,
47
- iframe: true
48
- });
49
-
50
- editor.value = '<p>test</p>'.repeat(100);
51
- expect(editor.container.offsetHeight).equals(300);
52
- });
53
-
54
- it('Should not change size by content after window was resized', function () {
55
- const editor = getJodit({
56
- height: 300
57
- });
58
-
59
- editor.value = '<p>test</p>'.repeat(20);
60
- expect(editor.container.offsetHeight).equals(300);
61
-
62
- simulateEvent('resize', 0, window);
63
- expect(editor.container.offsetHeight).equals(300);
64
- });
65
-
66
- describe('Fullsize mode', function () {
67
- it("Should set heights of workplace to 100% - toolbar's height", function () {
68
- const editor = getJodit({
69
- fullsize: true
70
- });
71
-
72
- expect(editor.workplace.offsetHeight).to.be.above(300);
73
- });
74
-
75
- it('Should restore size after fullsized mode', function () {
76
- const editor = getJodit({
77
- height: 300
78
- });
79
-
80
- editor.value = '<p>test</p>'.repeat(20);
81
- expect(editor.container.offsetHeight).equals(300);
82
-
83
- editor.toggleFullSize(true);
84
- expect(editor.container.offsetHeight).to.be.above(300);
85
-
86
- editor.toggleFullSize(false);
87
- expect(editor.container.offsetHeight).equals(300);
88
- expect(editor.container.offsetWidth).to.be.above(300);
89
- });
90
-
91
- it('Should hide resizer', function () {
92
- const editor = getJodit({
93
- height: 300,
94
- iframe: true
95
- });
96
-
97
- const handle = editor.container.querySelector(
98
- '.jodit-editor__resize'
99
- );
100
-
101
- expect(handle).is.not.null;
102
- editor.toggleFullSize(true);
103
-
104
- expect(
105
- editor.ownerWindow.getComputedStyle(handle).display
106
- ).equals('none');
107
- });
108
-
109
- it('Should change the icon in toolbar', function () {
110
- const editor = getJodit();
111
- const button = getButton('fullsize', editor);
112
- expect(button).is.not.null;
113
-
114
- expect(button.querySelector('svg')).is.not.null;
115
-
116
- const old_icon = button.querySelector('svg').innerHTML;
117
-
118
- editor.toggleFullSize(true);
119
- expect(
120
- button.querySelector('svg').innerHTML
121
- ).does.not.equal(old_icon);
122
-
123
- editor.toggleFullSize(false);
124
- expect(button.querySelector('svg').innerHTML).equals(
125
- old_icon
126
- );
127
- });
128
-
129
- describe('For text icons', function () {
130
- it('Should change the text in toolbar', function () {
131
- const editor = getJodit({
132
- textIcons: true
133
- });
134
-
135
- const button = getButton('fullsize', editor);
136
-
137
- expect(button).is.not.null;
138
- expect(button.querySelector('svg')).is.null;
139
-
140
- const old_icon = button.textContent;
141
-
142
- editor.toggleFullSize(true);
143
- expect(button.textContent).does.not.equal(old_icon);
144
-
145
- editor.toggleFullSize(false);
146
- expect(button.textContent).equals(old_icon);
147
- });
148
- });
149
- });
150
-
151
- it('Should not change size by content after window was resized', function () {
152
- const editor = getJodit({
153
- height: 300
154
- });
155
-
156
- editor.value = '<p>test</p>'.repeat(20);
157
- expect(editor.container.offsetHeight).equals(300);
158
-
159
- simulateEvent('resize', 0, window);
160
- expect(editor.container.offsetHeight).equals(300);
161
- });
162
- });
163
-
164
- describe('Autosize', function () {
165
- it('Should set editor height by content', function () {
166
- const editor = getJodit();
167
- editor.value = '<p>test</p>'.repeat(100);
168
- expect(editor.container.offsetHeight).to.be.above(1000);
169
- });
170
-
171
- describe('Max height', function () {
172
- it('Should set limited height', function () {
173
- const editor = getJodit({
174
- maxHeight: 500
175
- });
176
-
177
- editor.value = '<p>test</p>'.repeat(1);
178
- expect(editor.container.offsetHeight).equals(200);
179
-
180
- editor.value = '<p>test</p>'.repeat(100);
181
- expect(editor.container.offsetHeight).equals(500);
182
- });
183
- });
184
-
185
- it('Should set editor height by content in iframe mode', function () {
186
- const editor = getJodit({
187
- iframe: true
188
- });
189
- editor.value = '<p>test</p>'.repeat(100);
190
- expect(editor.container.offsetHeight).to.be.above(1000);
191
- });
192
- });
193
- });
194
-
195
- describe('Set width', function () {
196
- describe('Resize handle', function () {
197
- describe('Allow X resizing', function () {
198
- it('Should show resize handle', function () {
199
- const editor = getJodit({
200
- width: 400,
201
- allowResizeX: true
202
- });
203
-
204
- const handle = editor.container.querySelector(
205
- '.jodit-editor__resize'
206
- );
207
-
208
- expect(editor.container.offsetWidth).equals(400);
209
-
210
- simulateEvent('mousedown', handle, function (options) {
211
- options.clientX = 100;
212
- options.clientY = 100;
213
- });
214
-
215
- simulateEvent('mousemove', window, function (options) {
216
- options.clientX = 200;
217
- options.clientY = 200;
218
- });
219
- simulateEvent('mouseup', window);
220
-
221
- expect(editor.container.offsetWidth).equals(500);
222
- });
223
- });
224
- });
225
- });
226
-
227
- describe('Disable auto-height', function () {
228
- describe('Resize handle', function () {
229
- it('Should resize editor', function () {
230
- const box = getBox();
231
- box.style.width = 'auto';
232
- box.style.height = 'auto';
233
-
234
- const editor = getJodit({
235
- height: 300,
236
- width: 400,
237
- allowResizeX: true,
238
- allowResizeY: true
239
- });
240
- expect(editor.container.offsetHeight).equals(300);
241
-
242
- const handle = editor.container.querySelector(
243
- '.jodit-editor__resize'
244
- );
245
-
246
- simulateEvent('mousedown', 0, handle, function (options) {
247
- options.clientX = 100;
248
- options.clientY = 100;
249
- });
250
- simulateEvent('mousemove', 0, window, function (options) {
251
- options.clientX = 200;
252
- options.clientY = 200;
253
- });
254
- simulateEvent('mouseup', 0, window);
255
-
256
- expect(editor.container.offsetHeight).equals(400);
257
- expect(editor.container.offsetWidth).equals(500);
258
- });
259
-
260
- describe('Disable X resizing', function () {
261
- it('Should resize editor only by vertical', function () {
262
- getBox().style.width = 'auto';
263
- getBox().style.height = 'auto';
264
-
265
- const editor = getJodit({
266
- height: 300,
267
- width: 400,
268
- allowResizeX: false,
269
- allowResizeY: true
270
- });
271
-
272
- const handle = editor.container.querySelector(
273
- '.jodit-editor__resize'
274
- );
275
-
276
- expect(editor.container.offsetHeight).equals(300);
277
- expect(editor.container.offsetWidth).equals(400);
278
-
279
- simulateEvent('mousedown', 0, handle, function (options) {
280
- options.clientX = 100;
281
- options.clientY = 100;
282
- });
283
-
284
- simulateEvent('mousemove', 0, window, function (options) {
285
- options.clientX = 200;
286
- options.clientY = 200;
287
- });
288
- simulateEvent('mouseup', 0, window);
289
-
290
- expect(editor.container.offsetHeight).equals(400);
291
- expect(editor.container.offsetWidth).equals(400);
292
- });
293
- });
294
- });
295
-
296
- describe('Change box size', function () {
297
- describe('Auto width mode', function () {
298
- describe('Change box width', function () {
299
- it('should set fixed height but width must be auto', function () {
300
- const box = getBox();
301
- const editor = getJodit({
302
- height: 300
303
- });
304
-
305
- box.style.width = '400px';
306
-
307
- const handle = editor.container.querySelector(
308
- '.jodit-editor__resize'
309
- );
310
-
311
- expect(editor.container.offsetHeight).equals(300);
312
-
313
- simulateEvent(
314
- 'mousedown',
315
- 0,
316
- handle,
317
- function (options) {
318
- options.clientX = 100;
319
- options.clientY = 100;
320
- }
321
- );
322
-
323
- simulateEvent(
324
- 'mousemove',
325
- 0,
326
- window,
327
- function (options) {
328
- options.clientX = 200;
329
- options.clientY = 200;
330
- }
331
- );
332
-
333
- simulateEvent('mouseup', 0, window);
334
-
335
- box.style.width = '600px';
336
-
337
- expect(editor.container.offsetHeight).equals(400);
338
- expect(editor.container.offsetWidth).equals(600);
339
- });
340
- });
341
- });
342
- });
343
- });
344
- });
@@ -1,218 +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('Source code test', function () {
7
- describe('Init', function () {
8
- it('After init container must has source editor container', function (done) {
9
- unmockPromise();
10
-
11
- let timeout;
12
- const area = appendTestArea(false, true),
13
- __done = function () {
14
- clearTimeout(timeout);
15
- this.events.off('beforeDestruct');
16
- this.destruct();
17
- area.parentNode.removeChild(area);
18
- done();
19
- };
20
-
21
- let editor;
22
-
23
- timeout = setTimeout(function () {
24
- expect(false).is.true;
25
- __done.call(editor);
26
- }, 5000);
27
-
28
- editor = getJodit(
29
- {
30
- defaultMode: Jodit.MODE_SOURCE,
31
- sourceEditor: 'ace',
32
- events: {
33
- beforeDestruct: function () {
34
- return false;
35
- },
36
- sourceEditorReady: function (editor) {
37
- expect(
38
- editor.container.querySelectorAll(
39
- '.jodit-source__mirror-fake'
40
- ).length
41
- ).equals(1);
42
- __done.call(editor);
43
- }
44
- }
45
- },
46
- area
47
- );
48
- }).timeout(6000);
49
-
50
- describe('Set value in source mode', function () {
51
- it('Should set value in editor and in source', function (done) {
52
- unmockPromise();
53
-
54
- let timeout;
55
- const area = appendTestArea(false, true),
56
- __done = function () {
57
- clearTimeout(timeout);
58
- this.events.off('beforeDestruct');
59
- this.destruct();
60
- area.parentNode.removeChild(area);
61
- done();
62
- };
63
-
64
- let editor;
65
-
66
- timeout = setTimeout(function () {
67
- expect(false).is.true;
68
- __done.call(editor);
69
- }, 5000);
70
-
71
- editor = getJodit(
72
- {
73
- defaultMode: Jodit.MODE_SOURCE,
74
- sourceEditor: 'ace',
75
- events: {
76
- beforeDestruct: function () {
77
- return false;
78
- },
79
- sourceEditorReady: function (editor) {
80
- setTimeout(() => {
81
- expect(
82
- editor.__plugins.source.sourceEditor.getValue()
83
- ).equals('<p>pop</p>');
84
- editor.value = '<p>test</p>';
85
- expect(
86
- editor.__plugins.source.sourceEditor.getValue()
87
- ).equals('<p>test</p>');
88
- __done.call(editor);
89
- }, 300);
90
- }
91
- }
92
- },
93
- area
94
- );
95
-
96
- editor.value = '<p>pop</p>';
97
- }).timeout(6000);
98
- });
99
-
100
- describe('Split mode', function () {
101
- it('Should shoe source and wysiwyg in same time', function () {
102
- const editor = getJodit({
103
- defaultMode: Jodit.MODE_SPLIT,
104
- sourceEditor: 'area'
105
- });
106
-
107
- expect(
108
- editor.ew.getComputedStyle(editor.editor).display
109
- ).equals('block');
110
- expect(
111
- editor.ew.getComputedStyle(
112
- editor.container.querySelector('.jodit-source')
113
- ).display
114
- ).equals('block');
115
- }).timeout(6000);
116
- });
117
- });
118
-
119
- describe('Change mode', function () {
120
- describe('In WYSIWYG mode isEditorMode', function () {
121
- it('Should return true', function () {
122
- const editor = getJodit();
123
- expect(editor.isEditorMode()).is.true;
124
- editor.toggleMode();
125
- expect(editor.isEditorMode()).is.false;
126
- });
127
- });
128
-
129
- it('Should not fire Change event', function () {
130
- const editor = getJodit({
131
- useAceEditor: false // because onChange can be fired after aceInited
132
- });
133
-
134
- const defaultValue = '<p>test</p>';
135
- let count = 0;
136
-
137
- editor.value = defaultValue;
138
-
139
- editor.events.on('change', function (value, oldvalue) {
140
- expect(oldvalue).does.not.equal(value);
141
- expect(defaultValue).does.not.equal(value);
142
- count++;
143
- });
144
-
145
- editor.s.setCursorAfter(editor.editor.firstChild.firstChild);
146
- editor.setMode(Jodit.MODE_SOURCE);
147
- editor.setMode(Jodit.MODE_WYSIWYG);
148
- editor.value = defaultValue;
149
- editor.value = '<p>another</p>';
150
-
151
- expect(1).equals(count);
152
- });
153
-
154
- describe('After change mode to source mode and use insertHTML method', function () {
155
- it('Should insert text on caret position', function (done) {
156
- unmockPromise();
157
-
158
- getJodit({
159
- sourceEditor: 'ace',
160
- beautifyHTML: false,
161
- events: {
162
- sourceEditorReady: function (jodit) {
163
- jodit.s.focus();
164
- jodit.value = '<p>test <span>test</span> test</p>';
165
- const range = jodit.ed.createRange();
166
-
167
- range.selectNodeContents(
168
- jodit.editor.querySelector('span')
169
- );
170
- range.collapse(false);
171
-
172
- jodit.s.selectRange(range);
173
-
174
- jodit.setMode(Jodit.MODE_SOURCE);
175
-
176
- jodit.s.insertHTML('loop');
177
-
178
- expect(jodit.value).equals(
179
- '<p>test <span>testloop</span> test</p>'
180
- );
181
- mockPromise();
182
-
183
- done();
184
- }
185
- }
186
- });
187
- }).timeout(4000);
188
-
189
- describe('Without ace', function () {
190
- it('Should insert text on caret position', function () {
191
- const editor = getJodit({
192
- useAceEditor: false
193
- });
194
-
195
- editor.value = '<p>one <span>two</span> three</p>';
196
- const range = editor.s.createRange();
197
- range.selectNodeContents(
198
- editor.editor.querySelector('span')
199
- );
200
- range.collapse(false);
201
- editor.s.selectRange(range);
202
-
203
- editor.s.insertHTML('stop');
204
- expect(editor.value).equals(
205
- '<p>one <span>twostop</span> three</p>'
206
- );
207
-
208
- editor.setMode(Jodit.MODE_SOURCE);
209
-
210
- editor.s.insertHTML('loop');
211
- expect(editor.value).equals(
212
- '<p>one <span>twostoploop</span> three</p>'
213
- );
214
- });
215
- });
216
- });
217
- });
218
- });
@@ -1,120 +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('Stat plugin', function () {
7
- describe('After init and change', function () {
8
- it('Should show chars count and words count', function () {
9
- const editor = getJodit({
10
- language: 'en',
11
- showCharsCounter: true,
12
- countHTMLChars: false,
13
- showHTMLCharsCounter: true,
14
- observer: {
15
- timeout: 0
16
- }
17
- });
18
-
19
- editor.value = '<p>Simple text</p><p>Simple text</p>';
20
- const statusbar =
21
- editor.container.querySelector('.jodit-status-bar');
22
-
23
- expect(statusbar).is.not.null;
24
-
25
- expect(statusbar.textContent.match(/Chars: 20/)).is.not.null;
26
-
27
- expect(statusbar.textContent.match(/Words: 4/)).does.not.equal(
28
- null
29
- );
30
- });
31
-
32
- describe('Count HTML Chars', function () {
33
- it('Should show real HTML chars count', function () {
34
- const editor = getJodit({
35
- language: 'en',
36
- showCharsCounter: true,
37
- countHTMLChars: true,
38
- showHTMLCharsCounter: true,
39
- observer: {
40
- timeout: 0
41
- }
42
- });
43
-
44
- editor.value = '<p>Simple text</p><p>Simple text</p>';
45
- const statusbar =
46
- editor.container.querySelector('.jodit-status-bar');
47
-
48
- expect(statusbar.textContent.match(/Chars: 36/)).is.not.null;
49
- });
50
- });
51
-
52
- describe('Hide chars count', function () {
53
- it('Should show only words count', function () {
54
- const editor = getJodit({
55
- language: 'en',
56
- showCharsCounter: false,
57
- showWordsCounter: true,
58
- observer: {
59
- timeout: 0
60
- }
61
- });
62
-
63
- editor.value = '<p>Simple text</p>';
64
- const statusbar =
65
- editor.container.querySelector('.jodit-status-bar');
66
-
67
- expect(statusbar).is.not.null;
68
-
69
- expect(statusbar.textContent.match(/Chars: 10/)).is.null;
70
- expect(statusbar.textContent.match(/Words: 2/)).is.not.null;
71
- });
72
- });
73
-
74
- describe('Hide words count', function () {
75
- it('Should show only chars count', function () {
76
- const editor = getJodit({
77
- language: 'en',
78
- showCharsCounter: true,
79
- showWordsCounter: false,
80
- observer: {
81
- timeout: 0
82
- }
83
- });
84
-
85
- editor.value = '<p>Simple text</p>';
86
- const statusbar =
87
- editor.container.querySelector('.jodit-status-bar');
88
-
89
- expect(statusbar).is.not.null;
90
-
91
- expect(statusbar.textContent.match(/Chars: 10/)).is.not.null;
92
- expect(statusbar.textContent.match(/Words: 2/)).equals(null);
93
- });
94
- });
95
-
96
- describe('Hide words and chars count', function () {
97
- it('Should hide status bar', function () {
98
- const editor = getJodit({
99
- language: 'en',
100
- showCharsCounter: false,
101
- showWordsCounter: false,
102
- showXPathInStatusbar: false,
103
- observer: {
104
- timeout: 0
105
- }
106
- });
107
-
108
- editor.value = '<p>Simple text</p>';
109
- const statusbar =
110
- editor.container.querySelector('.jodit-status-bar');
111
-
112
- expect(statusbar).is.not.null;
113
-
114
- expect(statusbar.textContent.match(/Chars: 10/)).is.null;
115
- expect(statusbar.textContent.match(/Words: 2/)).equals(null);
116
- expect(statusbar.offsetHeight).equals(0);
117
- });
118
- });
119
- });
120
- });