fix: Fixes issue where lock screen would not use previously active theme (#2372)
This commit is contained in:
58
packages/ui-services/src/Theme/ActiveThemeList.spec.ts
Normal file
58
packages/ui-services/src/Theme/ActiveThemeList.spec.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { ActiveThemeList } from './ActiveThemeList'
|
||||
import { ItemManagerInterface } from '@standardnotes/services'
|
||||
import { Uuid } from '@standardnotes/domain-core'
|
||||
|
||||
describe('ActiveThemeList', () => {
|
||||
let itemManager: ItemManagerInterface
|
||||
let list: ActiveThemeList
|
||||
|
||||
beforeEach(() => {
|
||||
itemManager = {} as ItemManagerInterface
|
||||
itemManager.findItem = jest.fn()
|
||||
|
||||
list = new ActiveThemeList(itemManager)
|
||||
})
|
||||
|
||||
it('should initialize with an empty list', () => {
|
||||
expect(list.getList()).toEqual([])
|
||||
})
|
||||
|
||||
it('should be empty initially', () => {
|
||||
expect(list.isEmpty()).toBe(true)
|
||||
})
|
||||
|
||||
it('should not have items that have not been added', () => {
|
||||
const uuid = Uuid.create('00000000-0000-0000-0000-000000000000').getValue()
|
||||
expect(list.has(uuid)).toBe(false)
|
||||
})
|
||||
|
||||
it('should add an item to the list', () => {
|
||||
const uuid = Uuid.create('00000000-0000-0000-0000-000000000000').getValue()
|
||||
list.add(uuid)
|
||||
expect(list.getList()).toContain(uuid)
|
||||
expect(list.has(uuid)).toBe(true)
|
||||
})
|
||||
|
||||
it('should not add a duplicate item to the list', () => {
|
||||
const uuid = Uuid.create('00000000-0000-0000-0000-000000000000').getValue()
|
||||
list.add(uuid)
|
||||
list.add(uuid)
|
||||
expect(list.getList()).toEqual([uuid])
|
||||
})
|
||||
|
||||
it('should remove an item from the list', () => {
|
||||
const uuid = Uuid.create('00000000-0000-0000-0000-000000000000').getValue()
|
||||
list.add(uuid)
|
||||
list.remove(uuid)
|
||||
expect(list.getList()).not.toContain(uuid)
|
||||
expect(list.has(uuid)).toBe(false)
|
||||
})
|
||||
|
||||
it('should clear the list', () => {
|
||||
const uuid = Uuid.create('00000000-0000-0000-0000-000000000000').getValue()
|
||||
list.add(uuid)
|
||||
list.clear()
|
||||
expect(list.getList()).toEqual([])
|
||||
expect(list.has(uuid)).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user