Skip to content

Commit b407d6d

Browse files
committed
test: add failing test for span with space
1 parent 8e69c52 commit b407d6d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {JSDOM} from 'jsdom'
2+
import {describe, expect, test} from 'vitest'
3+
import {htmlToBlocks} from '../../src'
4+
import defaultSchema from '../fixtures/defaultSchema'
5+
import {createTestKeyGenerator} from '../test-key-generator'
6+
7+
const blockContentType = defaultSchema
8+
.get('blogPost')
9+
.fields.find((field: any) => field.name === 'body').type
10+
11+
describe(htmlToBlocks.name, () => {
12+
test('span with space', () => {
13+
expect(
14+
htmlToBlocks(`a<span> </span>b`, blockContentType, {
15+
parseHtml: (html) => new JSDOM(html).window.document,
16+
keyGenerator: createTestKeyGenerator(),
17+
}),
18+
).toEqual([
19+
{
20+
_key: 'randomKey0',
21+
_type: 'block',
22+
children: [
23+
{
24+
_key: 'randomKey1',
25+
_type: 'span',
26+
marks: [],
27+
text: 'a b',
28+
},
29+
],
30+
markDefs: [],
31+
style: 'normal',
32+
},
33+
])
34+
})
35+
})

0 commit comments

Comments
 (0)