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]>
117 lines
4.3 KiB
TypeScript
117 lines
4.3 KiB
TypeScript
import { expect, test } from '@playwright/test'
|
|
import { getBoundingRect, setupPage } from './test-utils'
|
|
|
|
test.describe('Tooltip multi-trigger rapid hover', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await setupPage(page, {
|
|
name: 'TooltipMultiTriggerCase',
|
|
type: 'useCase',
|
|
})
|
|
await page.waitForLoadState('networkidle')
|
|
})
|
|
|
|
test('rapid sweep: tooltip stays open and tracks final trigger', async ({ page }) => {
|
|
const content = page.locator('#tip-content')
|
|
|
|
// hover first trigger to open
|
|
await page.locator('#tip-trigger-a').hover()
|
|
await page.waitForTimeout(200)
|
|
await expect(content).toBeVisible({ timeout: 3000 })
|
|
|
|
// sweep through triggers with gaps
|
|
const ids = ['a', 'b', 'c']
|
|
for (let i = 0; i < ids.length - 1; i++) {
|
|
const curr = page.locator(`#tip-trigger-${ids[i]}`)
|
|
const next = page.locator(`#tip-trigger-${ids[i + 1]}`)
|
|
const currBox = await curr.boundingBox()
|
|
const nextBox = await next.boundingBox()
|
|
if (currBox && nextBox) {
|
|
// move to gap between triggers
|
|
const gapX =
|
|
currBox.x + currBox.width + (nextBox.x - (currBox.x + currBox.width)) / 2
|
|
const gapY = currBox.y + currBox.height / 2
|
|
await page.mouse.move(gapX, gapY)
|
|
await page.waitForTimeout(30)
|
|
// move to next trigger
|
|
await page.mouse.move(
|
|
nextBox.x + nextBox.width / 2,
|
|
nextBox.y + nextBox.height / 2
|
|
)
|
|
await page.waitForTimeout(20)
|
|
}
|
|
}
|
|
|
|
await page.waitForTimeout(200)
|
|
await expect(content).toBeVisible({ timeout: 2000 })
|
|
|
|
const label = page.locator('#tip-label')
|
|
await expect(label).toContainText('Expert', { timeout: 2000 })
|
|
})
|
|
|
|
test('arrow stays aligned with hovered trigger after switch', async ({ page }) => {
|
|
const content = page.locator('#tip-content')
|
|
|
|
// hover first trigger to open
|
|
await page.locator('#tip-trigger-a').hover()
|
|
await page.waitForTimeout(200)
|
|
await expect(content).toBeVisible({ timeout: 3000 })
|
|
|
|
// verify arrow is near trigger A
|
|
const arrowA = await getBoundingRect(page, '#tip-arrow')
|
|
const triggerARect = await getBoundingRect(page, '#tip-trigger-a')
|
|
expect(arrowA).toBeTruthy()
|
|
const arrowACX = arrowA!.x + arrowA!.width / 2
|
|
const triggerACX = triggerARect!.x + triggerARect!.width / 2
|
|
// arrow should be within 30px of trigger center
|
|
expect(Math.abs(arrowACX - triggerACX)).toBeLessThan(30)
|
|
|
|
// quickly jump to trigger C (2 steps = very fast mouse move)
|
|
const triggerC = page.locator('#tip-trigger-c')
|
|
const cBox = await triggerC.boundingBox()
|
|
await page.mouse.move(cBox!.x + cBox!.width / 2, cBox!.y + cBox!.height / 2, {
|
|
steps: 2,
|
|
})
|
|
|
|
// wait for position to settle (animatePosition transition)
|
|
await page.waitForTimeout(500)
|
|
await expect(content).toBeVisible({ timeout: 2000 })
|
|
|
|
// arrow should now be near trigger C, not still near trigger A
|
|
const arrowC = await getBoundingRect(page, '#tip-arrow')
|
|
const triggerCRect = await getBoundingRect(page, '#tip-trigger-c')
|
|
const contentRect = await getBoundingRect(page, '#tip-content')
|
|
expect(arrowC).toBeTruthy()
|
|
expect(contentRect).toBeTruthy()
|
|
|
|
const arrowCCX = arrowC!.x + arrowC!.width / 2
|
|
const triggerCCX = triggerCRect!.x + triggerCRect!.width / 2
|
|
const contentCCX = contentRect!.x + contentRect!.width / 2
|
|
|
|
// arrow center should be within content bounds
|
|
expect(arrowCCX).toBeGreaterThanOrEqual(contentRect!.x)
|
|
expect(arrowCCX).toBeLessThanOrEqual(contentRect!.x + contentRect!.width)
|
|
|
|
// arrow should be reasonably near trigger C (not still at A)
|
|
// with offset=20 and animatePosition, arrow should track the trigger
|
|
expect(
|
|
Math.abs(arrowCCX - triggerCCX),
|
|
`arrow center (${arrowCCX}) should be near trigger C center (${triggerCCX}), content center at ${contentCCX}`
|
|
).toBeLessThan(40)
|
|
})
|
|
|
|
test('tooltip closes when cursor leaves all triggers', async ({ page }) => {
|
|
const content = page.locator('#tip-content')
|
|
|
|
// hover to open
|
|
await page.locator('#tip-trigger-b').hover()
|
|
await page.waitForTimeout(200)
|
|
await expect(content).toBeVisible({ timeout: 3000 })
|
|
|
|
// move cursor far away from triggers
|
|
await page.mouse.move(10, 10)
|
|
await page.waitForTimeout(500)
|
|
|
|
await expect(content).not.toBeVisible({ timeout: 3000 })
|
|
})
|
|
})
|