Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKamaev committed Apr 18, 2018
1 parent e35d579 commit f65dfc8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/client/automation/playback/type/type-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import hammerhead from '../../deps/hammerhead';
import testCafeCore from '../../deps/testcafe-core';
import nextTick from '../../utils/next-tick';

var browserUtils = hammerhead.utils.browser;
var eventSimulator = hammerhead.eventSandbox.eventSimulator;
var listeners = hammerhead.eventSandbox.listeners;
var browserUtils = hammerhead.utils.browser;
var featureDetection = hammerhead.utils.featureDetection;
var eventSimulator = hammerhead.eventSandbox.eventSimulator;
var listeners = hammerhead.eventSandbox.listeners;

var domUtils = testCafeCore.domUtils;
var contentEditable = testCafeCore.contentEditable;
Expand Down Expand Up @@ -107,8 +108,9 @@ function _excludeInvisibleSymbolsFromSelection (selection) {
// NOTE: typing can be prevented in Chrome/Edge but can not be prevented in IE11 or Firefox
// Firefox does not support TextInput event
// Safari support TextInput event but adds e.data to node value. So let's ignore it
// On touch devices with safari it works as expected
function simulateTextInput (element, text) {
const isTextInputIgnoredByBrowser = [ browserUtils.isFirefox, browserUtils.isSafari ].some(browser => browser);
const isTextInputIgnoredByBrowser = [ browserUtils.isFirefox, browserUtils.isSafari && !featureDetection.isTouchDevice].some(browser => browser);
const isInputEventRequired = isTextInputIgnoredByBrowser || eventSimulator.textInput(element, text);

return isInputEventRequired || browserUtils.isIE11 || browserUtils.isFirefox;
Expand Down

0 comments on commit f65dfc8

Please sign in to comment.