2022-11-14 02:32:54 -06:00
|
|
|
import { parseClipboard } from "./clipboard";
|
2023-10-19 15:44:23 +05:30
|
|
|
import { createPasteEvent } from "./tests/test-utils";
|
2022-11-14 02:32:54 -06:00
|
|
|
|
|
|
|
describe("Test parseClipboard", () => {
|
|
|
|
it("should parse valid json correctly", async () => {
|
|
|
|
let text = "123";
|
|
|
|
|
2023-10-19 15:44:23 +05:30
|
|
|
let clipboardData = await parseClipboard(
|
|
|
|
createPasteEvent({ "text/plain": text }),
|
|
|
|
);
|
2022-11-14 02:32:54 -06:00
|
|
|
|
|
|
|
expect(clipboardData.text).toBe(text);
|
|
|
|
|
|
|
|
text = "[123]";
|
|
|
|
|
2023-10-19 15:44:23 +05:30
|
|
|
clipboardData = await parseClipboard(
|
|
|
|
createPasteEvent({ "text/plain": text }),
|
|
|
|
);
|
2022-11-14 02:32:54 -06:00
|
|
|
|
|
|
|
expect(clipboardData.text).toBe(text);
|
|
|
|
});
|
|
|
|
});
|