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]>
235 lines
7.5 KiB
TypeScript
235 lines
7.5 KiB
TypeScript
import { expect, test } from '@playwright/test'
|
|
|
|
import { setupPage } from './test-utils'
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await setupPage(page, { name: 'PopoverCase', type: 'useCase' })
|
|
})
|
|
|
|
// Test simple popover functionality
|
|
test('simple popover opens and closes', async ({ page }) => {
|
|
// Wait for page to load
|
|
await page.waitForLoadState('networkidle')
|
|
|
|
const trigger = page.locator('#simple-popover-trigger')
|
|
const content = page.locator('#simple-popover-content')
|
|
const closeButton = page.locator('#simple-popover-close')
|
|
|
|
// Check initial state
|
|
await expect(trigger).toBeVisible()
|
|
await expect(content).not.toBeVisible()
|
|
|
|
// Click trigger to open popover
|
|
await trigger.click()
|
|
|
|
// Wait for content to be visible
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// Click close button
|
|
await closeButton.click()
|
|
|
|
// Verify popover is closed
|
|
await expect(content).not.toBeVisible()
|
|
})
|
|
|
|
// Test basic popover with icon trigger
|
|
test('basic popover with icon trigger', async ({ page }) => {
|
|
// Wait for page to load
|
|
await page.waitForLoadState('networkidle')
|
|
|
|
const trigger = page.locator('#popover-bottom-trigger')
|
|
const content = page.locator('#popover-bottom-content')
|
|
const input = page.locator('#popover-bottom-input')
|
|
const closeButton = page.locator('#popover-bottom-close')
|
|
|
|
// Check initial state
|
|
await expect(trigger).toBeVisible()
|
|
await expect(content).not.toBeVisible()
|
|
|
|
// Click trigger to open popover
|
|
await trigger.click()
|
|
|
|
// Wait for enter animation to start
|
|
await page.waitForTimeout(100)
|
|
|
|
// Wait for content to be visible
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// Click close button
|
|
await closeButton.click()
|
|
|
|
// Wait for exit animation
|
|
await page.waitForTimeout(500)
|
|
|
|
// Verify popover is closed
|
|
await expect(content).not.toBeVisible()
|
|
})
|
|
|
|
// Test popover placement variations
|
|
test('popover placement variations', async ({ page }) => {
|
|
// Wait for page to load
|
|
await page.waitForLoadState('networkidle')
|
|
|
|
const placements = ['left', 'top', 'right']
|
|
|
|
for (const placement of placements) {
|
|
const trigger = page.locator(`#popover-${placement}-trigger`)
|
|
const content = page.locator(`#popover-${placement}-content`)
|
|
|
|
// Check initial state
|
|
await expect(trigger).toBeVisible()
|
|
await expect(content).not.toBeVisible()
|
|
|
|
// Click trigger to open popover
|
|
await trigger.click()
|
|
|
|
// Wait for enter animation to start
|
|
await page.waitForTimeout(100)
|
|
|
|
// Wait for content to be visible
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// Close by clicking outside (ESC key)
|
|
await page.keyboard.press('Escape')
|
|
|
|
// Wait for exit animation to complete
|
|
await page.waitForTimeout(500)
|
|
|
|
// Verify popover is closed
|
|
await expect(content).not.toBeVisible()
|
|
}
|
|
})
|
|
|
|
// Test popover with keyboard navigation
|
|
test('popover keyboard navigation', async ({ page }) => {
|
|
// Wait for page to load
|
|
await page.waitForLoadState('networkidle')
|
|
|
|
const trigger = page.locator('#simple-popover-trigger')
|
|
const content = page.locator('#simple-popover-content')
|
|
|
|
// Focus trigger and open with Enter key
|
|
await trigger.focus()
|
|
await page.keyboard.press('Enter')
|
|
|
|
// Wait for content to be visible
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// Close with Escape key
|
|
await page.keyboard.press('Escape')
|
|
|
|
// Verify popover is closed
|
|
await expect(content).not.toBeVisible()
|
|
})
|
|
|
|
// Test popover accessibility
|
|
test('popover accessibility attributes', async ({ page }) => {
|
|
// Wait for page to load
|
|
await page.waitForLoadState('networkidle')
|
|
|
|
const trigger = page.locator('#simple-popover-trigger')
|
|
const content = page.locator('#simple-popover-content')
|
|
|
|
// Check initial state
|
|
await expect(trigger).toHaveAttribute('aria-expanded', 'false')
|
|
|
|
// Open popover
|
|
await trigger.click()
|
|
await expect(content).toBeVisible({ timeout: 5000 })
|
|
|
|
// Check expanded state
|
|
await expect(trigger).toHaveAttribute('aria-expanded', 'true')
|
|
|
|
// Close popover
|
|
await page.keyboard.press('Escape')
|
|
await expect(content).not.toBeVisible()
|
|
|
|
// Check collapsed state
|
|
await expect(trigger).toHaveAttribute('aria-expanded', 'false')
|
|
})
|
|
|
|
// Test multiple popovers behavior
|
|
test('multiple popovers - opening one closes others', async ({ page }) => {
|
|
// Wait for page to load
|
|
await page.waitForLoadState('networkidle')
|
|
|
|
const leftTrigger = page.locator('#popover-left-trigger')
|
|
const leftContent = page.locator('#popover-left-content')
|
|
const rightTrigger = page.locator('#popover-right-trigger')
|
|
const rightContent = page.locator('#popover-right-content')
|
|
const topTrigger = page.locator('#popover-top-trigger')
|
|
const topContent = page.locator('#popover-top-content')
|
|
|
|
// Check initial state - all popovers should be closed
|
|
await expect(leftContent).not.toBeVisible()
|
|
await expect(rightContent).not.toBeVisible()
|
|
await expect(topContent).not.toBeVisible()
|
|
|
|
// Open first popover (left)
|
|
await leftTrigger.click()
|
|
await page.waitForTimeout(100) // Wait for enter animation
|
|
await expect(leftContent).toBeVisible({ timeout: 5000 })
|
|
await expect(rightContent).not.toBeVisible()
|
|
await expect(topContent).not.toBeVisible()
|
|
|
|
// Open second popover (right) - should close the first one
|
|
await rightTrigger.click()
|
|
await page.waitForTimeout(600) // Wait for previous exit + new enter animations
|
|
await expect(leftContent).not.toBeVisible()
|
|
await expect(rightContent).toBeVisible({ timeout: 5000 })
|
|
await expect(topContent).not.toBeVisible()
|
|
|
|
// Open third popover (top) - should close the second one
|
|
await topTrigger.click()
|
|
await page.waitForTimeout(600) // Wait for previous exit + new enter animations
|
|
await expect(leftContent).not.toBeVisible()
|
|
await expect(rightContent).not.toBeVisible()
|
|
await expect(topContent).toBeVisible({ timeout: 5000 })
|
|
|
|
// Close the top popover
|
|
await page.keyboard.press('Escape')
|
|
await page.waitForTimeout(500) // Wait for exit animation
|
|
await expect(leftContent).not.toBeVisible()
|
|
await expect(rightContent).not.toBeVisible()
|
|
await expect(topContent).not.toBeVisible()
|
|
})
|
|
|
|
// Test multiple popovers with simple popover
|
|
test('multiple popovers - simple popover with others', async ({ page }) => {
|
|
// Wait for page to load
|
|
await page.waitForLoadState('networkidle')
|
|
|
|
const simpleTrigger = page.locator('#simple-popover-trigger')
|
|
const simpleContent = page.locator('#simple-popover-content')
|
|
const leftTrigger = page.locator('#popover-left-trigger')
|
|
const leftContent = page.locator('#popover-left-content')
|
|
|
|
// Check initial state
|
|
await expect(simpleContent).not.toBeVisible()
|
|
await expect(leftContent).not.toBeVisible()
|
|
|
|
// Open simple popover
|
|
await simpleTrigger.click()
|
|
await page.waitForTimeout(100) // Wait for enter animation
|
|
await expect(simpleContent).toBeVisible({ timeout: 5000 })
|
|
await expect(leftContent).not.toBeVisible()
|
|
|
|
// Open left popover - should close simple popover
|
|
await leftTrigger.click()
|
|
await page.waitForTimeout(600) // Wait for previous exit + new enter animations
|
|
await expect(simpleContent).not.toBeVisible()
|
|
await expect(leftContent).toBeVisible({ timeout: 5000 })
|
|
|
|
// Open simple popover again - should close left popover
|
|
await simpleTrigger.click()
|
|
await page.waitForTimeout(600) // Wait for previous exit + new enter animations
|
|
await expect(simpleContent).toBeVisible({ timeout: 5000 })
|
|
await expect(leftContent).not.toBeVisible()
|
|
|
|
// Close simple popover
|
|
await page.keyboard.press('Escape')
|
|
await page.waitForTimeout(500) // Wait for exit animation
|
|
await expect(simpleContent).not.toBeVisible()
|
|
await expect(leftContent).not.toBeVisible()
|
|
})
|