@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,249 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file includes tests for deprecated APIs. The methods are expected to be
|
|
3
|
-
* removed in the next major release of Cheerio, but their stability should be
|
|
4
|
-
* maintained until that time.
|
|
5
|
-
*/ import { describe, it, expect, beforeEach } from 'vitest';
|
|
6
|
-
import { cheerio, food, fruits } from '../__fixtures__/fixtures.js';
|
|
7
|
-
describe('deprecated APIs', ()=>{
|
|
8
|
-
describe('cheerio module', ()=>{
|
|
9
|
-
describe('.parseHTML', ()=>{
|
|
10
|
-
it('(html) : should preserve content', ()=>{
|
|
11
|
-
const html = '<div>test div</div>';
|
|
12
|
-
expect(cheerio(cheerio.parseHTML(html)[0]).html()).toBe('test div');
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
describe('.merge', ()=>{
|
|
16
|
-
it('should be a function', ()=>{
|
|
17
|
-
expect(typeof cheerio.merge).toBe('function');
|
|
18
|
-
});
|
|
19
|
-
// #1674 - merge, wont accept Cheerio object
|
|
20
|
-
it('should be a able merge array and cheerio object', ()=>{
|
|
21
|
-
const ret = cheerio.merge(cheerio(), [
|
|
22
|
-
'elem1',
|
|
23
|
-
'elem2'
|
|
24
|
-
]);
|
|
25
|
-
expect(typeof ret).toBe('object');
|
|
26
|
-
expect(ret).toHaveLength(2);
|
|
27
|
-
});
|
|
28
|
-
it('(arraylike, arraylike) : should modify the first array, but not the second', ()=>{
|
|
29
|
-
const arr1 = [
|
|
30
|
-
1,
|
|
31
|
-
2,
|
|
32
|
-
3
|
|
33
|
-
];
|
|
34
|
-
const arr2 = [
|
|
35
|
-
4,
|
|
36
|
-
5,
|
|
37
|
-
6
|
|
38
|
-
];
|
|
39
|
-
const ret = cheerio.merge(arr1, arr2);
|
|
40
|
-
expect(typeof ret).toBe('object');
|
|
41
|
-
expect(Array.isArray(ret)).toBe(true);
|
|
42
|
-
expect(ret).toBe(arr1);
|
|
43
|
-
expect(arr1).toHaveLength(6);
|
|
44
|
-
expect(arr2).toHaveLength(3);
|
|
45
|
-
});
|
|
46
|
-
it('(arraylike, arraylike) : should handle objects that arent arrays, but are arraylike', ()=>{
|
|
47
|
-
const arr1 = {
|
|
48
|
-
length: 3,
|
|
49
|
-
0: 'a',
|
|
50
|
-
1: 'b',
|
|
51
|
-
2: 'c'
|
|
52
|
-
};
|
|
53
|
-
const arr2 = {
|
|
54
|
-
length: 3,
|
|
55
|
-
0: 'd',
|
|
56
|
-
1: 'e',
|
|
57
|
-
2: 'f'
|
|
58
|
-
};
|
|
59
|
-
cheerio.merge(arr1, arr2);
|
|
60
|
-
expect(arr1).toHaveLength(6);
|
|
61
|
-
expect(arr1[3]).toBe('d');
|
|
62
|
-
expect(arr1[4]).toBe('e');
|
|
63
|
-
expect(arr1[5]).toBe('f');
|
|
64
|
-
expect(arr2).toHaveLength(3);
|
|
65
|
-
});
|
|
66
|
-
it('(?, ?) : should gracefully reject invalid inputs', ()=>{
|
|
67
|
-
expect(cheerio.merge([
|
|
68
|
-
4
|
|
69
|
-
], 3)).toBeUndefined();
|
|
70
|
-
expect(cheerio.merge({}, {})).toBeUndefined();
|
|
71
|
-
expect(cheerio.merge([], {})).toBeUndefined();
|
|
72
|
-
expect(cheerio.merge({}, [])).toBeUndefined();
|
|
73
|
-
const fakeArray = {
|
|
74
|
-
length: 3,
|
|
75
|
-
0: 'a',
|
|
76
|
-
1: 'b',
|
|
77
|
-
3: 'd'
|
|
78
|
-
};
|
|
79
|
-
expect(cheerio.merge(fakeArray, [])).toBeUndefined();
|
|
80
|
-
expect(cheerio.merge([], fakeArray)).toBeUndefined();
|
|
81
|
-
expect(cheerio.merge({
|
|
82
|
-
length: '7'
|
|
83
|
-
}, [])).toBeUndefined();
|
|
84
|
-
expect(cheerio.merge({
|
|
85
|
-
length: -1
|
|
86
|
-
}, [])).toBeUndefined();
|
|
87
|
-
});
|
|
88
|
-
it('(?, ?) : should no-op on invalid inputs', ()=>{
|
|
89
|
-
const fakeArray1 = {
|
|
90
|
-
length: 3,
|
|
91
|
-
0: 'a',
|
|
92
|
-
1: 'b',
|
|
93
|
-
3: 'd'
|
|
94
|
-
};
|
|
95
|
-
cheerio.merge(fakeArray1, []);
|
|
96
|
-
expect(fakeArray1).toHaveLength(3);
|
|
97
|
-
expect(fakeArray1[0]).toBe('a');
|
|
98
|
-
expect(fakeArray1[1]).toBe('b');
|
|
99
|
-
expect(fakeArray1[3]).toBe('d');
|
|
100
|
-
cheerio.merge([], fakeArray1);
|
|
101
|
-
expect(fakeArray1).toHaveLength(3);
|
|
102
|
-
expect(fakeArray1[0]).toBe('a');
|
|
103
|
-
expect(fakeArray1[1]).toBe('b');
|
|
104
|
-
expect(fakeArray1[3]).toBe('d');
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
describe('.contains', ()=>{
|
|
108
|
-
let $;
|
|
109
|
-
beforeEach(()=>{
|
|
110
|
-
$ = cheerio.load(food);
|
|
111
|
-
});
|
|
112
|
-
it('(container, contained) : should correctly detect the provided element', ()=>{
|
|
113
|
-
const $food = $('#food');
|
|
114
|
-
const $fruits = $('#fruits');
|
|
115
|
-
const $apple = $('.apple');
|
|
116
|
-
expect(cheerio.contains($food[0], $fruits[0])).toBe(true);
|
|
117
|
-
expect(cheerio.contains($food[0], $apple[0])).toBe(true);
|
|
118
|
-
});
|
|
119
|
-
it('(container, other) : should not detect elements that are not contained', ()=>{
|
|
120
|
-
const $fruits = $('#fruits');
|
|
121
|
-
const $vegetables = $('#vegetables');
|
|
122
|
-
const $apple = $('.apple');
|
|
123
|
-
expect(cheerio.contains($vegetables[0], $apple[0])).toBe(false);
|
|
124
|
-
expect(cheerio.contains($fruits[0], $vegetables[0])).toBe(false);
|
|
125
|
-
expect(cheerio.contains($vegetables[0], $fruits[0])).toBe(false);
|
|
126
|
-
expect(cheerio.contains($fruits[0], $fruits[0])).toBe(false);
|
|
127
|
-
expect(cheerio.contains($vegetables[0], $vegetables[0])).toBe(false);
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
describe('.root', ()=>{
|
|
131
|
-
it('returns an empty selection', ()=>{
|
|
132
|
-
const $empty = cheerio.root();
|
|
133
|
-
expect($empty).toHaveLength(1);
|
|
134
|
-
expect($empty[0].children).toHaveLength(0);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
describe('Cheerio function', ()=>{
|
|
139
|
-
it('.load', ()=>{
|
|
140
|
-
const $1 = cheerio.load(fruits);
|
|
141
|
-
const $2 = $1.load('<div><p>Some <a>text</a>.</p></div>');
|
|
142
|
-
expect($2('a')).toHaveLength(1);
|
|
143
|
-
});
|
|
144
|
-
/**
|
|
145
|
-
* The `.html` static method defined on the "loaded" Cheerio factory
|
|
146
|
-
* function is deprecated.
|
|
147
|
-
*
|
|
148
|
-
* In order to promote consistency with the jQuery library, users are
|
|
149
|
-
* encouraged to instead use the instance method of the same name.
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
*
|
|
153
|
-
* ```js
|
|
154
|
-
* const $ = cheerio.load('<h1>Hello, <span>world</span>.</h1>');
|
|
155
|
-
*
|
|
156
|
-
* $('h1').html();
|
|
157
|
-
* //=> '<h1>Hello, <span>world</span>.'
|
|
158
|
-
* ```
|
|
159
|
-
*
|
|
160
|
-
* @example <caption>To render the markup of an entire document, invoke the
|
|
161
|
-
* `html` function exported by the Cheerio module with a "root"
|
|
162
|
-
* selection.</caption>
|
|
163
|
-
*
|
|
164
|
-
* ```js
|
|
165
|
-
* cheerio.html($.root());
|
|
166
|
-
* //=> '<html><head></head><body><h1>Hello, <span>world</span>.</h1></body></html>'
|
|
167
|
-
* ```
|
|
168
|
-
*/ describe('.html - deprecated API', ()=>{
|
|
169
|
-
it('() : of empty cheerio object should return null', ()=>{
|
|
170
|
-
/*
|
|
171
|
-
* Note: the direct invocation of the Cheerio constructor function is
|
|
172
|
-
* also deprecated.
|
|
173
|
-
*/ const $ = cheerio();
|
|
174
|
-
expect($.html()).toBe(null);
|
|
175
|
-
});
|
|
176
|
-
it('(selector) : should return the outerHTML of the selected element', ()=>{
|
|
177
|
-
const $ = cheerio.load(fruits);
|
|
178
|
-
expect($.html('.pear')).toBe('<li class="pear">Pear</li>');
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
/**
|
|
182
|
-
* The `.xml` static method defined on the "loaded" Cheerio factory function
|
|
183
|
-
* is deprecated. Users are encouraged to instead use the `xml` function
|
|
184
|
-
* exported by the Cheerio module.
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
*
|
|
188
|
-
* ```js
|
|
189
|
-
* cheerio.xml($.root());
|
|
190
|
-
* ```
|
|
191
|
-
*/ describe('.xml - deprecated API', ()=>{
|
|
192
|
-
it('() : renders XML', ()=>{
|
|
193
|
-
const $ = cheerio.load('<foo></foo>', {
|
|
194
|
-
xmlMode: true
|
|
195
|
-
});
|
|
196
|
-
expect($.xml()).toBe('<foo/>');
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
/**
|
|
200
|
-
* The `.text` static method defined on the "loaded" Cheerio factory
|
|
201
|
-
* function is deprecated.
|
|
202
|
-
*
|
|
203
|
-
* In order to promote consistency with the jQuery library, users are
|
|
204
|
-
* encouraged to instead use the instance method of the same name.
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
*
|
|
208
|
-
* ```js
|
|
209
|
-
* const $ = cheerio.load('<h1>Hello, <span>world</span>.</h1>');
|
|
210
|
-
* $('h1').text();
|
|
211
|
-
* //=> 'Hello, world.'
|
|
212
|
-
* ```
|
|
213
|
-
*
|
|
214
|
-
* @example <caption>To render the text content of an entire document,
|
|
215
|
-
* invoke the `text` function exported by the Cheerio module with a "root"
|
|
216
|
-
* selection. </caption>
|
|
217
|
-
*
|
|
218
|
-
* ```js
|
|
219
|
-
* cheerio.text($.root());
|
|
220
|
-
* //=> 'Hello, world.'
|
|
221
|
-
* ```
|
|
222
|
-
*/ describe('.text - deprecated API', ()=>{
|
|
223
|
-
it('(cheerio object) : should return the text contents of the specified elements', ()=>{
|
|
224
|
-
const $ = cheerio.load('<a>This is <em>content</em>.</a>');
|
|
225
|
-
expect($.text($('a'))).toBe('This is content.');
|
|
226
|
-
});
|
|
227
|
-
it('(cheerio object) : should omit comment nodes', ()=>{
|
|
228
|
-
const $ = cheerio.load('<a>This is <!-- a comment --> not a comment.</a>');
|
|
229
|
-
expect($.text($('a'))).toBe('This is not a comment.');
|
|
230
|
-
});
|
|
231
|
-
it('(cheerio object) : should include text contents of children recursively', ()=>{
|
|
232
|
-
const $ = cheerio.load('<a>This is <div>a child with <span>another child and <!-- a comment --> not a comment</span> followed by <em>one last child</em> and some final</div> text.</a>');
|
|
233
|
-
expect($.text($('a'))).toBe('This is a child with another child and not a comment followed by one last child and some final text.');
|
|
234
|
-
});
|
|
235
|
-
it('() : should return the rendered text content of the root', ()=>{
|
|
236
|
-
const $ = cheerio.load('<a>This is <div>a child with <span>another child and <!-- a comment --> not a comment</span> followed by <em>one last child</em> and some final</div> text.</a>');
|
|
237
|
-
expect($.text()).toBe('This is a child with another child and not a comment followed by one last child and some final text.');
|
|
238
|
-
});
|
|
239
|
-
it('(cheerio object) : should not omit script tags', ()=>{
|
|
240
|
-
const $ = cheerio.load('<script>console.log("test")</script>');
|
|
241
|
-
expect($.text()).toBe('console.log("test")');
|
|
242
|
-
});
|
|
243
|
-
it('(cheerio object) : should omit style tags', ()=>{
|
|
244
|
-
const $ = cheerio.load('<style type="text/css">.cf-hidden { display: none; }</style>');
|
|
245
|
-
expect($.text()).toBe('.cf-hidden { display: none; }');
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { load } from '../index.js';
|
|
3
|
-
function xml(str, options) {
|
|
4
|
-
options = {
|
|
5
|
-
xml: true,
|
|
6
|
-
...options
|
|
7
|
-
};
|
|
8
|
-
const $ = load(str, options);
|
|
9
|
-
return $.xml();
|
|
10
|
-
}
|
|
11
|
-
function dom(str, options) {
|
|
12
|
-
const $ = load('', options);
|
|
13
|
-
return $(str).html();
|
|
14
|
-
}
|
|
15
|
-
describe('render', ()=>{
|
|
16
|
-
describe('(xml)', ()=>{
|
|
17
|
-
it('should render <media:thumbnail /> tags correctly', ()=>{
|
|
18
|
-
const str = '<media:thumbnail url="http://www.foo.com/keyframe.jpg" width="75" height="50" time="12:05:01.123" />';
|
|
19
|
-
expect(xml(str)).toBe('<media:thumbnail url="http://www.foo.com/keyframe.jpg" width="75" height="50" time="12:05:01.123"/>');
|
|
20
|
-
});
|
|
21
|
-
it('should render <link /> tags (RSS) correctly', ()=>{
|
|
22
|
-
const str = '<link>http://www.github.com/</link>';
|
|
23
|
-
expect(xml(str)).toBe('<link>http://www.github.com/</link>');
|
|
24
|
-
});
|
|
25
|
-
it('should escape entities', ()=>{
|
|
26
|
-
const str = '<tag attr="foo & bar"/>';
|
|
27
|
-
expect(xml(str)).toBe(str);
|
|
28
|
-
});
|
|
29
|
-
it('should render HTML as XML', ()=>{
|
|
30
|
-
const $ = load('<foo></foo>', null, false);
|
|
31
|
-
expect($.xml()).toBe('<foo/>');
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
describe('(dom)', ()=>{
|
|
35
|
-
it('should not keep camelCase for new nodes', ()=>{
|
|
36
|
-
const str = '<g><someElem someAttribute="something">hello</someElem></g>';
|
|
37
|
-
expect(dom(str, {
|
|
38
|
-
xml: false
|
|
39
|
-
})).toBe('<someelem someattribute="something">hello</someelem>');
|
|
40
|
-
});
|
|
41
|
-
it('should keep camelCase for new nodes', ()=>{
|
|
42
|
-
const str = '<g><someElem someAttribute="something">hello</someElem></g>';
|
|
43
|
-
expect(dom(str, {
|
|
44
|
-
xml: true
|
|
45
|
-
})).toBe('<someElem someAttribute="something">hello</someElem>');
|
|
46
|
-
});
|
|
47
|
-
it('should maintain the parsing options of distinct contexts independently', ()=>{
|
|
48
|
-
const str = '<g><someElem someAttribute="something">hello</someElem></g>';
|
|
49
|
-
const $ = load('', {
|
|
50
|
-
xml: false
|
|
51
|
-
});
|
|
52
|
-
expect($(str).html()).toBe('<someelem someattribute="something">hello</someelem>');
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
});
|