FIX: Test in phantom environment with different selection defaults

This commit is contained in:
Robin Ward 2015-11-18 13:35:18 -05:00
parent 146ec4e1ba
commit 4aab904ff6

View File

@ -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(() => {