Files
bitmappery/tests/unit/store/modules/copy-module.spec.ts
Igor Zinken 6baaaff871 Allow copy/cut/paste operations on multiple selected Layers (#87)
Simple copy/cut/paste operations were not supported for selected Layers. Further more, only a single selected Layer at a time was supported.

We now support multi select using shift + click. Copy pasting content now also works across timeline tiles for easier editing.
2026-04-08 21:39:20 +02:00

35 lines
1.3 KiB
TypeScript

import { describe, expect, it, vi } from "vitest";
import { createMockCanvasElement } from "../../mocks";
import { LayerTypes } from "@/definitions/layer-types";
import storeModule, { createCopyState } from "@/store/modules/copy-module";
const { getters, mutations } = storeModule;
describe( "Vuex copy module", () => {
describe( "getters", () => {
it( "should know when it has copied content", () => {
const state = createCopyState();
expect( getters.hasCopiedContent( state, getters, {}, {} )).toBe( false );
state.copyContent = {
type: "image",
content: {
bitmap: createMockCanvasElement(),
type: LayerTypes.LAYER_GRAPHIC,
},
};
expect( getters.hasCopiedContent( state, getters, {}, {} )).toBe( true );
});
});
describe( "mutations", () => {
it( "should be able to set the current copied content", () => {
const state = createCopyState({ copyContent: null });
const copiedContent = { bitmap: createMockCanvasElement(), type: LayerTypes.LAYER_GRAPHIC };
mutations.setCopiedContent( state, copiedContent );
expect( state.copyContent ).toEqual( copiedContent );
});
});
});