mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
Add missing anchor clear test case
This commit is contained in:
@@ -67,4 +67,23 @@ describe('useAssetSelection', () => {
|
||||
expect(store.lastSelectedIndex).toBe(1)
|
||||
expect(store.lastSelectedAssetId).toBe('a')
|
||||
})
|
||||
|
||||
it('clears anchor when the anchored asset is no longer visible', () => {
|
||||
const selection = useAssetSelection()
|
||||
const store = useAssetSelectionStore()
|
||||
const assets: AssetItem[] = [
|
||||
{ id: 'a', name: 'a.png', tags: [] },
|
||||
{ id: 'b', name: 'b.png', tags: [] }
|
||||
]
|
||||
|
||||
store.setSelection(['a', 'b'])
|
||||
store.setLastSelectedIndex(0)
|
||||
store.setLastSelectedAssetId('a')
|
||||
|
||||
selection.reconcileSelection([assets[1]])
|
||||
|
||||
expect(Array.from(store.selectedAssetIds)).toEqual(['b'])
|
||||
expect(store.lastSelectedIndex).toBe(-1)
|
||||
expect(store.lastSelectedAssetId).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user