@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.
Files changed (63) hide show
  1. package/dist/cjs/tiptap/TiptapEditorView.js +2 -1
  2. package/dist/cjs/tiptap/tiptapNodeView.js +26 -13
  3. package/dist/esm/tiptap/TiptapEditorView.js +2 -1
  4. package/dist/esm/tiptap/tiptapNodeView.js +27 -14
  5. package/dist/tsconfig.tsbuildinfo +1 -1
  6. package/dist/types/constants.d.ts +1 -1
  7. package/dist/types/props.d.ts +26 -26
  8. package/dist/types/tiptap/TiptapEditorView.d.ts +2 -1
  9. package/package.json +1 -1
  10. package/dist/esm/@jest/pattern/src/__tests__/TestPathPatterns.test.js +0 -241
  11. package/dist/esm/@swc/cli/lib/swc/__tests__/compile.test.js +0 -19
  12. package/dist/esm/@swc/cli/lib/swc/__tests__/options.test.js +0 -315
  13. package/dist/esm/@swc/cli/lib/swc/__tests__/sources.test.js +0 -161
  14. package/dist/esm/@uiw/react-codemirror/src/__tests__/index.test.js +0 -111
  15. package/dist/esm/cheerio/src/__tests__/deprecated.spec.js +0 -249
  16. package/dist/esm/cheerio/src/__tests__/xml.spec.js +0 -55
  17. package/dist/esm/components/__tests__/ProseMirror.composition.test.js +0 -395
  18. package/dist/esm/components/__tests__/ProseMirror.domchange.test.js +0 -266
  19. package/dist/esm/components/__tests__/ProseMirror.draw-decoration.test.js +0 -968
  20. package/dist/esm/components/__tests__/ProseMirror.draw.test.js +0 -335
  21. package/dist/esm/components/__tests__/ProseMirror.mobile.test.js +0 -54
  22. package/dist/esm/components/__tests__/ProseMirror.node-view.test.js +0 -553
  23. package/dist/esm/components/__tests__/ProseMirror.selection.test.js +0 -440
  24. package/dist/esm/components/__tests__/ProseMirror.test.js +0 -324
  25. package/dist/esm/contexts/__tests__/DeferredLayoutEffects.test.js +0 -98
  26. package/dist/esm/hooks/__tests__/useEditorEffect.test.js +0 -134
  27. package/dist/esm/jsx-ast-utils/__tests__/helper.js +0 -83
  28. package/dist/esm/jsx-ast-utils/__tests__/src/elementType-test.js +0 -76
  29. package/dist/esm/jsx-ast-utils/__tests__/src/eventHandlers-test.js +0 -98
  30. package/dist/esm/jsx-ast-utils/__tests__/src/getProp-parser-test.js +0 -188
  31. package/dist/esm/jsx-ast-utils/__tests__/src/getProp-test.js +0 -119
  32. package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-babelparser-test.js +0 -393
  33. package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-flowparser-test.js +0 -379
  34. package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-babelparser-test.js +0 -925
  35. package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-flowparser-test.js +0 -700
  36. package/dist/esm/jsx-ast-utils/__tests__/src/hasProp-test.js +0 -350
  37. package/dist/esm/jsx-ast-utils/__tests__/src/index-test.js +0 -24
  38. package/dist/esm/jsx-ast-utils/__tests__/src/propName-test.js +0 -37
  39. package/dist/esm/plugins/__tests__/reactKeys.test.js +0 -77
  40. package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.d.js +0 -1
  41. package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.js +0 -97
  42. package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.d.js +0 -1
  43. package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.js +0 -319
  44. package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.d.js +0 -1
  45. package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.js +0 -62
  46. package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.d.js +0 -1
  47. package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.js +0 -80
  48. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.d.js +0 -1
  49. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.js +0 -22
  50. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.d.js +0 -1
  51. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.js +0 -20
  52. package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.d.js +0 -1
  53. package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.js +0 -219
  54. package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.js +0 -1
  55. package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js +0 -323
  56. package/dist/esm/tsconfig-paths/src/__tests__/config-loader.test.js +0 -89
  57. package/dist/esm/tsconfig-paths/src/__tests__/data/match-path-data.js +0 -314
  58. package/dist/esm/tsconfig-paths/src/__tests__/filesystem.test.js +0 -58
  59. package/dist/esm/tsconfig-paths/src/__tests__/mapping-entry.test.js +0 -76
  60. package/dist/esm/tsconfig-paths/src/__tests__/match-path-async.test.js +0 -12
  61. package/dist/esm/tsconfig-paths/src/__tests__/match-path-sync.test.js +0 -10
  62. package/dist/esm/tsconfig-paths/src/__tests__/try-path.test.js +0 -214
  63. package/dist/esm/tsconfig-paths/src/__tests__/tsconfig-loader.test.js +0 -296
