feat: publish HoloLake model-native living system source
This commit is contained in:
parent
6ad10edde1
commit
c395dd3a99
2467 changed files with 615073 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
import { act, renderHook } from '@testing-library/react'
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import { GUANGHU_THEME_STORAGE_KEY } from '../lib/guanghuTheme'
|
||||
import { THEME_MODE_STORAGE_KEY } from '../lib/themeMode'
|
||||
import { useGuanghuTheme } from './useGuanghuTheme'
|
||||
|
||||
describe('useGuanghuTheme', () => {
|
||||
beforeEach(() => {
|
||||
window.localStorage.clear()
|
||||
document.documentElement.removeAttribute('data-guanghu-theme')
|
||||
document.documentElement.removeAttribute('data-theme')
|
||||
document.documentElement.classList.remove('dark')
|
||||
})
|
||||
|
||||
it('makes the lake presets visibly switch the document between light and dark', () => {
|
||||
window.localStorage.setItem(GUANGHU_THEME_STORAGE_KEY, 'lake-light')
|
||||
const { result } = renderHook(() => useGuanghuTheme())
|
||||
|
||||
expect(document.documentElement).toHaveAttribute('data-guanghu-theme', 'lake-light')
|
||||
expect(document.documentElement).toHaveAttribute('data-theme', 'light')
|
||||
expect(window.localStorage.getItem(THEME_MODE_STORAGE_KEY)).toBe('light')
|
||||
|
||||
act(() => result.current.cycleTheme())
|
||||
|
||||
expect(document.documentElement).toHaveAttribute('data-guanghu-theme', 'lake-dark')
|
||||
expect(document.documentElement).toHaveAttribute('data-theme', 'dark')
|
||||
expect(document.documentElement).toHaveClass('dark')
|
||||
expect(window.localStorage.getItem(THEME_MODE_STORAGE_KEY)).toBe('dark')
|
||||
})
|
||||
})
|
||||
Loading…
Reference in a new issue