mirror of
https://github.com/igorski/bitmappery.git
synced 2026-06-17 11:45:04 +02:00
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.
35 lines
1.3 KiB
TypeScript
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 );
|
|
});
|
|
});
|
|
}); |