angular-hotkeys icon indicating copy to clipboard operation
angular-hotkeys copied to clipboard

hotkeys module.run causes injection issue in unit test

Open pete-mckinney opened this issue 8 years ago • 1 comments

After I added angular-hotkeys to my project, I'm having issues in my unit tests. I'm getting the following error message: Error: [$injector:unpr] Unknown provider: $rootElementProvider <- $rootElement <- hotkeys <- hotkeys

This error message seems to indicate that angular-mocks.js hasn't been included yet, but I've checked it, and it has. I can also verify that that the $rootElementProvider is providing its mock element. All these mechanisms seem fine for everything else. However, I now get the error message above when I try to inject hotkeys service into a test.

It seems to be related to the .run that hotkeys calls to ensure that the initialization code gets called. Does this make sense to anyone? It's puzzling for me. I can make my tests run by putting the .run method inside an if statement that tests for !angular.mock, but this seems like an awkward solution.

pete-mckinney avatar May 24 '16 15:05 pete-mckinney

Did you find a solution for this?

FrankHald avatar Aug 27 '18 13:08 FrankHald