Available since v0.1.0
fs-assert-removed
StableResolves when an element matching the selector is removed from the DOM after the trigger fires. Mutation-observed.
Syntax
fs-assert-removed="<selector>"
When to use it
- Deleting items from a list (todos, cart, notifications)
- Closing a modal whose content is unmounted (not just hidden)
- Dismissing a toast by removal
- Cleanup flows where an element should be torn down
If the element stays in the DOM but is hidden (display:none, visibility:hidden), use hidden instead.
Example
<button
fs-assert="todos/remove-item"
fs-trigger="click"
fs-assert-removed=".todo-item">
Delete
</button>
Passes when a matching .todo-item is removed from the DOM after the click.
Pre-existing matches matter
Unlike added, removed naturally depends on a pre-existing match — you can't remove what isn't there. The assertion watches the removedElements mutation list and resolves when an element matching the selector is removed.
Pairs well with
fs-trigger="click"— delete buttonsfs-trigger="unmount"— verify cleanup on teardown- Conditional assertions —
removed-success+added-errorbranches fs-assert-mutex="each"— group the success + error branches
Gotchas
- Using
removedwhenhiddenis correct. If your modal usesdisplay: nonerather than unmounting, the element is still in the DOM. Usehidden. - Batched removals. A single click may remove many elements in the same microtask.
removedresolves as soon as ANY matching element is removed — use[count=N]for cardinality checks at the removal moment (but notecountis evaluated on the current DOM, not the removed set).
See also
added— the complementary typehidden— for "still in DOM, not visible" checks- Assertions index