Skip to content

Commit b2fde14

Browse files
committed
Add test for a table with extra text around it
1 parent fcd992e commit b2fde14

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,27 @@ describe('paste-markdown', function () {
3838
assert.include(textarea.value, 'name | origin\n-- | --\nhubot | github\nbender | futurama')
3939
})
4040

41+
it('rejects tables with extra text', async function () {
42+
const data = {
43+
'text/html': `
44+
<p>Here is a cool table</p>
45+
<table>
46+
<thead><tr><th>name</th><th>origin</th></tr></thead>
47+
<tbody>
48+
<tr><td>hubot</td><td>github</td></tr>
49+
<tr><td>bender</td><td>futurama</td></tr>
50+
</tbody>
51+
</table>
52+
<p>Very cool</p>
53+
`
54+
}
55+
56+
// Synthetic paste events don't manipulate the DOM. A empty textarea
57+
// means that the event handler didn't fire and normal paste happened.
58+
paste(textarea, data)
59+
assert.equal(textarea.value, '')
60+
})
61+
4162
it('rejects layout tables', function () {
4263
const data = {
4364
'text/html': `
@@ -51,6 +72,9 @@ describe('paste-markdown', function () {
5172
`
5273
}
5374
paste(textarea, data)
75+
76+
// Synthetic paste events don't manipulate the DOM. A empty textarea
77+
// means that the event handler didn't fire and normal paste happened.
5478
assert.equal(textarea.value, '')
5579
})
5680

0 commit comments

Comments
 (0)