@@ -0,0 +1,2704 @@
+package org.fxmisc.richtext.keyboard;%0A%0Aimport com.nitorcreations.junit.runners.NestedRunner;%0Aimport javafx.stage.Stage;%0Aimport org.fxmisc.richtext.InlineCssTextAreaAppTest;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0A%0Aimport static javafx.scene.input.KeyCode.BACK_SPACE;%0Aimport static javafx.scene.input.KeyCode.DELETE;%0Aimport static javafx.scene.input.KeyCode.SHORTCUT;%0Aimport static org.fxmisc.richtext.model.NavigationActions.SelectionPolicy.CLEAR;%0Aimport static org.junit.Assert.assertEquals;%0A%0A@RunWith(NestedRunner.class)%0Apublic class DeletionTests %7B%0A%0A    String text = %22text%22;%0A    String text2 = join(text, text);%0A    String text3 = join(text2, text);%0A%0A    private String join(String... strings) %7B%0A        return String.join(%22 %22, strings);%0A    %7D%0A%0A    private String withoutLastChar(String s) %7B%0A        return s.substring(0, s.length() - 1);%0A    %7D%0A%0A    private String withoutFirstChar(String s) %7B%0A        return s.substring(1);%0A    %7D%0A%0A    public class WhenShortcutIsDown extends InlineCssTextAreaAppTest %7B%0A%0A        @Override%0A        public void start(Stage stage) throws Exception %7B%0A            super.start(stage);%0A            area.replaceText(text3);%0A%0A            press(SHORTCUT);%0A        %7D%0A%0A        @Test%0A        public void pressingDeleteRemovesNextWordAndSpace() %7B%0A            area.moveTo(0);%0A            int pos = area.getCaretPosition();%0A%0A            press(DELETE);%0A%0A            assertEquals(text2, area.getText());%0A            assertEquals(pos, area.getCaretPosition());%0A        %7D%0A%0A        @Test%0A        public void pressingBackspaceRemovesPreviousWordAndSpace() %7B%0A            area.end(CLEAR);%0A            int pos = area.getCaretPosition();%0A%0A            press(BACK_SPACE);%0A%0A            assertEquals(text2, area.getText());%0A            assertEquals(pos - text.length() - 1, area.getCaretPosition());%0A        %7D%0A    %7D%0A%0A    public class WhenModifiersAreNotDown extends InlineCssTextAreaAppTest  %7B%0A%0A        @Override%0A        public void start(Stage stage) throws Exception %7B%0A            super.start(stage);%0A            area.replaceText(text);%0A        %7D%0A%0A        @Test%0A        public void pressingDeleteRemovesNextChar() %7B%0A            area.moveTo(0);%0A            int pos = area.getCaretPosition();%0A%0A            push(DELETE);%0A%0A            assertEquals(withoutFirstChar(text), area.getText());%0A            assertEquals(pos, area.getCaretPosition());%0A        %7D%0A%0A        @Test%0A        public void pressingBackspaceRemovesPreviousChar() %7B%0A            area.end(CLEAR);%0A            int pos = area.getCaretPosition();%0A%0A            push(BACK_SPACE);%0A%0A            assertEquals(withoutLastChar(text), area.getText());%0A            assertEquals(pos - 1, area.getCaretPosition());%0A        %7D%0A%0A    %7D%0A%7D%0A

Implement deletion/backspace tests