feat: publish HoloLake model-native living system source

This commit is contained in:
冰朔 2026-08-03 10:04:41 +08:00
commit c395dd3a99
2467 changed files with 615073 additions and 0 deletions

View file

@ -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')
})
})