mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
This repo could never sync. There was NO merge-base with tamagui — 372 commits
here against 15,791 there, unrelated histories — because it began as a
copy-paste rebrand with a flattened layout. Every "sync" since was a hand
re-application that drifted, which is why the tree sat on 7.3.1 while upstream
shipped fixes we then rediscovered by hand.
This commit's PARENT IS TAMAGUI. A future sync is `git merge tama/main` then
`node scripts/rebrand.mjs` — a real merge, because the history is now shared.
174 packages: 166 upstream, our 8 restored (chrome, shell, telemetry, recipes,
get, font-geist-{sans,mono}, @hanzo/booker), bento-get gained. 170/170 build.
Our patches to files UPSTREAM ALSO OWNS are carried, which the package-level
delta missed and which was where the value actually was:
- useMedia's server snapshot (`initState ?? getMedia()`). Upstream still
returns undefined there, so every Tamagui Dialog kills a prerender — the
exact crash hanzo.app spent a day on.
- data-slot on web host nodes, absent upstream entirely.
Both applied ONTO upstream's newer files (it rewrote useMedia +150/-63 and
createComponent +160/-55), marked `PATCH (ours, carried across the transplant)`.
Seven traps are encoded in scripts/rebrand.mjs, each found by a gate:
skip itself and lockfiles; special-case the double-branded names in BOTH scoped
and bare form; map path strings, not just paths; drop a level for the flattened
group; check disk rather than a stale index.
Rust build artifacts are NOT committed. An earlier draft of this commit swept
apps/desktop/src-tauri/target/debug in via `git add -A` — 3,859 files including
a 272MB .a, over GitHub's 100MB cap, so the push could never have landed. They
are gitignored now.
Co-Authored-By: Hanzo Dev <[email protected]>
64 lines
2.5 KiB
TypeScript
64 lines
2.5 KiB
TypeScript
import { expect, test } from '@playwright/test'
|
|
import { setupPage } from './test-utils'
|
|
import { getStyles } from './utils'
|
|
import { TEST_IDS } from '../src/constants/test-ids'
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await setupPage(page, { name: 'ThemeReset', type: 'useCase' })
|
|
})
|
|
|
|
test('Reset from nested themes goes back to grandparent', async ({ page }) => {
|
|
// Case 1: Reset from dark → pink → blue should go back to dark
|
|
const resetButton1 = page.locator(`#${TEST_IDS.resetButton1}`)
|
|
await expect(resetButton1).toBeVisible()
|
|
|
|
// Get the background color of the button
|
|
const button1Styles = await getStyles(resetButton1)
|
|
|
|
// The button should have dark theme background (not pink or blue)
|
|
// Dark theme typically has a dark background
|
|
expect(button1Styles.backgroundColor).not.toBe('rgb(255, 192, 203)') // pink
|
|
expect(button1Styles.backgroundColor).not.toBe('rgb(0, 0, 255)') // blue
|
|
})
|
|
|
|
test('Reset from dark → pink goes back to dark (documentation example)', async ({
|
|
page,
|
|
}) => {
|
|
// Case 2: Reset from dark → pink should go back to dark
|
|
const resetSquare1 = page.locator(`#${TEST_IDS.resetSquare1}`)
|
|
await expect(resetSquare1).toBeVisible()
|
|
|
|
const square1Styles = await getStyles(resetSquare1)
|
|
|
|
// The square should have dark theme background
|
|
// This matches the documentation example
|
|
expect(square1Styles.backgroundColor).not.toBe('rgb(255, 192, 203)') // pink
|
|
})
|
|
|
|
test('Reset from dark only goes to light', async ({ page }) => {
|
|
// Case 3: Reset from dark only should go to light (opposite scheme)
|
|
const resetSquare2 = page.locator(`#${TEST_IDS.resetSquare2}`)
|
|
await expect(resetSquare2).toBeVisible()
|
|
|
|
const square2Styles = await getStyles(resetSquare2)
|
|
|
|
// The square should have light theme background (opposite of dark)
|
|
expect(square2Styles.backgroundColor).not.toBe('rgb(0, 0, 0)') // black/dark
|
|
})
|
|
|
|
test('Reset from dark with button shows different themes', async ({ page }) => {
|
|
// Case 4: Dark button vs reset button should have different themes
|
|
const darkButton = page.locator(`#${TEST_IDS.darkButton}`)
|
|
const resetButton2 = page.locator(`#${TEST_IDS.resetButton2}`)
|
|
|
|
await expect(darkButton).toBeVisible()
|
|
await expect(resetButton2).toBeVisible()
|
|
|
|
const darkButtonStyles = await getStyles(darkButton)
|
|
const resetButton2Styles = await getStyles(resetButton2)
|
|
|
|
// The buttons should have different background colors
|
|
// Dark button should have dark theme, reset button should have light theme
|
|
expect(darkButtonStyles.backgroundColor).not.toBe(resetButton2Styles.backgroundColor)
|
|
})
|