Skip to content

Commit

Permalink
test: Firefox does not support mocking ClipboardEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
luolonghao committed Jul 6, 2024
1 parent 07daae0 commit 56f7983
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tests/plugins/copy.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testPlugin } from '../utils';
import { isFirefox, testPlugin } from '../utils';

describe('plugins / copy', () => {

Expand Down Expand Up @@ -28,6 +28,9 @@ describe('plugins / copy', () => {
output,
editor => {
editor.event.emit('copy', event);
if (isFirefox) {
return;
}
expect(dataTransfer.getData('text/html')).to.equal('<hr />');
},
);
Expand Down
14 changes: 13 additions & 1 deletion tests/plugins/cut.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testPlugin } from '../utils';
import { isFirefox, testPlugin } from '../utils';

const imageUrl = '../assets/images/heaven-lake-256.png';
const imageBoxValue = 'eyJ1cmwiOiIuLi9hc3NldHMvaW1hZ2VzL2hlYXZlbi1sYWtlLTI1Ni5wbmciLCJzdGF0dXMiOiJkb25lIn0=';
Expand Down Expand Up @@ -27,6 +27,9 @@ describe('plugins / cut', () => {
output,
editor => {
editor.event.emit('cut', event);
if (isFirefox) {
return;
}
expect(dataTransfer.getData('text/html')).to.equal('f');
},
);
Expand All @@ -44,6 +47,9 @@ describe('plugins / cut', () => {
output,
editor => {
editor.event.emit('cut', event);
if (isFirefox) {
return;
}
expect(dataTransfer.getData('text/html')).to.equal('<p>f</p>');
},
);
Expand All @@ -61,6 +67,9 @@ describe('plugins / cut', () => {
output,
editor => {
editor.event.emit('cut', event);
if (isFirefox) {
return;
}
expect(dataTransfer.getData('text/html')).to.equal(`<img src="${imageUrl}" data-lake-value="${imageBoxValue}" />`);
},
);
Expand All @@ -82,6 +91,9 @@ describe('plugins / cut', () => {
output,
editor => {
editor.event.emit('cut', event);
if (isFirefox) {
return;
}
expect(dataTransfer.getData('text/html')).to.equal('<hr />');
},
);
Expand Down

0 comments on commit 56f7983

Please sign in to comment.