@handlewithcare/react-prosemirror 2.8.0-tiptap.10 → 2.8.0-tiptap.12
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/dist/cjs/tiptap/TiptapEditorView.js +2 -1
- package/dist/cjs/tiptap/tiptapNodeView.js +26 -13
- package/dist/esm/tiptap/TiptapEditorView.js +2 -1
- package/dist/esm/tiptap/tiptapNodeView.js +27 -14
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/props.d.ts +26 -26
- package/dist/types/tiptap/TiptapEditorView.d.ts +2 -1
- package/package.json +1 -1
- package/dist/esm/@jest/pattern/src/__tests__/TestPathPatterns.test.js +0 -241
- package/dist/esm/@swc/cli/lib/swc/__tests__/compile.test.js +0 -19
- package/dist/esm/@swc/cli/lib/swc/__tests__/options.test.js +0 -315
- package/dist/esm/@swc/cli/lib/swc/__tests__/sources.test.js +0 -161
- package/dist/esm/@uiw/react-codemirror/src/__tests__/index.test.js +0 -111
- package/dist/esm/cheerio/src/__tests__/deprecated.spec.js +0 -249
- package/dist/esm/cheerio/src/__tests__/xml.spec.js +0 -55
- package/dist/esm/components/__tests__/ProseMirror.composition.test.js +0 -395
- package/dist/esm/components/__tests__/ProseMirror.domchange.test.js +0 -266
- package/dist/esm/components/__tests__/ProseMirror.draw-decoration.test.js +0 -968
- package/dist/esm/components/__tests__/ProseMirror.draw.test.js +0 -335
- package/dist/esm/components/__tests__/ProseMirror.mobile.test.js +0 -54
- package/dist/esm/components/__tests__/ProseMirror.node-view.test.js +0 -553
- package/dist/esm/components/__tests__/ProseMirror.selection.test.js +0 -440
- package/dist/esm/components/__tests__/ProseMirror.test.js +0 -324
- package/dist/esm/contexts/__tests__/DeferredLayoutEffects.test.js +0 -98
- package/dist/esm/hooks/__tests__/useEditorEffect.test.js +0 -134
- package/dist/esm/jsx-ast-utils/__tests__/helper.js +0 -83
- package/dist/esm/jsx-ast-utils/__tests__/src/elementType-test.js +0 -76
- package/dist/esm/jsx-ast-utils/__tests__/src/eventHandlers-test.js +0 -98
- package/dist/esm/jsx-ast-utils/__tests__/src/getProp-parser-test.js +0 -188
- package/dist/esm/jsx-ast-utils/__tests__/src/getProp-test.js +0 -119
- package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-babelparser-test.js +0 -393
- package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-flowparser-test.js +0 -379
- package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-babelparser-test.js +0 -925
- package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-flowparser-test.js +0 -700
- package/dist/esm/jsx-ast-utils/__tests__/src/hasProp-test.js +0 -350
- package/dist/esm/jsx-ast-utils/__tests__/src/index-test.js +0 -24
- package/dist/esm/jsx-ast-utils/__tests__/src/propName-test.js +0 -37
- package/dist/esm/plugins/__tests__/reactKeys.test.js +0 -77
- package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.js +0 -97
- package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.js +0 -319
- package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.js +0 -62
- package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.js +0 -80
- package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.js +0 -22
- package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.js +0 -20
- package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.js +0 -219
- package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.js +0 -1
- package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js +0 -323
- package/dist/esm/tsconfig-paths/src/__tests__/config-loader.test.js +0 -89
- package/dist/esm/tsconfig-paths/src/__tests__/data/match-path-data.js +0 -314
- package/dist/esm/tsconfig-paths/src/__tests__/filesystem.test.js +0 -58
- package/dist/esm/tsconfig-paths/src/__tests__/mapping-entry.test.js +0 -76
- package/dist/esm/tsconfig-paths/src/__tests__/match-path-async.test.js +0 -12
- package/dist/esm/tsconfig-paths/src/__tests__/match-path-sync.test.js +0 -10
- package/dist/esm/tsconfig-paths/src/__tests__/try-path.test.js +0 -214
- package/dist/esm/tsconfig-paths/src/__tests__/tsconfig-loader.test.js +0 -296
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
/* eslint-env mocha */ import assert from 'assert';
|
|
2
|
-
import { getOpeningElement, setParserName } from '../helper';
|
|
3
|
-
import hasProp, { hasAnyProp, hasEveryProp } from '../../src/hasProp';
|
|
4
|
-
describe('hasProp', ()=>{
|
|
5
|
-
beforeEach(()=>{
|
|
6
|
-
setParserName('babel');
|
|
7
|
-
});
|
|
8
|
-
it('should export a function', ()=>{
|
|
9
|
-
const expected = 'function';
|
|
10
|
-
const actual = typeof hasProp;
|
|
11
|
-
assert.equal(actual, expected);
|
|
12
|
-
});
|
|
13
|
-
it('should return false if no arguments are provided', ()=>{
|
|
14
|
-
const expected = false;
|
|
15
|
-
const actual = hasProp();
|
|
16
|
-
assert.equal(actual, expected);
|
|
17
|
-
});
|
|
18
|
-
it('should return false if the prop is absent', ()=>{
|
|
19
|
-
const code = '<div />';
|
|
20
|
-
const node = getOpeningElement(code);
|
|
21
|
-
const { attributes: props } = node;
|
|
22
|
-
const prop = 'id';
|
|
23
|
-
const expected = false;
|
|
24
|
-
const actual = hasProp(props, prop);
|
|
25
|
-
assert.equal(actual, expected);
|
|
26
|
-
});
|
|
27
|
-
it('should return true if the prop exists', ()=>{
|
|
28
|
-
const code = '<div id="foo" />';
|
|
29
|
-
const node = getOpeningElement(code);
|
|
30
|
-
const { attributes: props } = node;
|
|
31
|
-
const prop = 'id';
|
|
32
|
-
const expected = true;
|
|
33
|
-
const actual = hasProp(props, prop);
|
|
34
|
-
assert.equal(actual, expected);
|
|
35
|
-
});
|
|
36
|
-
it('should return true if the prop may exist in spread loose mode', ()=>{
|
|
37
|
-
const code = '<div {...props} />';
|
|
38
|
-
const node = getOpeningElement(code);
|
|
39
|
-
const { attributes: props } = node;
|
|
40
|
-
const prop = 'id';
|
|
41
|
-
const options = {
|
|
42
|
-
spreadStrict: false
|
|
43
|
-
};
|
|
44
|
-
const expected = true;
|
|
45
|
-
const actual = hasProp(props, prop, options);
|
|
46
|
-
assert.equal(actual, expected);
|
|
47
|
-
});
|
|
48
|
-
it('should return false if the prop is considered absent in case-sensitive mode', ()=>{
|
|
49
|
-
const code = '<div ID="foo" />';
|
|
50
|
-
const node = getOpeningElement(code);
|
|
51
|
-
const { attributes: props } = node;
|
|
52
|
-
const prop = 'id';
|
|
53
|
-
const options = {
|
|
54
|
-
ignoreCase: false
|
|
55
|
-
};
|
|
56
|
-
const expected = false;
|
|
57
|
-
const actual = hasProp(props, prop, options);
|
|
58
|
-
assert.equal(actual, expected);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe('hasAnyProp tests', ()=>{
|
|
62
|
-
it('should export a function', ()=>{
|
|
63
|
-
const expected = 'function';
|
|
64
|
-
const actual = typeof hasAnyProp;
|
|
65
|
-
assert.equal(actual, expected);
|
|
66
|
-
});
|
|
67
|
-
it('should return false if no arguments are provided', ()=>{
|
|
68
|
-
const expected = false;
|
|
69
|
-
const actual = hasAnyProp();
|
|
70
|
-
assert.equal(actual, expected);
|
|
71
|
-
});
|
|
72
|
-
it('should return false if the prop is absent', ()=>{
|
|
73
|
-
const code = '<div />';
|
|
74
|
-
const node = getOpeningElement(code);
|
|
75
|
-
const { attributes: props } = node;
|
|
76
|
-
const prop = 'id';
|
|
77
|
-
const expected = false;
|
|
78
|
-
const actual = hasAnyProp(props, prop);
|
|
79
|
-
assert.equal(actual, expected);
|
|
80
|
-
});
|
|
81
|
-
it('should return false if all props are absent in array', ()=>{
|
|
82
|
-
const code = '<div />';
|
|
83
|
-
const node = getOpeningElement(code);
|
|
84
|
-
const { attributes: props } = node;
|
|
85
|
-
const propsToCheck = [
|
|
86
|
-
'id',
|
|
87
|
-
'className'
|
|
88
|
-
];
|
|
89
|
-
const expected = false;
|
|
90
|
-
const actual = hasAnyProp(props, propsToCheck);
|
|
91
|
-
assert.equal(actual, expected);
|
|
92
|
-
});
|
|
93
|
-
it('should return false if all props are absent in space delimited string', ()=>{
|
|
94
|
-
const code = '<div />';
|
|
95
|
-
const node = getOpeningElement(code);
|
|
96
|
-
const { attributes: props } = node;
|
|
97
|
-
const propsToCheck = 'id className';
|
|
98
|
-
const expected = false;
|
|
99
|
-
const actual = hasAnyProp(props, propsToCheck);
|
|
100
|
-
assert.equal(actual, expected);
|
|
101
|
-
});
|
|
102
|
-
it('should return true if the prop exists', ()=>{
|
|
103
|
-
const code = '<div id="foo" />';
|
|
104
|
-
const node = getOpeningElement(code);
|
|
105
|
-
const { attributes: props } = node;
|
|
106
|
-
const prop = 'id';
|
|
107
|
-
const expected = true;
|
|
108
|
-
const actual = hasAnyProp(props, prop);
|
|
109
|
-
assert.equal(actual, expected);
|
|
110
|
-
});
|
|
111
|
-
it('should return true if any prop exists in array', ()=>{
|
|
112
|
-
const code = '<div id="foo" />';
|
|
113
|
-
const node = getOpeningElement(code);
|
|
114
|
-
const { attributes: props } = node;
|
|
115
|
-
const prop = [
|
|
116
|
-
'className',
|
|
117
|
-
'id'
|
|
118
|
-
];
|
|
119
|
-
const expected = true;
|
|
120
|
-
const actual = hasAnyProp(props, prop);
|
|
121
|
-
assert.equal(actual, expected);
|
|
122
|
-
});
|
|
123
|
-
it('should return true if any prop exists in space delimited string', ()=>{
|
|
124
|
-
const code = '<div id="foo" />';
|
|
125
|
-
const node = getOpeningElement(code);
|
|
126
|
-
const { attributes: props } = node;
|
|
127
|
-
const prop = 'className id';
|
|
128
|
-
const expected = true;
|
|
129
|
-
const actual = hasAnyProp(props, prop);
|
|
130
|
-
assert.equal(actual, expected);
|
|
131
|
-
});
|
|
132
|
-
it('should return true if the prop may exist in spread loose mode', ()=>{
|
|
133
|
-
const code = '<div {...props} />';
|
|
134
|
-
const node = getOpeningElement(code);
|
|
135
|
-
const { attributes: props } = node;
|
|
136
|
-
const prop = 'id';
|
|
137
|
-
const options = {
|
|
138
|
-
spreadStrict: false
|
|
139
|
-
};
|
|
140
|
-
const expected = true;
|
|
141
|
-
const actual = hasAnyProp(props, prop, options);
|
|
142
|
-
assert.equal(actual, expected);
|
|
143
|
-
});
|
|
144
|
-
it('should return true if any prop may exist in spread loose mode', ()=>{
|
|
145
|
-
const code = '<div {...props} />';
|
|
146
|
-
const node = getOpeningElement(code);
|
|
147
|
-
const { attributes: props } = node;
|
|
148
|
-
const prop = [
|
|
149
|
-
'id',
|
|
150
|
-
'className'
|
|
151
|
-
];
|
|
152
|
-
const options = {
|
|
153
|
-
spreadStrict: false
|
|
154
|
-
};
|
|
155
|
-
const expected = true;
|
|
156
|
-
const actual = hasAnyProp(props, prop, options);
|
|
157
|
-
assert.equal(actual, expected);
|
|
158
|
-
});
|
|
159
|
-
it('should return false if the prop is considered absent in case-sensitive mode', ()=>{
|
|
160
|
-
const code = '<div ID="foo" />';
|
|
161
|
-
const node = getOpeningElement(code);
|
|
162
|
-
const { attributes: props } = node;
|
|
163
|
-
const prop = 'id';
|
|
164
|
-
const options = {
|
|
165
|
-
ignoreCase: false
|
|
166
|
-
};
|
|
167
|
-
const expected = false;
|
|
168
|
-
const actual = hasAnyProp(props, prop, options);
|
|
169
|
-
assert.equal(actual, expected);
|
|
170
|
-
});
|
|
171
|
-
it('should return false if all props are considered absent in case-sensitive mode', ()=>{
|
|
172
|
-
const code = '<div ID="foo" />';
|
|
173
|
-
const node = getOpeningElement(code);
|
|
174
|
-
const { attributes: props } = node;
|
|
175
|
-
const prop = [
|
|
176
|
-
'id',
|
|
177
|
-
'iD',
|
|
178
|
-
'className'
|
|
179
|
-
];
|
|
180
|
-
const options = {
|
|
181
|
-
ignoreCase: false
|
|
182
|
-
};
|
|
183
|
-
const expected = false;
|
|
184
|
-
const actual = hasAnyProp(props, prop, options);
|
|
185
|
-
assert.equal(actual, expected);
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
describe('hasEveryProp tests', ()=>{
|
|
189
|
-
it('should export a function', ()=>{
|
|
190
|
-
const expected = 'function';
|
|
191
|
-
const actual = typeof hasEveryProp;
|
|
192
|
-
assert.equal(actual, expected);
|
|
193
|
-
});
|
|
194
|
-
it('should return true if no arguments are provided', ()=>{
|
|
195
|
-
const expected = true;
|
|
196
|
-
const actual = hasEveryProp();
|
|
197
|
-
assert.equal(actual, expected);
|
|
198
|
-
});
|
|
199
|
-
it('should return false if the prop is absent', ()=>{
|
|
200
|
-
const code = '<div />';
|
|
201
|
-
const node = getOpeningElement(code);
|
|
202
|
-
const { attributes: props } = node;
|
|
203
|
-
const prop = 'id';
|
|
204
|
-
const expected = false;
|
|
205
|
-
const actual = hasEveryProp(props, prop);
|
|
206
|
-
assert.equal(actual, expected);
|
|
207
|
-
});
|
|
208
|
-
it('should return false if any props are absent in array', ()=>{
|
|
209
|
-
const code = '<div id="foo" />';
|
|
210
|
-
const node = getOpeningElement(code);
|
|
211
|
-
const { attributes: props } = node;
|
|
212
|
-
const propsToCheck = [
|
|
213
|
-
'id',
|
|
214
|
-
'className'
|
|
215
|
-
];
|
|
216
|
-
const expected = false;
|
|
217
|
-
const actual = hasEveryProp(props, propsToCheck);
|
|
218
|
-
assert.equal(actual, expected);
|
|
219
|
-
});
|
|
220
|
-
it('should return false if all props are absent in array', ()=>{
|
|
221
|
-
const code = '<div />';
|
|
222
|
-
const node = getOpeningElement(code);
|
|
223
|
-
const { attributes: props } = node;
|
|
224
|
-
const propsToCheck = [
|
|
225
|
-
'id',
|
|
226
|
-
'className'
|
|
227
|
-
];
|
|
228
|
-
const expected = false;
|
|
229
|
-
const actual = hasEveryProp(props, propsToCheck);
|
|
230
|
-
assert.equal(actual, expected);
|
|
231
|
-
});
|
|
232
|
-
it('should return false if any props are absent in space delimited string', ()=>{
|
|
233
|
-
const code = '<div id="foo" />';
|
|
234
|
-
const node = getOpeningElement(code);
|
|
235
|
-
const { attributes: props } = node;
|
|
236
|
-
const propsToCheck = 'id className';
|
|
237
|
-
const expected = false;
|
|
238
|
-
const actual = hasEveryProp(props, propsToCheck);
|
|
239
|
-
assert.equal(actual, expected);
|
|
240
|
-
});
|
|
241
|
-
it('should return false if all props are absent in space delimited string', ()=>{
|
|
242
|
-
const code = '<div />';
|
|
243
|
-
const node = getOpeningElement(code);
|
|
244
|
-
const { attributes: props } = node;
|
|
245
|
-
const propsToCheck = 'id className';
|
|
246
|
-
const expected = false;
|
|
247
|
-
const actual = hasEveryProp(props, propsToCheck);
|
|
248
|
-
assert.equal(actual, expected);
|
|
249
|
-
});
|
|
250
|
-
it('should return true if the prop exists', ()=>{
|
|
251
|
-
const code = '<div id="foo" />';
|
|
252
|
-
const node = getOpeningElement(code);
|
|
253
|
-
const { attributes: props } = node;
|
|
254
|
-
const prop = 'id';
|
|
255
|
-
const expected = true;
|
|
256
|
-
const actual = hasEveryProp(props, prop);
|
|
257
|
-
assert.equal(actual, expected);
|
|
258
|
-
});
|
|
259
|
-
it('should return true if all props exist in array', ()=>{
|
|
260
|
-
const code = '<div id="foo" className="box" />';
|
|
261
|
-
const node = getOpeningElement(code);
|
|
262
|
-
const { attributes: props } = node;
|
|
263
|
-
const prop = [
|
|
264
|
-
'className',
|
|
265
|
-
'id'
|
|
266
|
-
];
|
|
267
|
-
const expected = true;
|
|
268
|
-
const actual = hasEveryProp(props, prop);
|
|
269
|
-
assert.equal(actual, expected);
|
|
270
|
-
});
|
|
271
|
-
it('should return true if all props exist in space delimited string', ()=>{
|
|
272
|
-
const code = '<div id="foo" className="box" />';
|
|
273
|
-
const node = getOpeningElement(code);
|
|
274
|
-
const { attributes: props } = node;
|
|
275
|
-
const prop = 'className id';
|
|
276
|
-
const expected = true;
|
|
277
|
-
const actual = hasEveryProp(props, prop);
|
|
278
|
-
assert.equal(actual, expected);
|
|
279
|
-
});
|
|
280
|
-
it('should return true if the props may exist in spread loose mode', ()=>{
|
|
281
|
-
const code = '<div {...props} />';
|
|
282
|
-
const node = getOpeningElement(code);
|
|
283
|
-
const { attributes: props } = node;
|
|
284
|
-
const prop = 'id';
|
|
285
|
-
const options = {
|
|
286
|
-
spreadStrict: false
|
|
287
|
-
};
|
|
288
|
-
const expected = true;
|
|
289
|
-
const actual = hasEveryProp(props, prop, options);
|
|
290
|
-
assert.equal(actual, expected);
|
|
291
|
-
});
|
|
292
|
-
it('should return true if all props may exist in spread loose mode', ()=>{
|
|
293
|
-
const code = '<div {...props} />';
|
|
294
|
-
const node = getOpeningElement(code);
|
|
295
|
-
const { attributes: props } = node;
|
|
296
|
-
const prop = [
|
|
297
|
-
'id',
|
|
298
|
-
'className'
|
|
299
|
-
];
|
|
300
|
-
const options = {
|
|
301
|
-
spreadStrict: false
|
|
302
|
-
};
|
|
303
|
-
const expected = true;
|
|
304
|
-
const actual = hasEveryProp(props, prop, options);
|
|
305
|
-
assert.equal(actual, expected);
|
|
306
|
-
});
|
|
307
|
-
it('should return false if the prop is considered absent in case-sensitive mode', ()=>{
|
|
308
|
-
const code = '<div ID="foo" />';
|
|
309
|
-
const node = getOpeningElement(code);
|
|
310
|
-
const { attributes: props } = node;
|
|
311
|
-
const prop = 'id';
|
|
312
|
-
const options = {
|
|
313
|
-
ignoreCase: false
|
|
314
|
-
};
|
|
315
|
-
const expected = false;
|
|
316
|
-
const actual = hasEveryProp(props, prop, options);
|
|
317
|
-
assert.equal(actual, expected);
|
|
318
|
-
});
|
|
319
|
-
it('should return false if all props are considered absent in case-sensitive mode', ()=>{
|
|
320
|
-
const code = '<div ID="foo" />';
|
|
321
|
-
const node = getOpeningElement(code);
|
|
322
|
-
const { attributes: props } = node;
|
|
323
|
-
const prop = [
|
|
324
|
-
'id',
|
|
325
|
-
'iD',
|
|
326
|
-
'className'
|
|
327
|
-
];
|
|
328
|
-
const options = {
|
|
329
|
-
ignoreCase: false
|
|
330
|
-
};
|
|
331
|
-
const expected = false;
|
|
332
|
-
const actual = hasEveryProp(props, prop, options);
|
|
333
|
-
assert.equal(actual, expected);
|
|
334
|
-
});
|
|
335
|
-
it('should return true if all props are considered present in case-sensitive mode', ()=>{
|
|
336
|
-
const code = '<div ID="foo" className="box" />';
|
|
337
|
-
const node = getOpeningElement(code);
|
|
338
|
-
const { attributes: props } = node;
|
|
339
|
-
const prop = [
|
|
340
|
-
'ID',
|
|
341
|
-
'className'
|
|
342
|
-
];
|
|
343
|
-
const options = {
|
|
344
|
-
ignoreCase: false
|
|
345
|
-
};
|
|
346
|
-
const expected = true;
|
|
347
|
-
const actual = hasEveryProp(props, prop, options);
|
|
348
|
-
assert.equal(actual, expected);
|
|
349
|
-
});
|
|
350
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/* eslint-env mocha */ import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import assert from 'assert';
|
|
4
|
-
import core from '../../src/index';
|
|
5
|
-
const src = fs.readdirSync(path.resolve(__dirname, '../../src')).filter((f)=>f.indexOf('.js') >= 0).map((f)=>path.basename(f, '.js'));
|
|
6
|
-
describe('main export', ()=>{
|
|
7
|
-
it('should export an object', ()=>{
|
|
8
|
-
const expected = 'object';
|
|
9
|
-
const actual = typeof core;
|
|
10
|
-
assert.equal(actual, expected);
|
|
11
|
-
});
|
|
12
|
-
src.filter((f)=>f !== 'index').forEach((f)=>{
|
|
13
|
-
it(`should export ${f}`, ()=>{
|
|
14
|
-
assert.equal(core[f], require(path.join('../../src/', f)).default // eslint-disable-line
|
|
15
|
-
);
|
|
16
|
-
});
|
|
17
|
-
it(`should export ${f} from root`, ()=>{
|
|
18
|
-
const file = `${f}.js`;
|
|
19
|
-
const expected = true;
|
|
20
|
-
const actual = fs.statSync(path.join(path.resolve('.'), file)).isFile();
|
|
21
|
-
assert.equal(actual, expected);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* eslint-env mocha */ import assert from 'assert';
|
|
2
|
-
import { extractProp, setParserName } from '../helper';
|
|
3
|
-
import propName from '../../src/propName';
|
|
4
|
-
describe('propName', ()=>{
|
|
5
|
-
beforeEach(()=>{
|
|
6
|
-
setParserName('babel');
|
|
7
|
-
});
|
|
8
|
-
it('should export a function', ()=>{
|
|
9
|
-
const expected = 'function';
|
|
10
|
-
const actual = typeof propName;
|
|
11
|
-
assert.equal(actual, expected);
|
|
12
|
-
});
|
|
13
|
-
it('should throw an error if the argument is missing', ()=>{
|
|
14
|
-
assert.throws(()=>{
|
|
15
|
-
propName();
|
|
16
|
-
}, Error);
|
|
17
|
-
});
|
|
18
|
-
it('should throw an error if the argument not a JSX node', ()=>{
|
|
19
|
-
assert.throws(()=>{
|
|
20
|
-
propName({
|
|
21
|
-
a: 'foo'
|
|
22
|
-
});
|
|
23
|
-
}, Error);
|
|
24
|
-
});
|
|
25
|
-
it('should return correct name for normal prop', ()=>{
|
|
26
|
-
const prop = extractProp('<div foo="bar" />');
|
|
27
|
-
const expected = 'foo';
|
|
28
|
-
const actual = propName(prop);
|
|
29
|
-
assert.equal(actual, expected);
|
|
30
|
-
});
|
|
31
|
-
it('should return correct name for namespaced prop', ()=>{
|
|
32
|
-
const prop = extractProp('<div foo:bar="baz" />', 'foo:bar');
|
|
33
|
-
const expected = 'foo:bar';
|
|
34
|
-
const actual = propName(prop);
|
|
35
|
-
assert.equal(actual, expected);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { Schema } from "prosemirror-model";
|
|
2
|
-
import { EditorState } from "prosemirror-state";
|
|
3
|
-
import { reactKeys, reactKeysPluginKey } from "../reactKeys.js";
|
|
4
|
-
const schema = new Schema({
|
|
5
|
-
nodes: {
|
|
6
|
-
doc: {
|
|
7
|
-
content: "block+"
|
|
8
|
-
},
|
|
9
|
-
paragraph: {
|
|
10
|
-
group: "block",
|
|
11
|
-
content: "inline*"
|
|
12
|
-
},
|
|
13
|
-
list: {
|
|
14
|
-
group: "block",
|
|
15
|
-
content: "list_item+"
|
|
16
|
-
},
|
|
17
|
-
list_item: {
|
|
18
|
-
content: "inline*"
|
|
19
|
-
},
|
|
20
|
-
text: {
|
|
21
|
-
group: "inline"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
describe("reactNodeViewPlugin", ()=>{
|
|
26
|
-
it("should create a unique key for each node", ()=>{
|
|
27
|
-
const editorState = EditorState.create({
|
|
28
|
-
doc: schema.topNodeType.create(null, [
|
|
29
|
-
schema.nodes.paragraph.create(),
|
|
30
|
-
schema.nodes.paragraph.create(),
|
|
31
|
-
schema.nodes.paragraph.create()
|
|
32
|
-
]),
|
|
33
|
-
plugins: [
|
|
34
|
-
reactKeys()
|
|
35
|
-
]
|
|
36
|
-
});
|
|
37
|
-
const pluginState = reactKeysPluginKey.getState(editorState);
|
|
38
|
-
expect(pluginState.posToKey.size).toBe(3);
|
|
39
|
-
});
|
|
40
|
-
it("should maintain key stability when possible", ()=>{
|
|
41
|
-
const initialEditorState = EditorState.create({
|
|
42
|
-
doc: schema.topNodeType.create(null, [
|
|
43
|
-
schema.nodes.paragraph.create({}, schema.text("Hello")),
|
|
44
|
-
schema.nodes.paragraph.create(),
|
|
45
|
-
schema.nodes.paragraph.create()
|
|
46
|
-
]),
|
|
47
|
-
plugins: [
|
|
48
|
-
reactKeys()
|
|
49
|
-
]
|
|
50
|
-
});
|
|
51
|
-
const initialPluginState = reactKeysPluginKey.getState(initialEditorState);
|
|
52
|
-
const nextEditorState = initialEditorState.apply(initialEditorState.tr.insertText(", world!", 6));
|
|
53
|
-
const nextPluginState = reactKeysPluginKey.getState(nextEditorState);
|
|
54
|
-
expect(Array.from(initialPluginState.keyToPos.keys())).toEqual(Array.from(nextPluginState.keyToPos.keys()));
|
|
55
|
-
});
|
|
56
|
-
it("should create unique keys for new nodes", ()=>{
|
|
57
|
-
const initialEditorState = EditorState.create({
|
|
58
|
-
doc: schema.topNodeType.create(null, [
|
|
59
|
-
schema.nodes.paragraph.create(),
|
|
60
|
-
schema.nodes.paragraph.create(),
|
|
61
|
-
schema.nodes.paragraph.create()
|
|
62
|
-
]),
|
|
63
|
-
plugins: [
|
|
64
|
-
reactKeys()
|
|
65
|
-
]
|
|
66
|
-
});
|
|
67
|
-
const initialPluginState = reactKeysPluginKey.getState(initialEditorState);
|
|
68
|
-
const nextEditorState = initialEditorState.apply(initialEditorState.tr.insert(0, schema.nodes.list.createAndFill()));
|
|
69
|
-
const nextPluginState = reactKeysPluginKey.getState(nextEditorState);
|
|
70
|
-
// Adds new keys for new nodes
|
|
71
|
-
expect(nextPluginState.keyToPos.size).toBe(5);
|
|
72
|
-
// Maintains keys for previous nodes that are still there
|
|
73
|
-
Array.from(initialPluginState.keyToPos.keys()).forEach((key)=>{
|
|
74
|
-
expect(Array.from(nextPluginState.keyToPos.keys())).toContain(key);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
var config_loader_1 = require("../config-loader");
|
|
6
|
-
var path_1 = require("path");
|
|
7
|
-
describe("config-loader", function() {
|
|
8
|
-
it("should use explicitParams when set", function() {
|
|
9
|
-
var result = (0, config_loader_1.configLoader)({
|
|
10
|
-
explicitParams: {
|
|
11
|
-
baseUrl: "/foo/bar",
|
|
12
|
-
paths: {
|
|
13
|
-
asd: [
|
|
14
|
-
"asd"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
cwd: "/baz"
|
|
19
|
-
});
|
|
20
|
-
var successResult = result;
|
|
21
|
-
// assert.equal(successResult.resultType, "success");
|
|
22
|
-
// assert.equal(successResult.absoluteBaseUrl, "/foo/bar");
|
|
23
|
-
// assert.equal(successResult.paths["asd"][0], "asd");
|
|
24
|
-
expect(successResult.resultType).toBe("success");
|
|
25
|
-
expect(successResult.absoluteBaseUrl).toBe("/foo/bar");
|
|
26
|
-
expect(successResult.paths["asd"][0]).toBe("asd");
|
|
27
|
-
});
|
|
28
|
-
it("should use explicitParams when set and add cwd when path is relative", function() {
|
|
29
|
-
var result = (0, config_loader_1.configLoader)({
|
|
30
|
-
explicitParams: {
|
|
31
|
-
baseUrl: "bar/",
|
|
32
|
-
paths: {
|
|
33
|
-
asd: [
|
|
34
|
-
"asd"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
cwd: "/baz"
|
|
39
|
-
});
|
|
40
|
-
var successResult = result;
|
|
41
|
-
// assert.equal(successResult.resultType, "success");
|
|
42
|
-
// assert.equal(successResult.absoluteBaseUrl, join("/baz", "bar/"));
|
|
43
|
-
expect(successResult.resultType).toBe("success");
|
|
44
|
-
expect(successResult.absoluteBaseUrl).toBe((0, path_1.join)("/baz", "bar/"));
|
|
45
|
-
});
|
|
46
|
-
it("should fallback to tsConfigLoader when explicitParams is not set", function() {
|
|
47
|
-
var result = (0, config_loader_1.configLoader)({
|
|
48
|
-
explicitParams: undefined,
|
|
49
|
-
cwd: "/baz",
|
|
50
|
-
// tslint:disable-next-line:no-any
|
|
51
|
-
tsConfigLoader: function(_) {
|
|
52
|
-
return {
|
|
53
|
-
tsConfigPath: "/baz/tsconfig.json",
|
|
54
|
-
baseUrl: "./src",
|
|
55
|
-
paths: {}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
var successResult = result;
|
|
60
|
-
// assert.equal(successResult.resultType, "success");
|
|
61
|
-
// assert.equal(successResult.absoluteBaseUrl, join("/baz", "src"));
|
|
62
|
-
expect(successResult.resultType).toBe("success");
|
|
63
|
-
expect(successResult.absoluteBaseUrl).toBe((0, path_1.join)("/baz", "src"));
|
|
64
|
-
});
|
|
65
|
-
it("should show an error message when baseUrl is missing", function() {
|
|
66
|
-
var result = (0, config_loader_1.configLoader)({
|
|
67
|
-
explicitParams: undefined,
|
|
68
|
-
cwd: "/baz",
|
|
69
|
-
// tslint:disable-next-line:no-any
|
|
70
|
-
tsConfigLoader: function(_) {
|
|
71
|
-
return {
|
|
72
|
-
tsConfigPath: "/baz/tsconfig.json",
|
|
73
|
-
baseUrl: undefined,
|
|
74
|
-
paths: {}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
var failResult = result;
|
|
79
|
-
// assert.equal(failResult.resultType, "failed");
|
|
80
|
-
// assert.isTrue(failResult.message.indexOf("baseUrl") > -1);
|
|
81
|
-
expect(failResult.resultType).toBe("failed");
|
|
82
|
-
expect(failResult.message.indexOf("baseUrl") > -1).toBeTruthy();
|
|
83
|
-
});
|
|
84
|
-
it("should presume cwd to be a tsconfig file when loadConfig is called with absolute path to tsconfig.json", function() {
|
|
85
|
-
// using tsconfig-named.json to ensure that future changes to fix
|
|
86
|
-
// https://github.com/dividab/tsconfig-paths/issues/31
|
|
87
|
-
// do not pass this test case just because of a directory walk looking
|
|
88
|
-
// for tsconfig.json
|
|
89
|
-
var configFile = (0, path_1.join)(__dirname, "tsconfig-named.json");
|
|
90
|
-
var result = (0, config_loader_1.loadConfig)(configFile);
|
|
91
|
-
var successResult = result;
|
|
92
|
-
// assert.equal(successResult.resultType, "success");
|
|
93
|
-
// assert.equal(successResult.configFileAbsolutePath, configFile);
|
|
94
|
-
expect(successResult.resultType).toBe("success");
|
|
95
|
-
expect(successResult.configFileAbsolutePath).toBe(configFile);
|
|
96
|
-
});
|
|
97
|
-
}); //# sourceMappingURL=config-loader.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|