We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b907421 + e0a3398 commit 4d46545Copy full SHA for 4d46545
packages/theme-ui/test/color-modes.js
@@ -478,3 +478,25 @@ test('raw color values are passed to theme-ui context when custom properties are
478
)
479
expect(color).toBe('tomato')
480
})
481
+
482
+test('warns when localStorage is disabled', () => {
483
+ Object.defineProperty(window, 'localStorage', {
484
+ get: jest.fn(() => {
485
+ throw 'SecurityError: The operation is insecure.'
486
+ }),
487
+ })
488
489
+ let mode
490
+ const Consumer = props => {
491
+ const [colorMode] = useColorMode()
492
+ mode = colorMode
493
+ return false
494
+ }
495
496
+ render(
497
+ <ThemeProvider>
498
+ <Consumer />
499
+ </ThemeProvider>
500
+ )
501
+ expect(mode).toBe('default')
502
+})
0 commit comments