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]>
162 lines
6.0 KiB
TypeScript
162 lines
6.0 KiB
TypeScript
import { expect, test } from '@playwright/test'
|
|
import { setupPage } from './test-utils'
|
|
|
|
/**
|
|
* Test for Dialog → Sheet content portaling on viewport resize
|
|
*
|
|
* This tests the fix for: When resizing from wide (Dialog) to narrow (Sheet via Adapt),
|
|
* the Sheet appears empty because the portal content isn't properly transferred.
|
|
*/
|
|
test.describe('Dialog Sheet Adapt - viewport resize', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await setupPage(page, { name: 'DialogSheetAdaptResizeCase', type: 'useCase' })
|
|
})
|
|
|
|
test('content is visible in dialog at wide viewport', async ({ page }) => {
|
|
// set viewport to wide (above maxMd breakpoint of 768px)
|
|
await page.setViewportSize({ width: 1024, height: 768 })
|
|
await page.waitForTimeout(300)
|
|
|
|
// open the dialog
|
|
const trigger = page.getByTestId('open-dialog')
|
|
await trigger.click({ force: true })
|
|
await page.waitForTimeout(500)
|
|
|
|
// dialog content should be visible
|
|
const title = page.getByTestId('dialog-title')
|
|
await expect(title).toBeVisible({ timeout: 5000 })
|
|
|
|
const content = page.getByTestId('dialog-content')
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// close button should work
|
|
const closeButton = page.getByTestId('close-dialog')
|
|
await closeButton.click({ force: true })
|
|
await expect(title).not.toBeVisible({ timeout: 5000 })
|
|
})
|
|
|
|
test('content is visible in sheet at narrow viewport', async ({ page }) => {
|
|
// set viewport to narrow (below maxMd breakpoint of 768px)
|
|
await page.setViewportSize({ width: 600, height: 768 })
|
|
await page.waitForTimeout(300)
|
|
|
|
// open - should show as sheet due to adapt
|
|
const trigger = page.getByTestId('open-dialog')
|
|
await trigger.click({ force: true })
|
|
await page.waitForTimeout(500)
|
|
|
|
// sheet content should be visible
|
|
const title = page.getByTestId('dialog-title')
|
|
await expect(title).toBeVisible({ timeout: 5000 })
|
|
|
|
const content = page.getByTestId('dialog-content')
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// extra content should also be visible
|
|
const extra1 = page.getByTestId('extra-content-1')
|
|
await expect(extra1).toBeVisible({ timeout: 5000 })
|
|
})
|
|
|
|
test('content transfers from dialog to sheet on resize narrow', async ({ page }) => {
|
|
// start at wide viewport
|
|
await page.setViewportSize({ width: 1024, height: 768 })
|
|
await page.waitForTimeout(300)
|
|
|
|
// open the dialog at wide width
|
|
const trigger = page.getByTestId('open-dialog')
|
|
await trigger.click({ force: true })
|
|
await page.waitForTimeout(500)
|
|
|
|
// verify content visible in dialog
|
|
const title = page.getByTestId('dialog-title')
|
|
await expect(title).toBeVisible({ timeout: 5000 })
|
|
|
|
const content = page.getByTestId('dialog-content')
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// resize to narrow - should adapt to sheet
|
|
await page.setViewportSize({ width: 600, height: 768 })
|
|
await page.waitForTimeout(500) // give time for adapt to trigger and animations
|
|
|
|
// content should still be visible (now in sheet)
|
|
await expect(title).toBeVisible({ timeout: 5000 })
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// extra content should also be visible
|
|
const extra1 = page.getByTestId('extra-content-1')
|
|
await expect(extra1).toBeVisible({ timeout: 5000 })
|
|
})
|
|
|
|
test('content transfers from sheet to dialog on resize wide', async ({ page }) => {
|
|
// start at narrow viewport
|
|
await page.setViewportSize({ width: 600, height: 768 })
|
|
await page.waitForTimeout(300)
|
|
|
|
// open at narrow width - should show as sheet
|
|
const trigger = page.getByTestId('open-dialog')
|
|
await trigger.click({ force: true })
|
|
await page.waitForTimeout(500)
|
|
|
|
// verify content visible in sheet
|
|
const title = page.getByTestId('dialog-title')
|
|
await expect(title).toBeVisible({ timeout: 5000 })
|
|
|
|
const content = page.getByTestId('dialog-content')
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// resize to wide - should adapt back to dialog
|
|
await page.setViewportSize({ width: 1024, height: 768 })
|
|
await page.waitForTimeout(500) // give time for adapt to trigger and animations
|
|
|
|
// content should still be visible (now in dialog)
|
|
await expect(title).toBeVisible({ timeout: 5000 })
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// extra content should also be visible
|
|
const extra1 = page.getByTestId('extra-content-1')
|
|
await expect(extra1).toBeVisible({ timeout: 5000 })
|
|
})
|
|
|
|
test('multiple resize cycles preserve content', async ({ page }) => {
|
|
// start wide
|
|
await page.setViewportSize({ width: 1024, height: 768 })
|
|
await page.waitForTimeout(300)
|
|
|
|
// open dialog
|
|
const trigger = page.getByTestId('open-dialog')
|
|
await trigger.click({ force: true })
|
|
await page.waitForTimeout(500)
|
|
|
|
const title = page.getByTestId('dialog-title')
|
|
const content = page.getByTestId('dialog-content')
|
|
|
|
// verify initial state
|
|
await expect(title).toBeVisible({ timeout: 5000 })
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// cycle 1: wide -> narrow
|
|
await page.setViewportSize({ width: 600, height: 768 })
|
|
await page.waitForTimeout(500)
|
|
await expect(title).toBeVisible({ timeout: 5000 })
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// cycle 1: narrow -> wide
|
|
await page.setViewportSize({ width: 1024, height: 768 })
|
|
await page.waitForTimeout(500)
|
|
await expect(title).toBeVisible({ timeout: 5000 })
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// cycle 2: wide -> narrow
|
|
await page.setViewportSize({ width: 600, height: 768 })
|
|
await page.waitForTimeout(500)
|
|
await expect(title).toBeVisible({ timeout: 5000 })
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// cycle 2: narrow -> wide
|
|
await page.setViewportSize({ width: 1024, height: 768 })
|
|
await page.waitForTimeout(500)
|
|
await expect(title).toBeVisible({ timeout: 5000 })
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
})
|
|
})
|