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]>
142 lines
5.4 KiB
TypeScript
142 lines
5.4 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'
|
|
|
|
/**
|
|
* Tests for GitHub issue #3673: Nested theme regression
|
|
*
|
|
* When using nested themes like <Theme name="blue"><Theme name="surface3">,
|
|
* the parent color context (blue) should be preserved, resulting in
|
|
* light_blue_surface3 theme being applied.
|
|
*
|
|
* The bug causes the nested theme to lose the color context, resulting in
|
|
* just light_surface3 being applied instead.
|
|
*/
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
// Test the nested theme regression (issue #3673)
|
|
// Use v4 themes as the bug specifically occurs with @hanzogui/themes/v4
|
|
await setupPage(page, {
|
|
name: 'ThemeNested',
|
|
type: 'useCase',
|
|
searchParams: { v4theme: 'true' },
|
|
})
|
|
})
|
|
|
|
test('Nested blue theme with surface3 matches direct light_blue_surface3', async ({
|
|
page,
|
|
}) => {
|
|
// Get the direct theme element
|
|
const directSquare = page.locator(`#${TEST_IDS.nestedThemeDirect}`)
|
|
await expect(directSquare).toBeVisible()
|
|
|
|
// Get the nested theme element
|
|
const nestedSquare = page.locator(`#${TEST_IDS.nestedThemeNested}`)
|
|
await expect(nestedSquare).toBeVisible()
|
|
|
|
// Get computed styles for both
|
|
const directStyles = await getStyles(directSquare)
|
|
const nestedStyles = await getStyles(nestedSquare)
|
|
|
|
// The nested theme should produce the same background color as the direct theme
|
|
// If the bug is present, nestedStyles will have light_surface3 colors instead of light_blue_surface3
|
|
expect(nestedStyles.backgroundColor).toBe(directStyles.backgroundColor)
|
|
})
|
|
|
|
test('Nested light → blue → surface3 matches direct light_blue_surface3', async ({
|
|
page,
|
|
}) => {
|
|
// Get the direct theme element
|
|
const directSquare = page.locator(`#${TEST_IDS.nestedThemeDirect}`)
|
|
await expect(directSquare).toBeVisible()
|
|
|
|
// Get the nested theme with explicit light parent
|
|
const nestedWithParent = page.locator(`#${TEST_IDS.nestedThemeWithParent}`)
|
|
await expect(nestedWithParent).toBeVisible()
|
|
|
|
// Get computed styles for both
|
|
const directStyles = await getStyles(directSquare)
|
|
const nestedStyles = await getStyles(nestedWithParent)
|
|
|
|
// The nested theme should produce the same background color as the direct theme
|
|
expect(nestedStyles.backgroundColor).toBe(directStyles.backgroundColor)
|
|
})
|
|
|
|
test('Nested red theme with surface3 matches direct light_red_surface3', async ({
|
|
page,
|
|
}) => {
|
|
// Get the direct red theme element
|
|
const redDirectSquare = page.locator(`#${TEST_IDS.nestedThemeRedDirect}`)
|
|
await expect(redDirectSquare).toBeVisible()
|
|
|
|
// Get the nested red theme element
|
|
const redNestedSquare = page.locator(`#${TEST_IDS.nestedThemeRedNested}`)
|
|
await expect(redNestedSquare).toBeVisible()
|
|
|
|
// Get computed styles for both
|
|
const redDirectStyles = await getStyles(redDirectSquare)
|
|
const redNestedStyles = await getStyles(redNestedSquare)
|
|
|
|
// The nested theme should produce the same background color as the direct theme
|
|
expect(redNestedStyles.backgroundColor).toBe(redDirectStyles.backgroundColor)
|
|
})
|
|
|
|
test('Blue surface3 differs from colorless surface3', async ({ page }) => {
|
|
// Get the blue nested theme
|
|
const blueNestedSquare = page.locator(`#${TEST_IDS.nestedThemeNested}`)
|
|
await expect(blueNestedSquare).toBeVisible()
|
|
|
|
// Get the colorless surface3 theme
|
|
const noColorSquare = page.locator(`#${TEST_IDS.nestedThemeNoColor}`)
|
|
await expect(noColorSquare).toBeVisible()
|
|
|
|
// Get computed styles for both
|
|
const blueStyles = await getStyles(blueNestedSquare)
|
|
const noColorStyles = await getStyles(noColorSquare)
|
|
|
|
// The blue surface3 should have a different background than the colorless surface3
|
|
// This verifies that color context actually makes a difference
|
|
expect(blueStyles.backgroundColor).not.toBe(noColorStyles.backgroundColor)
|
|
})
|
|
|
|
test('Blue surface3 differs from red surface3', async ({ page }) => {
|
|
// Get the blue nested theme
|
|
const blueNestedSquare = page.locator(`#${TEST_IDS.nestedThemeNested}`)
|
|
await expect(blueNestedSquare).toBeVisible()
|
|
|
|
// Get the red nested theme
|
|
const redNestedSquare = page.locator(`#${TEST_IDS.nestedThemeRedNested}`)
|
|
await expect(redNestedSquare).toBeVisible()
|
|
|
|
// Get computed styles for both
|
|
const blueStyles = await getStyles(blueNestedSquare)
|
|
const redStyles = await getStyles(redNestedSquare)
|
|
|
|
// Different color contexts should produce different backgrounds
|
|
expect(blueStyles.backgroundColor).not.toBe(redStyles.backgroundColor)
|
|
})
|
|
|
|
test('Nested blue → surface1 → surface3 preserves blue color context', async ({
|
|
page,
|
|
}) => {
|
|
// This is the exact reproduction case from issue #3673
|
|
// Using surface3 theme inside a surface1 theme should preserve the blue color context
|
|
|
|
// Get the direct blue_surface3 element
|
|
const directSquare = page.locator(`#${TEST_IDS.nestedSurface1To3Direct}`)
|
|
await expect(directSquare).toBeVisible()
|
|
|
|
// Get the nested blue → surface1 → surface3 element
|
|
const nestedSquare = page.locator(`#${TEST_IDS.nestedSurface1To3Nested}`)
|
|
await expect(nestedSquare).toBeVisible()
|
|
|
|
// Get computed styles for both
|
|
const directStyles = await getStyles(directSquare)
|
|
const nestedStyles = await getStyles(nestedSquare)
|
|
|
|
// The nested theme should produce the same background color as the direct theme
|
|
// If the bug is present, nestedStyles will have light_surface3 colors instead of light_blue_surface3
|
|
expect(nestedStyles.backgroundColor).toBe(directStyles.backgroundColor)
|
|
})
|