Skip to content

Commit f8e2369

Browse files
committed
fix(tests): use Event shim for paste in paste-html-resize test
Firefox doesn't support synthetic ClipboardEvent with DataTransfer — clipboardData ends up null. Use a plain Event with a mock clipboardData object that implements getData(), matching the cross-browser pattern.
1 parent 762231b commit f8e2369

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

tests/behavior/tests/tables/paste-html-resize.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ async function getTableGrid(page: Page) {
6161
test('pasted HTML table can be column-resized', async ({ superdoc }) => {
6262
await superdoc.page.evaluate((html) => {
6363
const editor = (window as any).editor;
64-
const dataTransfer = new DataTransfer();
65-
dataTransfer.setData('text/html', html);
66-
dataTransfer.setData('text/plain', '');
67-
const pasteEvent = new ClipboardEvent('paste', {
68-
bubbles: true,
69-
cancelable: true,
70-
clipboardData: dataTransfer,
71-
});
72-
editor.view.dom.dispatchEvent(pasteEvent);
64+
const event = new Event('paste', { bubbles: true, cancelable: true });
65+
(event as any).clipboardData = {
66+
getData: (type: string) => {
67+
if (type === 'text/html') return html;
68+
if (type === 'text/plain') return '';
69+
return '';
70+
},
71+
};
72+
editor.view.dom.dispatchEvent(event);
7373
}, SINGLE_HTML_TABLE);
7474
await superdoc.waitForStable();
7575

0 commit comments

Comments
 (0)