diff --git a/src/paste-markdown-table.ts b/src/paste-markdown-table.ts index ce8c320..e2784b7 100644 --- a/src/paste-markdown-table.ts +++ b/src/paste-markdown-table.ts @@ -87,9 +87,10 @@ function generateText(transfer: DataTransfer): string | undefined { const html = transfer.getData('text/html') if (!/
` + } + paste(textarea, data) + + await wait(100) + + assert.isFalse(alertCalled, 'A XSS was possible as alert was called') + }) + it('retains text around tables', async function () { const data = { 'text/html': ` @@ -97,3 +112,7 @@ function paste(textarea, data) { }) textarea.dispatchEvent(event) } + +function wait(ms) { + return new Promise(resolve => setTimeout(resolve, ms)) +}