test(local-storage): add unit tests

This commit is contained in:
Eric Liu 2025-03-16 12:32:53 -07:00
commit f28bfe307e
7 changed files with 274 additions and 22 deletions

View file

@ -0,0 +1,19 @@
<svelte:options accessors />
<script lang="ts">
import { LocalStorage } from "carbon-components-svelte";
// Example values for testing
const primitiveValue = "test-value";
const objectValue = { theme: "dark", fontSize: 16 };
</script>
<!-- Default local storage -->
<div data-testid="default-storage">
<LocalStorage value={primitiveValue} />
</div>
<!-- Local storage with object value -->
<div data-testid="storage-object">
<LocalStorage key="theme-settings" value={objectValue} />
</div>