explodorama / files / test / holdRing.test.ts
holdRing.test.ts
| 1 | import { describe, expect, it } from 'vitest' |
| 2 | import { ringVisible, type OriginState } from '../src/ui/holdRing' |
| 3 | |
| 4 | const up: OriginState = { connected: true, rendered: true, inClosingDialog: false } |
| 5 | |
| 6 | describe('ringVisible (Q72: the ring lives only as long as its originator)', () => { |
| 7 | it('shows while the picture is there to be seen', () => { |
| 8 | expect(ringVisible(up)).toBe(true) |
| 9 | }) |
| 10 | it('hides the moment the picture leaves the page', () => { |
| 11 | expect(ringVisible({ ...up, connected: false })).toBe(false) |
| 12 | }) |
| 13 | it('hides when the picture is hidden or has no size', () => { |
| 14 | expect(ringVisible({ ...up, rendered: false })).toBe(false) |
| 15 | }) |
| 16 | it('hides while its dialog is closing or closed', () => { |
| 17 | expect(ringVisible({ ...up, inClosingDialog: true })).toBe(false) |
| 18 | }) |
| 19 | }) |