@@ -1,379 +0,0 @@
1
- /* eslint-env mocha */ /* eslint no-template-curly-in-string: 0 */ import assert from 'assert';
2
- import { extractProp, describeIfNotBabylon, changePlugins, setParserName } from '../helper';
3
- import { getLiteralPropValue } from '../../src/getPropValue';
4
- describe('getLiteralPropValue', ()=>{
5
- beforeEach(()=>{
6
- setParserName('flow');
7
- });
8
- it('should export a function', ()=>{
9
- const expected = 'function';
10
- const actual = typeof getLiteralPropValue;
11
- assert.equal(actual, expected);
12
- });
13
- it('should return undefined when not provided with a JSXAttribute', ()=>{
14
- const expected = undefined;
15
- const actual = getLiteralPropValue(1);
16
- assert.equal(actual, expected);
17
- });
18
- it('should not throw error when trying to get value from unknown node type', ()=>{
19
- const prop = {
20
- type: 'JSXAttribute',
21
- value: {
22
- type: 'JSXExpressionContainer'
23
- }
24
- };
25
- let counter = 0;
26
- // eslint-disable-next-line no-console
27
- const errorOrig = console.error;
28
- // eslint-disable-next-line no-console
29
- console.error = ()=>{
30
- counter += 1;
31
- };
32
- let value;
33
- assert.doesNotThrow(()=>{
34
- value = getLiteralPropValue(prop);
35
- }, Error);
36
- assert.equal(null, value);
37
- assert.equal(counter, 1);
38
- // eslint-disable-next-line no-console
39
- console.error = errorOrig;
40
- });
41
- describe('Null', ()=>{
42
- it('should return true when no value is given', ()=>{
43
- const prop = extractProp('<div foo />');
44
- const expected = true;
45
- const actual = getLiteralPropValue(prop);
46
- assert.equal(actual, expected);
47
- });
48
- });
49
- describe('Literal', ()=>{
50
- it('should return correct string if value is a string', ()=>{
51
- const prop = extractProp('<div foo="bar" />');
52
- const expected = 'bar';
53
- const actual = getLiteralPropValue(prop);
54
- assert.equal(actual, expected);
55
- });
56
- it('should return correct string if value is a string expression', ()=>{
57
- const prop = extractProp('<div foo={"bar"} />');
58
- const expected = 'bar';
59
- const actual = getLiteralPropValue(prop);
60
- assert.equal(actual, expected);
61
- });
62
- it('should return correct integer if value is a integer expression', ()=>{
63
- const prop = extractProp('<div foo={1} />');
64
- const expected = 1;
65
- const actual = getLiteralPropValue(prop);
66
- assert.equal(actual, expected);
67
- });
68
- it('should convert "true" to boolean type', ()=>{
69
- const prop = extractProp('<div foo="true" />');
70
- const expected = true;
71
- const actual = getLiteralPropValue(prop);
72
- assert.equal(actual, expected);
73
- });
74
- it('should convert "TrUE" to boolean type', ()=>{
75
- const prop = extractProp('<div foo="TrUE" />');
76
- const expected = true;
77
- const actual = getLiteralPropValue(prop);
78
- assert.equal(actual, expected);
79
- });
80
- it('should convert "false" to boolean type', ()=>{
81
- const prop = extractProp('<div foo="false" />');
82
- const expected = false;
83
- const actual = getLiteralPropValue(prop);
84
- assert.equal(actual, expected);
85
- });
86
- it('should convert "FaLsE" to boolean type', ()=>{
87
- const prop = extractProp('<div foo="FaLsE" />');
88
- const expected = false;
89
- const actual = getLiteralPropValue(prop);
90
- assert.equal(actual, expected);
91
- });
92
- it('should return String null when value is null', ()=>{
93
- const prop = extractProp('<div foo={null} />');
94
- const expected = 'null';
95
- const actual = getLiteralPropValue(prop);
96
- assert.equal(actual, expected);
97
- });
98
- });
99
- describe('JSXElement', ()=>{
100
- it('should return null', ()=>{
101
- const prop = extractProp('<div foo={<bar />} />');
102
- const expected = null;
103
- const actual = getLiteralPropValue(prop);
104
- assert.equal(actual, expected);
105
- });
106
- });
107
- describe('Identifier', ()=>{
108
- it('should return null', ()=>{
109
- const prop = extractProp('<div foo={bar} />');
110
- const expected = null;
111
- const actual = getLiteralPropValue(prop);
112
- assert.equal(actual, expected);
113
- });
114
- it('should return undefined when identifier is literally `undefined`', ()=>{
115
- const prop = extractProp('<div foo={undefined} />');
116
- const expected = undefined;
117
- const actual = getLiteralPropValue(prop);
118
- assert.equal(actual, expected);
119
- });
120
- });
121
- describe('Template literal', ()=>{
122
- it('should return template literal with vars wrapped in curly braces', ()=>{
123
- const prop = extractProp('<div foo={`bar ${baz}`} />');
124
- const expected = 'bar {baz}';
125
- const actual = getLiteralPropValue(prop);
126
- assert.equal(actual, expected);
127
- });
128
- it('should return string "undefined" for expressions that evaluate to undefined', ()=>{
129
- const prop = extractProp('<div foo={`bar ${undefined}`} />');
130
- const expected = 'bar undefined';
131
- const actual = getLiteralPropValue(prop);
132
- assert.equal(actual, expected);
133
- });
134
- });
135
- describe('Tagged Template literal', ()=>{
136
- it('should return template literal with vars wrapped in curly braces', ()=>{
137
- const prop = extractProp('<div foo={noop`bar ${baz}`} />');
138
- const expected = 'bar {baz}';
139
- const actual = getLiteralPropValue(prop);
140
- assert.equal(actual, expected);
141
- });
142
- it('should return string "undefined" for expressions that evaluate to undefined', ()=>{
143
- const prop = extractProp('<div foo={noop`bar ${undefined}`} />');
144
- const expected = 'bar undefined';
145
- const actual = getLiteralPropValue(prop);
146
- assert.equal(actual, expected);
147
- });
148
- });
149
- describe('Arrow function expression', ()=>{
150
- it('should return null', ()=>{
151
- const prop = extractProp('<div foo={ () => { return "bar"; }} />');
152
- const expected = null;
153
- const actual = getLiteralPropValue(prop);
154
- assert.equal(actual, expected);
155
- });
156
- });
157
- describe('Function expression', ()=>{
158
- it('should return null', ()=>{
159
- const prop = extractProp('<div foo={ function() { return "bar"; } } />');
160
- const expected = null;
161
- const actual = getLiteralPropValue(prop);
162
- assert.equal(actual, expected);
163
- });
164
- });
165
- describe('Logical expression', ()=>{
166
- it('should return null for && operator', ()=>{
167
- const prop = extractProp('<div foo={bar && baz} />');
168
- const expected = null;
169
- const actual = getLiteralPropValue(prop);
170
- assert.equal(actual, expected);
171
- });
172
- it('should return null for || operator', ()=>{
173
- const prop = extractProp('<div foo={bar || baz} />');
174
- const expected = null;
175
- const actual = getLiteralPropValue(prop);
176
- assert.equal(actual, expected);
177
- });
178
- });
179
- describe('Member expression', ()=>{
180
- it('should return null', ()=>{
181
- const prop = extractProp('<div foo={bar.baz} />');
182
- const expected = null;
183
- const actual = getLiteralPropValue(prop);
184
- assert.equal(actual, expected);
185
- });
186
- });
187
- describe('Call expression', ()=>{
188
- it('should return null', ()=>{
189
- const prop = extractProp('<div foo={bar()} />');
190
- const expected = null;
191
- const actual = getLiteralPropValue(prop);
192
- assert.equal(actual, expected);
193
- });
194
- });
195
- describe('Unary expression', ()=>{
196
- it('should correctly evaluate an expression that prefixes with -', ()=>{
197
- const prop = extractProp('<div foo={-bar} />');
198
- // -"bar" => NaN
199
- const expected = true;
200
- const actual = Number.isNaN(getLiteralPropValue(prop));
201
- assert.equal(actual, expected);
202
- });
203
- it('should correctly evaluate an expression that prefixes with -', ()=>{
204
- const prop = extractProp('<div foo={-42} />');
205
- const expected = -42;
206
- const actual = getLiteralPropValue(prop);
207
- assert.equal(actual, expected);
208
- });
209
- it('should correctly evaluate an expression that prefixes with +', ()=>{
210
- const prop = extractProp('<div foo={+bar} />');
211
- // +"bar" => NaN
212
- const expected = true;
213
- const actual = Number.isNaN(getLiteralPropValue(prop));
214
- assert.equal(actual, expected);
215
- });
216
- it('should correctly evaluate an expression that prefixes with +', ()=>{
217
- const prop = extractProp('<div foo={+42} />');
218
- const expected = 42;
219
- const actual = getLiteralPropValue(prop);
220
- assert.equal(actual, expected);
221
- });
222
- it('should correctly evaluate an expression that prefixes with !', ()=>{
223
- const prop = extractProp('<div foo={!bar} />');
224
- const expected = false; // !"bar" === false
225
- const actual = getLiteralPropValue(prop);
226
- assert.equal(actual, expected);
227
- });
228
- it('should correctly evaluate an expression that prefixes with ~', ()=>{
229
- const prop = extractProp('<div foo={~bar} />');
230
- const expected = -1; // ~"bar" === -1
231
- const actual = getLiteralPropValue(prop);
232
- assert.equal(actual, expected);
233
- });
234
- it('should return true when evaluating `delete foo`', ()=>{
235
- const prop = extractProp('<div foo={delete x} />');
236
- const expected = true;
237
- const actual = getLiteralPropValue(prop);
238
- assert.equal(actual, expected);
239
- });
240
- it('should return undefined when evaluating `void foo`', ()=>{
241
- const prop = extractProp('<div foo={void x} />');
242
- const expected = undefined;
243
- const actual = getLiteralPropValue(prop);
244
- assert.equal(actual, expected);
245
- });
246
- // TODO: We should fix this to check to see if we can evaluate it.
247
- it('should return undefined when evaluating `typeof foo`', ()=>{
248
- const prop = extractProp('<div foo={typeof x} />');
249
- const expected = undefined;
250
- const actual = getLiteralPropValue(prop);
251
- assert.equal(actual, expected);
252
- });
253
- });
254
- describe('Update expression', ()=>{
255
- it('should correctly evaluate an expression that prefixes with ++', ()=>{
256
- const prop = extractProp('<div foo={++bar} />');
257
- // ++"bar" => NaN
258
- const expected = true;
259
- const actual = Number.isNaN(getLiteralPropValue(prop));
260
- assert.equal(actual, expected);
261
- });
262
- it('should correctly evaluate an expression that prefixes with --', ()=>{
263
- const prop = extractProp('<div foo={--bar} />');
264
- // --"bar" => NaN
265
- const expected = true;
266
- const actual = Number.isNaN(getLiteralPropValue(prop));
267
- assert.equal(actual, expected);
268
- });
269
- it('should correctly evaluate an expression that suffixes with ++', ()=>{
270
- const prop = extractProp('<div foo={bar++} />');
271
- // "bar"++ => NaN
272
- const expected = true;
273
- const actual = Number.isNaN(getLiteralPropValue(prop));
274
- assert.equal(actual, expected);
275
- });
276
- it('should correctly evaluate an expression that suffixes with --', ()=>{
277
- const prop = extractProp('<div foo={bar--} />');
278
- // "bar"-- => NaN
279
- const expected = true;
280
- const actual = Number.isNaN(getLiteralPropValue(prop));
281
- assert.equal(actual, expected);
282
- });
283
- });
284
- describe('This expression', ()=>{
285
- it('should return null', ()=>{
286
- const prop = extractProp('<div foo={this} />');
287
- const expected = null;
288
- const actual = getLiteralPropValue(prop);
289
- assert.equal(actual, expected);
290
- });
291
- });
292
- describe('Conditional expression', ()=>{
293
- it('should return null', ()=>{
294
- const prop = extractProp('<div foo={bar ? baz : bam} />');
295
- const expected = null;
296
- const actual = getLiteralPropValue(prop);
297
- assert.equal(actual, expected);
298
- });
299
- });
300
- describe('Binary expression', ()=>{
301
- it('should return null', ()=>{
302
- const prop = extractProp('<div foo={1 == "1"} />');
303
- const expected = null;
304
- const actual = getLiteralPropValue(prop);
305
- assert.equal(actual, expected);
306
- });
307
- });
308
- describe('Object expression', ()=>{
309
- it('should return null', ()=>{
310
- const prop = extractProp('<div foo={ { bar: "baz" } } />');
311
- const expected = null;
312
- const actual = getLiteralPropValue(prop);
313
- assert.deepEqual(actual, expected);
314
- });
315
- });
316
- describe('New expression', ()=>{
317
- it('should return null', ()=>{
318
- const prop = extractProp('<div foo={new Bar()} />');
319
- const expected = null;
320
- const actual = getLiteralPropValue(prop);
321
- assert.deepEqual(actual, expected);
322
- });
323
- });
324
- describe('Array expression', ()=>{
325
- it('should evaluate to correct representation of the the array in props', ()=>{
326
- const prop = extractProp('<div foo={["bar", 42, null]} />');
327
- const expected = [
328
- 'bar',
329
- 42
330
- ];
331
- const actual = getLiteralPropValue(prop);
332
- assert.deepEqual(actual, expected);
333
- });
334
- });
335
- it('should return an empty array provided an empty array in props', ()=>{
336
- const prop = extractProp('<div foo={[]} />');
337
- const expected = [];
338
- const actual = getLiteralPropValue(prop);
339
- assert.deepEqual(actual, expected);
340
- });
341
- describe('Bind expression', ()=>{
342
- it('should return null', ()=>{
343
- const prop = extractProp('<div foo={::this.handleClick} />');
344
- const expected = 'null';
345
- const actual = getLiteralPropValue(prop);
346
- assert.deepEqual(actual, expected);
347
- });
348
- });
349
- describeIfNotBabylon('Typescript', ()=>{
350
- beforeEach(()=>{
351
- changePlugins((pls)=>[
352
- ...pls,
353
- 'typescript'
354
- ]);
355
- });
356
- it('should return string representation of variable identifier wrapped in a Typescript non-null assertion', ()=>{
357
- const prop = extractProp('<div foo={bar!} />');
358
- const expected = null;
359
- const actual = getLiteralPropValue(prop);
360
- assert.equal(actual, expected);
361
- });
362
- it('should return string representation of variable identifier wrapped in a deep Typescript non-null assertion', ()=>{
363
- const prop = extractProp('<div foo={(bar!)!} />');
364
- const expected = null;
365
- const actual = getLiteralPropValue(prop);
366
- assert.equal(actual, expected);
367
- });
368
- it('should return string representation of variable identifier wrapped in a Typescript type coercion', ()=>{
369
- changePlugins((pls)=>[
370
- ...pls,
371
- 'typescript'
372
- ]);
373
- const prop = extractProp('<div foo={bar as any} />');
374
- const expected = null;
375
- const actual = getLiteralPropValue(prop);
376
- assert.equal(actual, expected);
377
- });
378
- });
379
- });