Skip to content

Commit

Permalink
passing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte committed Jul 14, 2024
1 parent 96cc11e commit 28d4f75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/mode-watcher/src/lib/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function createDerivedMode() {
}
} else {
if ($lightClassNames.length) htmlEl.classList.remove(...$lightClassNames);
if ($darkClassNames.length) htmlEl.classList.add('dark');
if ($darkClassNames.length) htmlEl.classList.add(...$darkClassNames);
htmlEl.style.colorScheme = 'dark';
if (themeColorEl && $themeColors) {
themeColorEl.setAttribute('content', $themeColors.dark);
Expand Down
8 changes: 7 additions & 1 deletion packages/mode-watcher/src/tests/Mode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
export let track = true;
export let darkClassNames: string[] = ['dark'];
export let lightClassNames: string[] = [];
</script>

<ModeWatcher {track} {darkClassNames} themeColors={{ dark: 'black', light: 'white' }} />
<ModeWatcher
{track}
{darkClassNames}
{lightClassNames}
themeColors={{ dark: 'black', light: 'white' }}
/>
<span data-testid="mode">{$mode}</span>
<button on:click={toggleMode} data-testid="toggle"> toggle </button>
<button on:click={() => setMode('light')} data-testid="light">light</button>
Expand Down

0 comments on commit 28d4f75

Please sign in to comment.