diff --git a/karma.conf.js b/karma.conf.js index 1f36224..d183eb8 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -5,8 +5,9 @@ module.exports = function(config) { files: [ 'node_modules/angular/angular.js', 'node_modules/angular-mocks/angular-mocks.js', + 'node_modules/phantomjs-polyfill/bind-polyfill.js', 'src/**/*.js', - 'test/**/*.js' + 'test/**/*.spec.js' ], preprocessors: { 'src/**/*.js': 'babel', diff --git a/package.json b/package.json index cf2c25c..71b0163 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "karma-phantomjs-launcher": "^0.2.1", "mocha": "^2.2.5", "phantomjs": "^1.9.18", + "phantomjs-polyfill": "0.0.1", "sinon-chai": "^2.8.0" } } diff --git a/test/uiMentionController.spec.js b/test/uiMentionController.spec.js index b9e0238..b8d3533 100644 --- a/test/uiMentionController.spec.js +++ b/test/uiMentionController.spec.js @@ -487,13 +487,9 @@ describe('uiMentionController', () => { function trigger (el, ev, code) { let evt; - if (code) { - evt = $document[0].createEvent('KeyboardEvent'); - evt.initKeyboardEvent(ev, true, true); - evt.keyCode = code; - } else { - evt = new Event(ev); - } + evt = $document[0].createEvent('KeyboardEvent'); + evt.initKeyboardEvent(ev, true, true); + evt.keyCode = code; el[0].dispatchEvent(evt);