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.
- package/.idea/codeStyles/Project.xml +68 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/dictionaries/v_chupurnov.xml +10 -0
- package/.idea/encodings.xml +4 -0
- package/.idea/inspectionProfiles/Project_Default.xml +118 -0
- package/.idea/jodit.iml +12 -0
- package/.idea/jsLibraryMappings.xml +6 -0
- package/.idea/markdown-navigator-enh.xml +29 -0
- package/.idea/markdown-navigator.xml +55 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/watcherTasks.xml +4 -0
- package/.idea/workspace.xml +1264 -0
- package/build/jodit.css +2 -2
- package/build/jodit.es2018.css +1 -1
- package/build/jodit.es2018.en.css +1 -1
- package/build/jodit.es2018.en.js +4 -4
- package/build/jodit.es2018.en.min.js +2 -2
- package/build/jodit.es2018.js +4 -4
- package/build/jodit.es2018.min.js +2 -2
- package/build/jodit.js +4 -4
- package/build/jodit.min.css +1 -1
- package/build/jodit.min.js +2 -2
- package/package.json +2 -2
- package/.travis.yml +0 -7
- package/bower.json +0 -33
- package/build.js +0 -39
- package/docker/Dockerfile +0 -11
- package/docker/README.md +0 -45
- package/docker/build +0 -3
- package/docker/install +0 -7
- package/docker/start +0 -3
- package/docker/test +0 -3
- package/docker/uninstall +0 -3
- package/examples/arabic.lang.html +0 -76
- package/examples/assets/app.css +0 -175
- package/examples/assets/app.js +0 -57
- package/examples/assets/download.jpg +0 -0
- package/examples/assets/icon.png +0 -0
- package/examples/assets/logo.png +0 -0
- package/examples/assets/prism.css +0 -200
- package/examples/assets/prism.js +0 -1254
- package/examples/color-picker.html +0 -139
- package/examples/custom-icons.html +0 -173
- package/examples/custom-toolbar.html +0 -80
- package/examples/example.default.html +0 -75
- package/examples/fullsize.html +0 -75
- package/examples/index.html +0 -176
- package/examples/inline-mode.html +0 -116
- package/examples/oneinstance.html +0 -125
- package/icons.html +0 -50
- package/karma.conf.js +0 -157
- package/make.js +0 -10
- package/server.js +0 -101
- package/test/bootstrap.js +0 -1167
- package/test/test.html +0 -102
- package/test/test.index.html +0 -11
- package/test/tests/acceptance/clipboardTest.js +0 -1234
- package/test/tests/acceptance/commandsTest.js +0 -647
- package/test/tests/acceptance/creatorTest.js +0 -103
- package/test/tests/acceptance/deleteBackSpaceTest.js +0 -1289
- package/test/tests/acceptance/dialogTest.js +0 -188
- package/test/tests/acceptance/editorTest.js +0 -855
- package/test/tests/acceptance/enterTest.js +0 -1088
- package/test/tests/acceptance/eventsTest.js +0 -1246
- package/test/tests/acceptance/filebrowserTest.js +0 -1309
- package/test/tests/acceptance/i18nTest.js +0 -81
- package/test/tests/acceptance/iframeTest.js +0 -306
- package/test/tests/acceptance/imageTest.js +0 -1649
- package/test/tests/acceptance/inlineModeTest.js +0 -826
- package/test/tests/acceptance/interfaceTest.js +0 -119
- package/test/tests/acceptance/mobileTest.js +0 -229
- package/test/tests/acceptance/plugins/classSpan.js +0 -220
- package/test/tests/acceptance/plugins/cleanHtml.js +0 -351
- package/test/tests/acceptance/plugins/color.js +0 -188
- package/test/tests/acceptance/plugins/dragAndDropElement.js +0 -172
- package/test/tests/acceptance/plugins/focus.js +0 -115
- package/test/tests/acceptance/plugins/font.js +0 -316
- package/test/tests/acceptance/plugins/image.js +0 -79
- package/test/tests/acceptance/plugins/indent.js +0 -179
- package/test/tests/acceptance/plugins/inline-popup.js +0 -578
- package/test/tests/acceptance/plugins/insert.js +0 -17
- package/test/tests/acceptance/plugins/limit.js +0 -164
- package/test/tests/acceptance/plugins/link.js +0 -1640
- package/test/tests/acceptance/plugins/orderedList.js +0 -290
- package/test/tests/acceptance/plugins/placeholder.js +0 -138
- package/test/tests/acceptance/plugins/resizer.js +0 -329
- package/test/tests/acceptance/plugins/search.js +0 -623
- package/test/tests/acceptance/plugins/size.js +0 -344
- package/test/tests/acceptance/plugins/source.js +0 -218
- package/test/tests/acceptance/plugins/stat.js +0 -120
- package/test/tests/acceptance/plugins/tooltip.js +0 -97
- package/test/tests/acceptance/plugins/wrapTextNodes.js +0 -105
- package/test/tests/acceptance/pluginsTest.js +0 -2219
- package/test/tests/acceptance/selectionTest.js +0 -862
- package/test/tests/acceptance/statesTest.js +0 -310
- package/test/tests/acceptance/tableTest.js +0 -1988
- package/test/tests/acceptance/toolbarTest.js +0 -1747
- package/test/tests/acceptance/undoredoTest.js +0 -217
- package/test/tests/acceptance/uploaderTest.js +0 -187
- package/test/tests/artio.jpg +0 -0
- package/test/tests/units/helpersTest.js +0 -771
- package/test/tests/units/modules/dom.js +0 -282
- package/test/tests/units/objectObserverTest.js +0 -533
- package/test/tests/units/popupTest.js +0 -211
- package/test/tests/units/positionTest.js +0 -238
- package/test/tests/units/styleTest.js +0 -1361
- package/webpack.config.js +0 -308
|
@@ -1,119 +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
|
-
|
|
7
|
-
describe('Test interface', function () {
|
|
8
|
-
describe('Style values', function () {
|
|
9
|
-
describe('Set styleValues dictionary', () => {
|
|
10
|
-
it('Should apply keys of it ass custom properties in CSS in instance', () => {
|
|
11
|
-
const getKey = (elm, key) =>
|
|
12
|
-
window
|
|
13
|
-
.getComputedStyle(elm)
|
|
14
|
-
.getPropertyValue('--jd-' + key)
|
|
15
|
-
.trim();
|
|
16
|
-
|
|
17
|
-
const editor = getJodit({
|
|
18
|
-
styleValues: {
|
|
19
|
-
'color-text': '#F9D90F',
|
|
20
|
-
colorBorder: '#1AB942',
|
|
21
|
-
'color-Panel': '#E23DAA'
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
expect(getKey(editor.container, 'color-text')).eq('#F9D90F');
|
|
26
|
-
expect(getKey(editor.container, 'color-border')).eq('#1AB942');
|
|
27
|
-
expect(getKey(editor.container, 'color-panel')).eq('#E23DAA');
|
|
28
|
-
|
|
29
|
-
expect(getKey(document.body, 'color-text')).eq('#222222'); // only for instance
|
|
30
|
-
|
|
31
|
-
expect(
|
|
32
|
-
Jodit.modules.Helpers.normalizeColor(
|
|
33
|
-
window.getComputedStyle(
|
|
34
|
-
editor.toolbar.container.parentNode
|
|
35
|
-
).backgroundColor
|
|
36
|
-
)
|
|
37
|
-
).eq('#E23DAA'); // only for instance
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe('About dialog', function () {
|
|
43
|
-
it('Should contains License element', function () {
|
|
44
|
-
const editor = getJodit({
|
|
45
|
-
license: '111',
|
|
46
|
-
toolbarAdaptive: false
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const aboutButton = getButton('about', editor);
|
|
50
|
-
|
|
51
|
-
expect(aboutButton).is.not.null;
|
|
52
|
-
simulateEvent('click', 0, aboutButton);
|
|
53
|
-
|
|
54
|
-
const dialog = getOpenedDialog(editor);
|
|
55
|
-
|
|
56
|
-
expect(dialog).is.not.null;
|
|
57
|
-
|
|
58
|
-
expect(dialog.textContent.match(/License:.*(MIT)/)).is.not.null;
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
describe('Set license', function () {
|
|
62
|
-
it('Should show License in about dialog', function () {
|
|
63
|
-
const editor = getJodit({
|
|
64
|
-
license: '12345-67890-12345-67890', // don't use this key - it is wrong
|
|
65
|
-
toolbarAdaptive: false
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const aboutButton = getButton('about', editor);
|
|
69
|
-
|
|
70
|
-
expect(aboutButton).is.not.null;
|
|
71
|
-
simulateEvent('click', 0, aboutButton);
|
|
72
|
-
|
|
73
|
-
const dialog = getOpenedDialog(editor);
|
|
74
|
-
expect(dialog).is.not.null;
|
|
75
|
-
|
|
76
|
-
expect(dialog.textContent.match(/License:.*(GPL|GNU)/)).is.null;
|
|
77
|
-
|
|
78
|
-
expect(
|
|
79
|
-
dialog.textContent.match(
|
|
80
|
-
/License: 12345-67-\*\*\*\*\*\*\*\*-\*\*\*\*\*\*\*/
|
|
81
|
-
)
|
|
82
|
-
).is.not.null;
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
describe('Direction', function () {
|
|
88
|
-
describe('Set RTL direction', function () {
|
|
89
|
-
it('Should have RTL direction', function () {
|
|
90
|
-
const editor = getJodit({
|
|
91
|
-
direction: 'rtl'
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
expect('rtl').equals(editor.editor.getAttribute('dir'));
|
|
95
|
-
expect('rtl').equals(editor.container.getAttribute('dir'));
|
|
96
|
-
expect('rtl').equals(
|
|
97
|
-
editor.toolbar.container.getAttribute('dir')
|
|
98
|
-
);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
describe('For iframe mode', function () {
|
|
103
|
-
it('Should have same direction and language', function () {
|
|
104
|
-
const editor = getJodit({
|
|
105
|
-
iframe: true,
|
|
106
|
-
direction: 'rtl',
|
|
107
|
-
language: 'de'
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
expect('rtl').equals(
|
|
111
|
-
editor.ed.documentElement.getAttribute('dir')
|
|
112
|
-
);
|
|
113
|
-
expect('de').equals(
|
|
114
|
-
editor.ed.documentElement.getAttribute('lang')
|
|
115
|
-
);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
});
|
|
@@ -1,229 +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 mobile mode', function () {
|
|
7
|
-
getBox().style.width = 'auto';
|
|
8
|
-
|
|
9
|
-
describe('Toolbar', function () {
|
|
10
|
-
it('Should have different count buttons for different container sizes', function () {
|
|
11
|
-
getBox().style.width = '1000px';
|
|
12
|
-
const editor = getJodit({
|
|
13
|
-
buttons: [
|
|
14
|
-
'source',
|
|
15
|
-
'|',
|
|
16
|
-
'bold',
|
|
17
|
-
'strikethrough',
|
|
18
|
-
'underline',
|
|
19
|
-
'italic',
|
|
20
|
-
'|',
|
|
21
|
-
'ul',
|
|
22
|
-
'ol',
|
|
23
|
-
'|',
|
|
24
|
-
'outdent',
|
|
25
|
-
'indent',
|
|
26
|
-
'|',
|
|
27
|
-
'font',
|
|
28
|
-
'fontsize',
|
|
29
|
-
'brush',
|
|
30
|
-
'paragraph',
|
|
31
|
-
'|',
|
|
32
|
-
'image',
|
|
33
|
-
'video',
|
|
34
|
-
'table',
|
|
35
|
-
'link',
|
|
36
|
-
'|',
|
|
37
|
-
'align',
|
|
38
|
-
'undo',
|
|
39
|
-
'redo',
|
|
40
|
-
'|',
|
|
41
|
-
'hr',
|
|
42
|
-
'eraser',
|
|
43
|
-
'copyformat',
|
|
44
|
-
'|',
|
|
45
|
-
'symbol',
|
|
46
|
-
'fullsize',
|
|
47
|
-
'print',
|
|
48
|
-
'about'
|
|
49
|
-
]
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
expect(27).to.be.below(
|
|
53
|
-
editor.container.querySelectorAll('.jodit-toolbar-button')
|
|
54
|
-
.length
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
getBox().style.width = '790px';
|
|
58
|
-
simulateEvent('resize', 0, window);
|
|
59
|
-
|
|
60
|
-
expect(28).to.be.above(
|
|
61
|
-
editor.container.querySelectorAll(
|
|
62
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
63
|
-
).length
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
getBox().style.width = '690px';
|
|
67
|
-
simulateEvent('resize', 0, window);
|
|
68
|
-
|
|
69
|
-
expect(26).to.be.above(
|
|
70
|
-
editor.container.querySelectorAll(
|
|
71
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
72
|
-
).length
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
getBox().style.width = '390px';
|
|
76
|
-
simulateEvent('resize', 0, window);
|
|
77
|
-
|
|
78
|
-
expect(15).to.be.above(
|
|
79
|
-
editor.container.querySelectorAll(
|
|
80
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
81
|
-
).length
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
describe('If buttons were set like string', function () {
|
|
86
|
-
it('Should have different count buttons for different container sizes', function () {
|
|
87
|
-
getBox().style.width = '1000px';
|
|
88
|
-
const editor = getJodit({
|
|
89
|
-
buttons: 'source,about,print,bold',
|
|
90
|
-
buttonsMD: 'source,about,print',
|
|
91
|
-
buttonsSM: 'source,about',
|
|
92
|
-
buttonsXS: 'source'
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
expect(4).equals(
|
|
96
|
-
editor.container.querySelectorAll(
|
|
97
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
98
|
-
).length
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
getBox().style.width = '790px';
|
|
102
|
-
simulateEvent('resize', 0, window);
|
|
103
|
-
|
|
104
|
-
expect(3).equals(
|
|
105
|
-
editor.container.querySelectorAll(
|
|
106
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
107
|
-
).length
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
getBox().style.width = '690px';
|
|
111
|
-
simulateEvent('resize', 0, window);
|
|
112
|
-
|
|
113
|
-
expect(2).equals(
|
|
114
|
-
editor.container.querySelectorAll(
|
|
115
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
116
|
-
).length
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
getBox().style.width = '390px';
|
|
120
|
-
simulateEvent('resize', 0, window);
|
|
121
|
-
|
|
122
|
-
expect(1).equals(
|
|
123
|
-
editor.container.querySelectorAll(
|
|
124
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
125
|
-
).length
|
|
126
|
-
);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
describe('Custom media points', function () {
|
|
130
|
-
it('Should works like as usual', function () {
|
|
131
|
-
getBox().style.width = '500px';
|
|
132
|
-
|
|
133
|
-
const editor = getJodit({
|
|
134
|
-
buttons: 'source,about,print,bold',
|
|
135
|
-
buttonsMD: 'source,about,print',
|
|
136
|
-
buttonsSM: 'source,about',
|
|
137
|
-
buttonsXS: 'source',
|
|
138
|
-
minWidth: 100,
|
|
139
|
-
sizeLG: 400,
|
|
140
|
-
sizeMD: 300,
|
|
141
|
-
sizeSM: 200
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
expect(4).equals(
|
|
145
|
-
editor.container.querySelectorAll(
|
|
146
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
147
|
-
).length
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
getBox().style.width = '390px';
|
|
151
|
-
simulateEvent('resize', 0, window);
|
|
152
|
-
|
|
153
|
-
expect(3).equals(
|
|
154
|
-
editor.container.querySelectorAll(
|
|
155
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
156
|
-
).length
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
getBox().style.width = '290px';
|
|
160
|
-
simulateEvent('resize', 0, window);
|
|
161
|
-
|
|
162
|
-
expect(2).equals(
|
|
163
|
-
editor.container.querySelectorAll(
|
|
164
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
165
|
-
).length
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
getBox().style.width = '190px';
|
|
169
|
-
simulateEvent('resize', 0, window);
|
|
170
|
-
|
|
171
|
-
expect(1).equals(
|
|
172
|
-
editor.container.querySelectorAll(
|
|
173
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
174
|
-
).length
|
|
175
|
-
);
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
describe('With toolbarAdaptive false', function () {
|
|
180
|
-
it('Should not change toolbar', function () {
|
|
181
|
-
getBox().style.width = '500px';
|
|
182
|
-
|
|
183
|
-
const editor = getJodit({
|
|
184
|
-
buttons: 'source,about,print,bold',
|
|
185
|
-
buttonsMD: 'source,about,print',
|
|
186
|
-
buttonsSM: 'source,about',
|
|
187
|
-
buttonsXS: 'source',
|
|
188
|
-
sizeLG: 400,
|
|
189
|
-
sizeMD: 300,
|
|
190
|
-
sizeSM: 200,
|
|
191
|
-
toolbarAdaptive: false
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
expect(4).equals(
|
|
195
|
-
editor.container.querySelectorAll(
|
|
196
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
197
|
-
).length
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
getBox().style.width = '390px';
|
|
201
|
-
simulateEvent('resize', 0, window);
|
|
202
|
-
|
|
203
|
-
expect(4).equals(
|
|
204
|
-
editor.container.querySelectorAll(
|
|
205
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
206
|
-
).length
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
getBox().style.width = '290px';
|
|
210
|
-
simulateEvent('resize', 0, window);
|
|
211
|
-
|
|
212
|
-
expect(4).equals(
|
|
213
|
-
editor.container.querySelectorAll(
|
|
214
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
215
|
-
).length
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
getBox().style.width = '190px';
|
|
219
|
-
simulateEvent('resize', 0, window);
|
|
220
|
-
|
|
221
|
-
expect(4).equals(
|
|
222
|
-
editor.container.querySelectorAll(
|
|
223
|
-
'.jodit-toolbar__box .jodit-toolbar-button'
|
|
224
|
-
).length
|
|
225
|
-
);
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
});
|
|
@@ -1,220 +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('classSpan test', function () {
|
|
7
|
-
describe('Open className list and select some element', function () {
|
|
8
|
-
it('Should apply this className to current selection elements', function () {
|
|
9
|
-
const editor = getJodit({
|
|
10
|
-
toolbarAdaptive: false,
|
|
11
|
-
controls: {
|
|
12
|
-
classSpan: {
|
|
13
|
-
list: {
|
|
14
|
-
class1: 'Classe 1',
|
|
15
|
-
class2: 'Classe 2',
|
|
16
|
-
class3: 'Classe 3',
|
|
17
|
-
class4: 'Classe 4',
|
|
18
|
-
class5: 'Classe 5'
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const openClassNameList = function () {
|
|
25
|
-
clickTrigger('classSpan', editor);
|
|
26
|
-
|
|
27
|
-
const list = getOpenedPopup(editor);
|
|
28
|
-
|
|
29
|
-
return Array.from(list.querySelectorAll('button')).slice(1);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
expect(openClassNameList()).is.not.null;
|
|
33
|
-
|
|
34
|
-
Array.from(openClassNameList()).map(function (classNames) {
|
|
35
|
-
editor.value = '<p>test</p>';
|
|
36
|
-
editor.s.select(editor.editor.firstChild.firstChild);
|
|
37
|
-
|
|
38
|
-
simulateEvent('click', 0, classNames);
|
|
39
|
-
|
|
40
|
-
const className = classNames
|
|
41
|
-
.querySelector('span[class=jodit-toolbar-button__text]')
|
|
42
|
-
.querySelector('span[class]')
|
|
43
|
-
.getAttribute('class');
|
|
44
|
-
|
|
45
|
-
expect(sortAttributes(editor.value)).equals(
|
|
46
|
-
sortAttributes(
|
|
47
|
-
'<p><span class="' + className + '">test</span></p>'
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe('Extends standard classname list', function () {
|
|
54
|
-
it('Should standart classname list elements', function () {
|
|
55
|
-
const editor = getJodit({
|
|
56
|
-
toolbarAdaptive: false,
|
|
57
|
-
controls: {
|
|
58
|
-
classSpan: {
|
|
59
|
-
list: {
|
|
60
|
-
foo: 'bar'
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
editor.value = '<p>test</p>';
|
|
67
|
-
editor.s.select(editor.editor.firstChild.firstChild);
|
|
68
|
-
|
|
69
|
-
clickTrigger('classSpan', editor);
|
|
70
|
-
|
|
71
|
-
const list = getOpenedPopup(editor);
|
|
72
|
-
|
|
73
|
-
expect(list).is.not.null;
|
|
74
|
-
|
|
75
|
-
const buttons = list.querySelectorAll('button'),
|
|
76
|
-
className = buttons[buttons.length - 1];
|
|
77
|
-
simulateEvent('click', 0, className);
|
|
78
|
-
|
|
79
|
-
expect(sortAttributes(editor.value)).equals(
|
|
80
|
-
sortAttributes('<p><span class="foo">test</span></p>')
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
describe('ClassName', function () {
|
|
87
|
-
describe('State', function () {
|
|
88
|
-
describe('First click on the button', function () {
|
|
89
|
-
it('Should open list', function () {
|
|
90
|
-
const editor = getJodit({
|
|
91
|
-
toolbarAdaptive: false,
|
|
92
|
-
controls: {
|
|
93
|
-
classSpan: {
|
|
94
|
-
list: {
|
|
95
|
-
class1: 'Classe 1',
|
|
96
|
-
class2: 'Classe 2',
|
|
97
|
-
class3: 'Classe 3',
|
|
98
|
-
class4: 'Classe 4',
|
|
99
|
-
class5: 'Classe 5'
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
clickButton('classSpan', editor);
|
|
106
|
-
|
|
107
|
-
const popup = getOpenedPopup(editor);
|
|
108
|
-
|
|
109
|
-
expect(popup).is.not.null;
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
describe('Second click on the button', function () {
|
|
113
|
-
it('Should apply previous choice', function () {
|
|
114
|
-
const editor = getJodit({
|
|
115
|
-
toolbarAdaptive: false,
|
|
116
|
-
controls: {
|
|
117
|
-
classSpan: {
|
|
118
|
-
list: {
|
|
119
|
-
class1: 'Classe 1',
|
|
120
|
-
class2: 'Classe 2',
|
|
121
|
-
class3: 'Classe 3',
|
|
122
|
-
class4: 'Classe 4',
|
|
123
|
-
class5: 'Classe 5'
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
editor.value = 'text2text';
|
|
130
|
-
|
|
131
|
-
const range = editor.s.createRange(true);
|
|
132
|
-
|
|
133
|
-
range.setStart(editor.editor.firstChild.firstChild, 3);
|
|
134
|
-
range.setEnd(editor.editor.firstChild.firstChild, 6);
|
|
135
|
-
|
|
136
|
-
clickButton('classSpan', editor);
|
|
137
|
-
|
|
138
|
-
const popup = getOpenedPopup(editor);
|
|
139
|
-
|
|
140
|
-
expect(popup).is.not.null;
|
|
141
|
-
|
|
142
|
-
clickButton('class3', popup);
|
|
143
|
-
|
|
144
|
-
expect(editor.value).equals(
|
|
145
|
-
'<p>tex<span class="class3">t2t</span>ext</p>'
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
const range2 = editor.s.createRange(true);
|
|
149
|
-
|
|
150
|
-
range2.setStartAfter(editor.editor.firstChild);
|
|
151
|
-
|
|
152
|
-
clickButton('classSpan', editor);
|
|
153
|
-
|
|
154
|
-
const popup2 = getOpenedPopup(editor);
|
|
155
|
-
|
|
156
|
-
expect(popup2).is.null;
|
|
157
|
-
|
|
158
|
-
expect(editor.value).equals(
|
|
159
|
-
'<p>tex<span class="class3">t2t</span>ext</p><p><span class="class3"></span></p>'
|
|
160
|
-
);
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
describe('Active', function () {
|
|
168
|
-
describe('In list', function () {
|
|
169
|
-
describe('ClassSpan button', function () {
|
|
170
|
-
it('Should be activated then element has some className', function () {
|
|
171
|
-
const editor = getJodit({
|
|
172
|
-
toolbarAdaptive: false,
|
|
173
|
-
observer: {
|
|
174
|
-
timeout: 0
|
|
175
|
-
},
|
|
176
|
-
controls: {
|
|
177
|
-
classSpan: {
|
|
178
|
-
list: {
|
|
179
|
-
class1: 'Classe 1',
|
|
180
|
-
class2: 'Classe 2',
|
|
181
|
-
class3: 'Classe 3',
|
|
182
|
-
class4: 'Classe 4',
|
|
183
|
-
class5: 'Classe 5'
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
editor.value =
|
|
190
|
-
'<p>test<span class="class3">bold</span></p>';
|
|
191
|
-
editor.s.focus();
|
|
192
|
-
|
|
193
|
-
const p = editor.editor.firstChild;
|
|
194
|
-
const className = getButton('classSpan', editor);
|
|
195
|
-
|
|
196
|
-
expect(className).is.not.null;
|
|
197
|
-
|
|
198
|
-
editor.s.setCursorAfter(p.firstChild);
|
|
199
|
-
simulateEvent('mousedown', 0, p);
|
|
200
|
-
expect(className.getAttribute('aria-pressed')).equals(
|
|
201
|
-
'false'
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
editor.s.setCursorIn(p.lastChild);
|
|
205
|
-
|
|
206
|
-
simulateEvent('mousedown', 0, p);
|
|
207
|
-
|
|
208
|
-
clickTrigger('classSpan', editor);
|
|
209
|
-
|
|
210
|
-
const popup = getOpenedPopup(editor);
|
|
211
|
-
|
|
212
|
-
const class3 = popup.querySelector('[class*=class3]');
|
|
213
|
-
|
|
214
|
-
expect(class3).does.not.equal(className);
|
|
215
|
-
expect(class3.hasAttribute('aria-pressed')).is.true;
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
});
|