Closed kramerc closed 6 years ago
Hi Kramerc, Could you try the current version in master?
The ReferenceError
is no longer an issue but I am getting that TypeError
with Capybara and Poltergeist. Changing new MouseEvent
to new Event
should fix the error.
Event also seems to work for me. Updated master :)
Hmm, it seems I was under the false impression I had several days ago thinking that change would fix it as the tests still fail with Poltergeist and capybara-webkit drivers with a similar TypeError
.
A try {...} catch {...}
might work to have these driver implementations fall back to the older event initialization code. I am under the impression that the capybara-webkit driver and PhantomJS have some issues as I don't find this issue to be an actual issue with this gem.
It should only execute this if Event is defined. What line exactly raises this error?
This is the exact error:
TypeError: '[object EventConstructor]' is not a constructor
The problem is that Event
and MouseEvent
are actually defined, just they're not being considered constructors. This is why if Event?
passes.
This seems to be an issue with QtWebKit, both of which capybara-webkit and PhantomJS use. A simple Qt web browser application produces the same problem.
Then i'll give that a spin soon
Hi Peter,
Some changes have been made to the master branch that might resolve the issue. I've not yet tested this using a Qt web browser yet though. Did you try the version in master?
Cheers,
Rene
Rene van Lieshout
rene.lico.nl | LinkedIn
Op 16 jan. 2014, om 23:49 heeft Peter Mouland notifications@github.com het volgende geschreven:
I was just wandering if this was still an issue?
I just bumped into the following error:
'[object EventConstructor]' is not a constructor (evaluating 'new Event(e)') when running the following code within my mocha spec:
event.emit(window,'resize'); which translates into this pretty standard cross browser event handler
function emit(el, eventName) { var event; if (document.createEvent) { event = new Event(eventName); el.dispatchEvent(event); } else { event = document.createEventObject(); el.fireEvent('on' + eventName, event); } } — Reply to this email directly or view it on GitHub.
i haven't, no, just been using the released version that came with grunt-mocha.
This appears to still be a problem for me: https://travis-ci.org/obduk/cms/builds/40487152
And this appears to fix it: https://github.com/obduk/twitter-bootstrap-rails-confirm/compare/bluerail:bootstrap3...fix_events
I don't mind the addition of the else element.trigger "click", but the if Event? is there for a reason. Does it produce any js error that isn't visible in the travis-ci output? I would prefer to tighten the conditions for the if Event?
I've never had any complaints about this issue anymore so closing it. Feel free to reopen if it's still relevant
Ever since commit 59bf1f91e81ad0dcba18a8c287465719f7448c19 was merged in, Capybara feature specs using either the capybara-webkit or Poltergeist drivers fail when testing confirmation dialogs powered by this gem. Debugging the failures, I found the following error that is tripping the specs:
Correcting
MouseEvents
toMouseEvent
presents another issue. While this resolves the above error in Firefox and Chrome, both Safari and the Capybara drivers give the following error:With Safari 6.0.5, switching
MouseEvent
toEvent
works as intended. With the Capybara drivers, however, they present a similar error as the one above withEvent
, thus leading me to assume they're working with older versions of JavaScriptCore. There is a related issue regarding this on the PhantomJS repo: ariya/phantomjs#11289I would suggest either reverting the commit for now or changing
MouseEvents
toEvent
and add backwards compatibility while other browsers and WebKit test drivers catch up.