fix: add unmount behavior to split atoms

This commit is contained in:
Richard 2024-03-03 10:24:54 -08:00
parent 4586882d3c
commit fc3cd6d9ad
4 changed files with 25 additions and 16 deletions

View file

@ -125,4 +125,12 @@ return function()
expect(updated).to.equal(1)
expect(deleted).to.equal(3)
end)
it("unmounts from parent atom", function()
local itemsAtom = atom({})
local itemAtoms = split(itemsAtom)
expect((next(itemsAtom.listeners))).to.be.ok()
itemAtoms:unmount()
expect((next(itemsAtom.listeners))).to.never.be.ok()
end)
end