Skip to content

Commit

Permalink
tests: Add unmounting multiple items in a list
Browse files Browse the repository at this point in the history
  • Loading branch information
Nefsen402 committed Oct 24, 2024
1 parent b0ca22c commit b29e3bf
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/array.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,47 @@ test("unmount from custom component indirection", () => {
name: 'body',
});
});

test("unmount two custom elements", () => {
const elem = document.createElement("body");
const arr = OArray();
mount(elem, arr);

const Comp = () => {
arr.splice(0);

return "hello world";
};

const Comp2 = () => {
return "hello world";
};

arr.push(h(Comp), h(Comp2));

assert.deepEqual(elem.tree(), {
name: 'body',
});
});

test("unmount two custom elements inverted", () => {
const elem = document.createElement("body");
const arr = OArray();
mount(elem, arr);

const Comp = () => {
return "hello world";
};

const Comp2 = () => {
arr.splice(0);

return "hello world";
};

arr.push(h(Comp), h(Comp2));

assert.deepEqual(elem.tree(), {
name: 'body',
});
});

0 comments on commit b29e3bf

Please sign in to comment.