import { test, expect } from "vitest" import { morph } from "../../src/morphlex" import { dom, observeMutations } from "./utils" test("remove item from the end of a list", () => { const from = dom(` `) const to = dom(` `) const expected = to.outerHTML const mutations = observeMutations(from, () => { morph(from, to) }) expect(from.outerHTML).toBe(expected) expect(mutations.elementsRemoved).toBe(1) }) test("remove item from the beginning of a list", () => { const from = dom(` `) const to = dom(` `) const expected = to.outerHTML const mutations = observeMutations(from, () => { morph(from, to) }) expect(from.outerHTML).toBe(expected) expect(mutations.elementsRemoved).toBe(1) }) test("remove item from the middle of a list", () => { const from = dom(` `) const to = dom(` `) const expected = to.outerHTML const mutations = observeMutations(from, () => { morph(from, to) }) expect(from.outerHTML).toBe(expected) expect(mutations.elementsRemoved).toBe(1) })