b52bbc6d9f
Hide-IP was a sidebar button held only in memory, so it reset on reload. Moved it into the Settings modal Canvas section and persist it to localStorage (new ipDisplay util); the canvas store now seeds hideIp from storage and writes through on toggleHideIp/setHideIp. Settings is now also reachable in standalone (no-backend) builds, with the backend-only status interval guarded so the modal still works there. ha-relevant: yes
23 lines
590 B
TypeScript
23 lines
590 B
TypeScript
import { describe, it, expect, beforeEach } from 'vitest'
|
|
import { readHideIp, writeHideIp } from '@/utils/ipDisplay'
|
|
|
|
describe('ipDisplay persistence', () => {
|
|
beforeEach(() => localStorage.clear())
|
|
|
|
it('defaults to false when nothing is stored', () => {
|
|
expect(readHideIp()).toBe(false)
|
|
})
|
|
|
|
it('round-trips true', () => {
|
|
writeHideIp(true)
|
|
expect(localStorage.getItem('homelable.hideIp')).toBe('true')
|
|
expect(readHideIp()).toBe(true)
|
|
})
|
|
|
|
it('round-trips false', () => {
|
|
writeHideIp(true)
|
|
writeHideIp(false)
|
|
expect(readHideIp()).toBe(false)
|
|
})
|
|
})
|