Truly independent web browser
LibWeb: Add a test for Backspace after a space in break-spaces text
Andreas Kling5655f1302366
diff --git a/Tests/LibWeb/Text/expected/Editing/backspace-after-space-break-spaces.txt b/Tests/LibWeb/Text/expected/Editing/backspace-after-space-break-spaces.txtnew file mode 100644index 00000000000..2c6d7b19616--- /dev/null+++ b/Tests/LibWeb/Text/expected/Editing/backspace-after-space-break-spaces.txt@@ -0,0 +1,3 @@+break-spaces: "hello wor"+break-spaces: "aaaa bbbb cccc dddd eeee ffff ggg wor"+pre-wrap: "aaaa bbbb cccc dddd eeee ffff ggg word"diff --git a/Tests/LibWeb/Text/input/Editing/backspace-after-space-break-spaces.html b/Tests/LibWeb/Text/input/Editing/backspace-after-space-break-spaces.htmlnew file mode 100644index 00000000000..ce9619ee6ae--- /dev/null+++ b/Tests/LibWeb/Text/input/Editing/backspace-after-space-break-spaces.html@@ -0,0 +1,23 @@+<!DOCTYPE html>+<script src="../include.js"></script>+<style>+ div {+ width: 200px;+ font: 16px monospace;+ }+</style>+<!-- ProseMirror-based editors, like the ChatGPT composer, use "white-space: break-spaces". -->+<div contenteditable="true" style="white-space: break-spaces"><p>hello word </p></div>+<div contenteditable="true" style="white-space: break-spaces"><p>aaaa bbbb cccc dddd eeee ffff ggg word </p></div>+<div contenteditable="true" style="white-space: pre-wrap"><p>aaaa bbbb cccc dddd eeee ffff ggg word </p></div>+<script>+ test(() => {+ for (const editor of document.querySelectorAll("div")) {+ editor.focus();+ const text = editor.querySelector("p").firstChild;+ getSelection().setBaseAndExtent(text, text.length, text, text.length);+ internals.sendKey(editor, "Backspace");+ println(`${editor.style.whiteSpace}: ${JSON.stringify(editor.textContent)}`);+ }+ });+</script>