feat(client): GM token panel sets vision and vision radius (#78)
Token create and edit now carry flags.vision and vision_radius; edits merge
only the vision key into the stored flags. A new token keeps DESIGN 8's
flags '{}' default (vision off, radius = scene default). The fog e2e authors
its sighted token through the GM panel, and the admin e2e proves the panel
round-trip plus an explored 200 / unexplored 403 tile probe.
Refs #78
This commit is contained in:
@@ -83,6 +83,8 @@ describe('GM token records', () => {
|
||||
statuses: [{ status: 'stuck', source: 'walls' }],
|
||||
descriptiveName: 'Rat',
|
||||
actualName: 'Giant Rat',
|
||||
flags: {},
|
||||
visionRadius: null,
|
||||
})
|
||||
|
||||
const changed = reduce(
|
||||
@@ -107,6 +109,23 @@ describe('GM token records', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps the free-form flags and the vision radius the panel edits (#78)', () => {
|
||||
const state = run(
|
||||
{ type: 'connecting' },
|
||||
hello(1),
|
||||
gmToken('abc', { flags: { vision: true, note: 'kept' }, vision_radius: 300 }),
|
||||
)
|
||||
expect(tokenOf(state, 'abc')).toMatchObject({
|
||||
flags: { vision: true, note: 'kept' },
|
||||
visionRadius: 300,
|
||||
})
|
||||
const changed = reduce(state, gmToken('abc', { flags: { vision: false }, vision_radius: null }))
|
||||
expect(tokenOf(changed, 'abc')).toMatchObject({
|
||||
flags: { vision: false },
|
||||
visionRadius: null,
|
||||
})
|
||||
})
|
||||
|
||||
it('ignores a malformed token frame instead of inventing a row', () => {
|
||||
const state = run({ type: 'connecting' }, hello(1), frame({ t: 'token', n: 2, id: 7 }))
|
||||
expect(adminTokens(state)).toEqual([])
|
||||
|
||||
Reference in New Issue
Block a user