openpencil/tests/engine/vue/input/drop-files.test.ts
Danila Poyarkov 7e8feb998a fix(canvas): import dropped SVG files
- Parse dropped SVGs through the shared XML-backed import pipeline
- Preserve transforms, gradients, viewport alignment, and reusable shapes
- Place mixed image drops in one ordered undoable transaction
- Cover file filtering, atomic placement, undo, and browser drops

Co-authored-by: Rob Coenen <753704+rcoenen@users.noreply.github.com>
2026-07-29 15:20:06 +03:00

19 lines
692 B
TypeScript

import { describe, expect, test } from 'bun:test'
import { filterCanvasFiles } from '#vue/canvas/drop/use'
describe('canvas file drops', () => {
test('keeps supported raster and SVG files in source order', () => {
const svg = new File(['<svg/>'], 'mark.svg', { type: 'image/svg+xml' })
const image = new File(['png'], 'photo.png', { type: 'image/png' })
const text = new File(['text'], 'notes.txt', { type: 'text/plain' })
expect(filterCanvasFiles([svg, text, image])).toEqual([svg, image])
})
test('recognizes SVG filenames without MIME metadata', () => {
const svg = new File(['<svg/>'], 'mark.SVG')
expect(filterCanvasFiles([svg])).toEqual([svg])
})
})