Check originalEvent.repeat *and* event.repeat

phantomjs < 2.0 doesn't support creating `KeyboardEvent` so the tests
were failing on CI
This commit is contained in:
Robert Speicher 2015-10-07 17:59:10 -04:00
parent fcf99d0d09
commit dbf9ccbcfe
2 changed files with 2 additions and 5 deletions

View File

@ -14,7 +14,7 @@
# </form>
#
$(document).on 'keydown.quick_submit', '.js-quick-submit', (e) ->
return if e.originalEvent.repeat
return if (e.originalEvent && e.originalEvent.repeat) || e.repeat
return unless e.keyCode == 13 # Enter
if navigator.userAgent.match(/Macintosh/)

View File

@ -67,7 +67,4 @@ describe 'Quick Submit behavior', ->
else
defaults = { keyCode: 13, ctrlKey: true }
args = $.extend({}, defaults, options)
originalEvent = new KeyboardEvent('keydown', args)
$.Event('keydown', $.extend({}, args, {originalEvent: originalEvent}))
$.Event('keydown', $.extend({}, defaults, options))