mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-08-31 06:07:06 +02:00
add cleanup workspaces script and test-utils
This commit is contained in:
17
excalidraw-app/tests/test-utils.ts
Normal file
17
excalidraw-app/tests/test-utils.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ImportedDataState } from "../../packages/excalidraw/data/types";
|
||||
import { STORAGE_KEYS } from "../app_constants";
|
||||
|
||||
export const initLocalStorage = (data: ImportedDataState) => {
|
||||
if (data.elements) {
|
||||
localStorage.setItem(
|
||||
STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS,
|
||||
JSON.stringify(data.elements),
|
||||
);
|
||||
}
|
||||
if (data.appState) {
|
||||
localStorage.setItem(
|
||||
STORAGE_KEYS.LOCAL_STORAGE_APP_STATE,
|
||||
JSON.stringify(data.appState),
|
||||
);
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user