mirror of
https://github.com/nexu-io/open-design.git
synced 2026-09-20 06:15:06 +08:00
973e868ced
* fix(web): make deck thumbnail navigation immediate * feat(deck): standardize viewer navigation protocol * test(daemon): update deck prompt matrix snapshot * test(daemon): assert versioned deck fallback state * test(deck): strengthen navigation regression contract * fix(deck): reject unsupported fallback protocol versions * fix(deck): reject unsupported bridge protocol versions * fix(deck): retry keyboard navigation through transition locks
32 lines
984 B
TypeScript
32 lines
984 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import type { DeckNavigateMessage } from '../src/runtime/deck-protocol';
|
|
|
|
describe('deck navigation protocol types', () => {
|
|
it('requires an index only for absolute navigation', () => {
|
|
const absolute = {
|
|
type: 'od:slide',
|
|
action: 'go',
|
|
index: 2,
|
|
protocolVersion: 1,
|
|
} satisfies DeckNavigateMessage;
|
|
const relative = {
|
|
type: 'od:slide',
|
|
action: 'next',
|
|
} satisfies DeckNavigateMessage;
|
|
|
|
// @ts-expect-error Absolute navigation must name its zero-based target.
|
|
const missingIndex: DeckNavigateMessage = { type: 'od:slide', action: 'go' };
|
|
// @ts-expect-error Relative navigation must not carry an ambiguous index.
|
|
const unexpectedIndex: DeckNavigateMessage = {
|
|
type: 'od:slide',
|
|
action: 'next',
|
|
index: 2,
|
|
};
|
|
|
|
expect(absolute.index).toBe(2);
|
|
expect(relative.action).toBe('next');
|
|
void missingIndex;
|
|
void unexpectedIndex;
|
|
});
|
|
});
|