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]>
126 lines
4.2 KiB
TypeScript
126 lines
4.2 KiB
TypeScript
/**
|
|
* Native tests for pointer events
|
|
* Verifies touch events map correctly to pointer events on native
|
|
*/
|
|
|
|
import { by, device, element, expect, waitFor } from 'detox'
|
|
import { remountDirectUseCase } from './utils/navigation'
|
|
import { safeLaunchApp } from './utils/detox'
|
|
|
|
describe('PointerEvents', () => {
|
|
beforeAll(async () => {
|
|
await safeLaunchApp({
|
|
newInstance: true,
|
|
launchArgs: { directUseCase: 'PointerEventsCase' },
|
|
})
|
|
await waitFor(element(by.id('pointer-events-root')))
|
|
.toExist()
|
|
.withTimeout(180000)
|
|
})
|
|
|
|
beforeEach(async () => {
|
|
await remountDirectUseCase('pointer-events-root')
|
|
})
|
|
|
|
it('should render the test case', async () => {
|
|
await expect(element(by.id('pointer-target'))).toExist()
|
|
await expect(element(by.id('down-count'))).toHaveText('Down: 0')
|
|
await expect(element(by.id('up-count'))).toHaveText('Up: 0')
|
|
})
|
|
|
|
it('should fire pointerDown and pointerUp on tap', async () => {
|
|
await element(by.id('pointer-target')).tap()
|
|
|
|
await expect(element(by.id('down-count'))).toHaveText('Down: 1')
|
|
await expect(element(by.id('up-count'))).toHaveText('Up: 1')
|
|
})
|
|
|
|
it('should fire pointerEnter on touch start', async () => {
|
|
await element(by.id('pointer-target')).tap()
|
|
|
|
await expect(element(by.id('enter-count'))).toHaveText('Enter: 1')
|
|
})
|
|
|
|
it('should fire pointerLeave on touch end', async () => {
|
|
await element(by.id('pointer-target')).tap()
|
|
|
|
await expect(element(by.id('leave-count'))).toHaveText('Leave: 1')
|
|
})
|
|
|
|
it('should fire pointerMove during drag', async () => {
|
|
// disable sync during drag to prevent Detox from blocking gesture events
|
|
await device.disableSynchronization()
|
|
|
|
await element(by.id('pointer-target')).longPressAndDrag(
|
|
800, // duration ms (longer for CI reliability)
|
|
0.2, // start x (normalized)
|
|
0.5, // start y (normalized)
|
|
element(by.id('pointer-target')),
|
|
0.8, // end x (normalized)
|
|
0.5, // end y (normalized)
|
|
'slow',
|
|
0
|
|
)
|
|
|
|
// wait for state update from move events
|
|
await new Promise((r) => setTimeout(r, 300))
|
|
await device.enableSynchronization()
|
|
|
|
// should have fired at least one move event (not still 0)
|
|
const moveEl = element(by.id('move-count'))
|
|
// if move fired, text won't be "Move: 0"
|
|
await expect(moveEl).not.toHaveText('Move: 0')
|
|
})
|
|
|
|
// skipping this test because longPressAndDrag from one element to another has
|
|
// visibility threshold issues in Detox when the root container extends beyond viewport
|
|
it.skip('should fire pointerLeave when dragging off element', async () => {
|
|
await element(by.id('pointer-target')).longPressAndDrag(
|
|
500,
|
|
0.5,
|
|
0.5,
|
|
element(by.id('pointer-events-root')),
|
|
0.5,
|
|
0.1, // drag to top of root (outside target)
|
|
'slow',
|
|
0
|
|
)
|
|
|
|
await new Promise((r) => setTimeout(r, 100))
|
|
|
|
await expect(element(by.id('leave-count'))).toHaveText('Leave: 1')
|
|
})
|
|
|
|
it('should handle multiple tap cycles', async () => {
|
|
await element(by.id('pointer-target')).tap()
|
|
await element(by.id('pointer-target')).tap()
|
|
await element(by.id('pointer-target')).tap()
|
|
|
|
await expect(element(by.id('down-count'))).toHaveText('Down: 3')
|
|
await expect(element(by.id('up-count'))).toHaveText('Up: 3')
|
|
await expect(element(by.id('enter-count'))).toHaveText('Enter: 3')
|
|
await expect(element(by.id('leave-count'))).toHaveText('Leave: 3')
|
|
})
|
|
|
|
// skipping this test because the capture-target (second 200px square) is often
|
|
// partially off-screen and longPressAndDrag requires 100% visibility
|
|
// the core pointer capture functionality is tested in web tests
|
|
it.skip('should receive moves outside bounds when pointer is captured', async () => {
|
|
// drag from capture target to outside (root area)
|
|
// with setPointerCapture, moves should still fire even outside bounds
|
|
await element(by.id('capture-target')).longPressAndDrag(
|
|
500,
|
|
0.5,
|
|
0.5,
|
|
element(by.id('pointer-events-root')),
|
|
0.5,
|
|
0.05, // drag way up outside the target
|
|
'slow',
|
|
0
|
|
)
|
|
|
|
// should have received move events even while outside bounds
|
|
await expect(element(by.id('capture-move-count'))).not.toHaveText('CapMove: 0')
|
|
})
|
|
})
|