From 4aab904ff6e46ffc278542718f7f55aed2fa4371 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 18 Nov 2015 13:35:18 -0500 Subject: [PATCH] FIX: Test in phantom environment with different selection defaults --- test/javascripts/acceptance/composer-test.js.es6 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/javascripts/acceptance/composer-test.js.es6 b/test/javascripts/acceptance/composer-test.js.es6 index c2d4d04fb7..e8d8e8dbf5 100644 --- a/test/javascripts/acceptance/composer-test.js.es6 +++ b/test/javascripts/acceptance/composer-test.js.es6 @@ -43,6 +43,10 @@ test("Tests the Composer controls", () => { }); andThen(() => { + const textarea = find('#reply-control .d-editor-input')[0]; + textarea.selectionStart = textarea.value.length; + textarea.selectionEnd = textarea.value.length; + // Testing keyboard events is tough! const mac = /Mac|iPod|iPhone|iPad/.test(navigator.platform); const event = document.createEvent('Event'); @@ -50,7 +54,7 @@ test("Tests the Composer controls", () => { event[mac ? 'metaKey' : 'ctrlKey'] = true; event.keyCode = 66; - find('#reply-control .d-editor-input')[0].dispatchEvent(event); + textarea.dispatchEvent(event); }); andThen(() => {