Commit dbf9ccbc authored by Robert Speicher's avatar Robert Speicher

Check originalEvent.repeat *and* event.repeat

phantomjs < 2.0 doesn't support creating `KeyboardEvent` so the tests
were failing on CI
parent fcf99d0d
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# </form> # </form>
# #
$(document).on 'keydown.quick_submit', '.js-quick-submit', (e) -> $(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 return unless e.keyCode == 13 # Enter
if navigator.userAgent.match(/Macintosh/) if navigator.userAgent.match(/Macintosh/)
......
...@@ -67,7 +67,4 @@ describe 'Quick Submit behavior', -> ...@@ -67,7 +67,4 @@ describe 'Quick Submit behavior', ->
else else
defaults = { keyCode: 13, ctrlKey: true } defaults = { keyCode: 13, ctrlKey: true }
args = $.extend({}, defaults, options) $.Event('keydown', $.extend({}, defaults, options))
originalEvent = new KeyboardEvent('keydown', args)
$.Event('keydown', $.extend({}, args, {originalEvent: originalEvent}))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment