diff --git a/cypress/e2e/type.cy.ts b/cypress/e2e/type.cy.ts index c71393a..4653fc5 100644 --- a/cypress/e2e/type.cy.ts +++ b/cypress/e2e/type.cy.ts @@ -21,8 +21,15 @@ describe("cy.realType", () => { }); it("supports cypress's keys shortcuts", () => { - cy.realType("Something{backspace}{backspace}"); - cy.get("input[name=q]").should("have.value", "Somethi"); + cy.realType("Something{backspace}{moveToStart}{rightarrow}{backspace}"); + cy.get("input[name=q]").should("have.value", "omethin"); + }); + + it("can select text", () => { + cy.realType("to replace"); + cy.get("input[name=q]").realClick({ clickCount: 3 }); + cy.realType("{backspace}something"); + cy.get("input[name=q]").should("have.value", "something"); }); it("can clear text input", () => { diff --git a/src/keyCodeDefinitions.ts b/src/keyCodeDefinitions.ts index 7df9e37..02192dd 100644 --- a/src/keyCodeDefinitions.ts +++ b/src/keyCodeDefinitions.ts @@ -45,9 +45,11 @@ export const keyCodeDefinitions = { '{pagedown}': {'keyCode': 34, 'code': 'PageDown', 'key': 'PageDown'}, 'PageDown': {'keyCode': 34, 'code': 'PageDown', 'key': 'PageDown'}, '{end}': {'keyCode': 35, 'code': 'End', 'key': 'End'}, + '{moveToEnd}': {'keyCode': 35, 'code': 'End', 'key': 'End'}, 'End': {'keyCode': 35, 'code': 'End', 'key': 'End'}, 'Numpad1': {'keyCode': 35, 'shiftKeyCode': 97, 'key': 'End', 'code': 'Numpad1', 'shiftKey': '1', 'location': 3}, '{home}': {'keyCode': 36, 'code': 'Home', 'key': 'Home'}, + '{moveToStart}': {'keyCode': 36, 'code': 'Home', 'key': 'Home'}, 'Home': {'keyCode': 36, 'code': 'Home', 'key': 'Home'}, 'Numpad7': {'keyCode': 36, 'shiftKeyCode': 103, 'key': 'Home', 'code': 'Numpad7', 'shiftKey': '7', 'location': 3}, '{leftarrow}': {'keyCode': 37, 'code': 'ArrowLeft', 'key': 'ArrowLeft'},