<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// Crash test for replaceTextInNodePreservingMarkers.
// Atempt to delete " efg" by hitting [Backspace] key four times
const samples = [
'abcd efg| hijkl',
'abcd ef| hijkl',
'abcd e| hijkl',
'abcd\u00A0| hijkl',
'abcd| hijkl',
];
for (let index = 1; index < samples.length; ++index) {
selection_test(
`<div contenteditable style="width: 3px;">${samples[index - 1]}</div>`,
'Delete',
`<div contenteditable style="width: 3px;">${samples[index]}</div>`);
}
</script>