address review comments
This commit is contained in:
+1
-1
@@ -110,7 +110,7 @@
|
|||||||
"livekit-client": "^2.18.1",
|
"livekit-client": "^2.18.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"loglevel": "^1.9.1",
|
"loglevel": "^1.9.1",
|
||||||
"matrix-js-sdk": "matrix-org/matrix-js-sdk#ca5655bced1cbb215ac1c18e179384a069d98b0a",
|
"matrix-js-sdk": "matrix-org/matrix-js-sdk#develop",
|
||||||
"matrix-widget-api": "^1.16.1",
|
"matrix-widget-api": "^1.16.1",
|
||||||
"node-stdlib-browser": "^1.3.1",
|
"node-stdlib-browser": "^1.3.1",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
|
|||||||
@@ -51,3 +51,53 @@ window.matchMedia = global.matchMedia = (): MediaQueryList =>
|
|||||||
addEventListener: () => {},
|
addEventListener: () => {},
|
||||||
removeEventListener: () => {},
|
removeEventListener: () => {},
|
||||||
}) as Partial<MediaQueryList> as MediaQueryList;
|
}) as Partial<MediaQueryList> as MediaQueryList;
|
||||||
|
|
||||||
|
const storage: Record<string, string> = {};
|
||||||
|
const localStoragePolyfill = {
|
||||||
|
getItem(key: string) {
|
||||||
|
return Object.prototype.hasOwnProperty.call(storage, key)
|
||||||
|
? storage[key]
|
||||||
|
: null;
|
||||||
|
},
|
||||||
|
setItem(key: string, value: string) {
|
||||||
|
storage[key] = String(value);
|
||||||
|
},
|
||||||
|
removeItem(key: string) {
|
||||||
|
delete storage[key];
|
||||||
|
},
|
||||||
|
clear() {
|
||||||
|
for (const key in storage) {
|
||||||
|
delete storage[key];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
key(index: number) {
|
||||||
|
const keys = Object.keys(storage);
|
||||||
|
return keys[index] ?? null;
|
||||||
|
},
|
||||||
|
get length() {
|
||||||
|
return Object.keys(storage).length;
|
||||||
|
},
|
||||||
|
} as unknown as Storage;
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof globalThis.localStorage === "undefined" ||
|
||||||
|
typeof globalThis.localStorage.clear !== "function"
|
||||||
|
) {
|
||||||
|
Object.defineProperty(globalThis, "localStorage", {
|
||||||
|
value: localStoragePolyfill,
|
||||||
|
writable: true,
|
||||||
|
configurable: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof window !== "undefined" &&
|
||||||
|
(typeof window.localStorage === "undefined" ||
|
||||||
|
typeof window.localStorage.clear !== "function")
|
||||||
|
) {
|
||||||
|
Object.defineProperty(window, "localStorage", {
|
||||||
|
value: localStoragePolyfill,
|
||||||
|
writable: true,
|
||||||
|
configurable: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
+1
-1
@@ -13,7 +13,7 @@ export default defineConfig((configEnv) =>
|
|||||||
classNameStrategy: "non-scoped",
|
classNameStrategy: "non-scoped",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setupFiles: ["vitest.setup.ts"],
|
setupFiles: ["src/vitest.setup.ts"],
|
||||||
include: ["src/**/*.test.ts", "src/**/*.test.tsx"],
|
include: ["src/**/*.test.ts", "src/**/*.test.tsx"],
|
||||||
coverage: {
|
coverage: {
|
||||||
reporter: ["html", "json"],
|
reporter: ["html", "json"],
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
const storage: Record<string, string> = {};
|
|
||||||
const localStoragePolyfill = {
|
|
||||||
getItem(key: string) {
|
|
||||||
return Object.prototype.hasOwnProperty.call(storage, key)
|
|
||||||
? storage[key]
|
|
||||||
: null;
|
|
||||||
},
|
|
||||||
setItem(key: string, value: string) {
|
|
||||||
storage[key] = String(value);
|
|
||||||
},
|
|
||||||
removeItem(key: string) {
|
|
||||||
delete storage[key];
|
|
||||||
},
|
|
||||||
clear() {
|
|
||||||
for (const key in storage) {
|
|
||||||
delete storage[key];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
key(index: number) {
|
|
||||||
const keys = Object.keys(storage);
|
|
||||||
return keys[index] ?? null;
|
|
||||||
},
|
|
||||||
get length() {
|
|
||||||
return Object.keys(storage).length;
|
|
||||||
},
|
|
||||||
} as unknown as Storage;
|
|
||||||
|
|
||||||
if (
|
|
||||||
typeof globalThis.localStorage === "undefined" ||
|
|
||||||
typeof globalThis.localStorage.clear !== "function"
|
|
||||||
) {
|
|
||||||
Object.defineProperty(globalThis, "localStorage", {
|
|
||||||
value: localStoragePolyfill,
|
|
||||||
writable: true,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
typeof window !== "undefined" &&
|
|
||||||
(typeof window.localStorage === "undefined" ||
|
|
||||||
typeof window.localStorage.clear !== "function")
|
|
||||||
) {
|
|
||||||
Object.defineProperty(window, "localStorage", {
|
|
||||||
value: localStoragePolyfill,
|
|
||||||
writable: true,
|
|
||||||
configurable: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
import "./src/vitest.setup.ts";
|
|
||||||
Reference in New Issue
Block a user