EvandroLG / selecting

:fishing_pole_and_fish: A library that allows you to access the text selected by the user
92 stars 12 forks source link

Problem with PhantomJS and touch events #9

Open felquis opened 9 years ago

felquis commented 9 years ago

The problem is that 'ontouchevent' in window return true in PhantomJS and there's no way to disable touch events in PhantomJS on runtime. For this reason, the tests with mouseup are failing.

And because this, the tests for libraries are also failing because when ontouchevent is present we don't actually use libraries to delegate the events but addEventListener.

We could use !global.window.mochaPhantomJS in this line:

if ('ontouchstart' in global && !global.window.mochaPhantomJS) { ... }

But I don't think this is a good solution.

EvandroLG commented 9 years ago

You are right, this solution is not good - we should not mix the logic of the tests within the main code. A solution to it is: make public the isTouch attribute and within the test change it to false or true.

But in fact, phantom has another problem that I need to solve. It don't the Event object. Because of it, I'm just running the tests in the browser for now =/