6. Tests
live_editor_component_test.exs
Update the default debounce assertion from data-debounce="300" to data-debounce="50".
live_editor_event_test.exs
Add tests for the diff handler and apply_diff:
describe "diff event handling" do
# Test handle_event("diff", ...) with a mounted component
test "applies single character insertion"
test "applies deletion"
test "silently ignores out-of-bounds diff"
end
editor.ex tests (existing file)
Add unit tests for ExEditor.Editor.apply_diff/4:
- Insert at start, middle, end
- Delete (empty replacement text)
- Replace range
- Out-of-bounds positions return
{:error, :out_of_bounds}
6. Tests
live_editor_component_test.exsUpdate the default debounce assertion from
data-debounce="300"todata-debounce="50".live_editor_event_test.exsAdd tests for the diff handler and
apply_diff:editor.extests (existing file)Add unit tests for
ExEditor.Editor.apply_diff/4:{:error, :out_of_bounds}