Skip to content

Commit

Permalink
fix: initialise helper to empty object when testing
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Nov 15, 2023
1 parent 624f88c commit 34c4e0e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/runtime/plugin.client.ts
Expand Up @@ -4,7 +4,8 @@ import type { ColorModeInstance } from './types'
import { defineNuxtPlugin, isVue2, isVue3, useRouter, useHead, useState } from '#imports'
import { globalName, storageKey, dataValue } from '#color-mode-options'

const helper = window[globalName] as unknown as {
// Initialise to empty object to avoid hard error when hydrating app in test mode
const helper = (window[globalName] || {}) as unknown as {
preference: string
value: string
getColorScheme: () => string
Expand Down

0 comments on commit 34c4e0e

Please sign in to comment.