Revert "test(desktop): ThemeProvider setTheme(default) paints Classic Hermes"

This reverts commit c356d1df82.
This commit is contained in:
teknium1
2026-10-01 12:18:04 -07:00
committed by Teknium
parent 88d1672f1b
commit eec3864a67

View File

@@ -3,7 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { $backendThemes, __resetBackendSkinSync, ingestBackendSkin } from './backend-sync'
import { skinPref, ThemeProvider, useTheme } from './context'
import { DEFAULT_SKIN_NAME, everforestTheme } from './presets'
import { everforestTheme } from './presets'
// The live-authoring loop: Hermes writes/edits one skin file and every surface
// repaints. An in-place edit keeps the NAME — only the palette moves.
@@ -12,23 +12,10 @@ const bloomberg = (foreground: string) => ({
colors: { background: '#000000', ui_text: foreground, ui_accent: '#ff8000' }
})
const classicDefault = {
name: 'default',
description: 'Classic Hermes — gold and kawaii',
colors: { background: '#1a1a2e', ui_accent: '#FFBF00', ui_text: '#FFF8DC', banner_text: '#FFF8DC' }
}
const cssVar = (name: string) => window.document.documentElement.style.getPropertyValue(name)
const customStyleEl = () => window.document.getElementById('hermes-desktop-custom-css') as HTMLStyleElement | null
/** Probe so tests can call setTheme through the real provider path (not only skinPref). */
function ThemeProbe({ onReady }: { onReady: (api: ReturnType<typeof useTheme>) => void }) {
const api = useTheme()
onReady(api)
return null
}
describe('ThemeProvider ← backend skin sync', () => {
beforeEach(() => {
window.localStorage.clear()
@@ -50,44 +37,6 @@ describe('ThemeProvider ← backend skin sync', () => {
expect(cssVar('--theme-background-seed')).toBe('#000000')
})
it('keeps setTheme(default) active and paints Classic Hermes (#76579 / #76743)', () => {
// Review salvage: selecting registered `default` must go through setTheme /
// normalizeSkin (not only resolveTheme/skinPref) and must NOT collapse to nous.
let latest: ReturnType<typeof useTheme> | null = null
render(
<ThemeProvider>
<ThemeProbe
onReady={api => {
latest = api
}}
/>
</ThemeProvider>
)
act(() => ingestBackendSkin(classicDefault, { apply: false }))
expect(latest).not.toBeNull()
// Boot default remains nous until the user (or Appearance) selects classic.
expect(DEFAULT_SKIN_NAME).toBe('nous')
act(() => {
latest!.setTheme('default')
})
// Active selection stays `default` (not retired → nous). deriveTheme may
// mode-suffix the seed (default-light / Classic Hermes Light); the
// selection key and painted palette are what Appearance must preserve.
expect(latest!.themeName).toBe('default')
expect(latest!.themeName).not.toBe(DEFAULT_SKIN_NAME)
expect(latest!.theme.label.toLowerCase()).toContain('classic hermes')
expect(latest!.availableThemes.some(t => t.name === 'default' && t.label === 'Classic Hermes')).toBe(true)
// Classic gold palette reaches CSS (ui_accent / ui_text → primary / foreground).
// Light-mode derivation may mix the navy background; accent/text stay gold.
expect(cssVar('--theme-foreground').toLowerCase()).toBe('#fff8dc')
expect(cssVar('--theme-primary').toLowerCase()).toBe('#ffbf00')
})
it('repaints an in-place edit of the ACTIVE skin (same name, new palette)', () => {
render(
<ThemeProvider>