mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 02:41:05 +00:00
test(local-storage): add unit tests
This commit is contained in:
parent
f23e7282b5
commit
f28bfe307e
7 changed files with 274 additions and 22 deletions
19
tests/LocalStorage/LocalStorage.test.svelte
Normal file
19
tests/LocalStorage/LocalStorage.test.svelte
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue