mirror of
https://github.com/wu736139669/hapi.git
synced 2026-12-04 06:57:55 +00:00
feat(web): session list status indicators (attention + scheduled) (#699)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import {
|
||||
DEFAULT_SESSION_LIST_STATUS_MODE,
|
||||
getInitialSessionListStatusMode,
|
||||
getSessionListStatusModeOptions,
|
||||
} from './useSessionListStatusMode'
|
||||
|
||||
describe('useSessionListStatusMode helpers', () => {
|
||||
beforeEach(() => {
|
||||
window.localStorage.clear()
|
||||
})
|
||||
|
||||
it('returns the allowed session list status mode options', () => {
|
||||
expect(getSessionListStatusModeOptions()).toEqual([
|
||||
{ value: 'standard', labelKey: 'settings.display.sessionListStatus.standard' },
|
||||
{ value: 'detailed', labelKey: 'settings.display.sessionListStatus.detailed' },
|
||||
])
|
||||
})
|
||||
|
||||
it('falls back to the default mode for missing or invalid storage values', () => {
|
||||
expect(getInitialSessionListStatusMode()).toBe(DEFAULT_SESSION_LIST_STATUS_MODE)
|
||||
|
||||
window.localStorage.setItem('hapi-session-list-status-mode', 'invalid')
|
||||
expect(getInitialSessionListStatusMode()).toBe(DEFAULT_SESSION_LIST_STATUS_MODE)
|
||||
})
|
||||
|
||||
it('reads a valid stored session list status mode', () => {
|
||||
window.localStorage.setItem('hapi-session-list-status-mode', 'detailed')
|
||||
|
||||
expect(getInitialSessionListStatusMode()).toBe('detailed')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user