e0a5f57793
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as a monorepo subdirectory under desktop/. Source only — node_modules, dist, Cargo target and the upstream .git history are excluded. desktop/ keeps its own independent Cargo workspace (desktop/src-tauri with crates/*); it is not part of the backend boosapi crate, so a `cargo check` at the metapi root still compiles only the backend. Build the desktop app from desktop/src-tauri per desktop/README.md. Note: app icons are still placeholder assets pending the final BoosAPI logo. The updater signing keys live outside the repo and are not included.
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { createHeightManager } from '../src/utils/height'
|
|
|
|
// polyfill requestAnimationFrame for test environment
|
|
if (typeof (globalThis as any).requestAnimationFrame === 'undefined') {
|
|
;(globalThis as any).requestAnimationFrame = (cb: FrameRequestCallback) => setTimeout(() => cb(Date.now()), 0)
|
|
;(globalThis as any).cancelAnimationFrame = (id: number) => clearTimeout(id)
|
|
}
|
|
|
|
describe('createHeightManager', () => {
|
|
it('applies computed height and suppresses during application', async () => {
|
|
// create a fake container
|
|
const container = { style: { height: '' } } as unknown as HTMLElement
|
|
let computeCalls = 0
|
|
const cm = () => {
|
|
computeCalls++
|
|
return 100 + computeCalls
|
|
}
|
|
const m = createHeightManager(container, cm)
|
|
// first update should set height
|
|
m.update()
|
|
// wait a tick for RAF via requestAnimationFrame
|
|
await new Promise(res => setTimeout(res, 0))
|
|
expect(container.style.height).toMatch(/px$/)
|
|
// second update with same computed value should not change
|
|
m.update()
|
|
await new Promise(res => setTimeout(res, 0))
|
|
expect(container.style.height).not.toBe('')
|
|
m.dispose()
|
|
})
|
|
})
|