Skip to content

Commit

Permalink
fix: karma hack isn't needed anymore
Browse files Browse the repository at this point in the history
In fact it generates errors instead on some unit tests
  • Loading branch information
ocombe committed Mar 5, 2015
1 parent bdc03dd commit 3108296
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 20 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,6 @@ $stateProvider.state('index', {
- `isLoaded(modulesNames)`: Lets you check if a module (or a list of modules) has been loaded into Angular or not
## Karma & unit tests
You have to make sure that you load the ocLazyLoad.js file before the angular-mocks.js file (ideally you should load angular.js and the ocLazyLoad lib right after). The reason is that ocLazyLoad & angular mocks will both overwrite angular.module, but ocLazyLoad needs to be executed first.
## Contribute
If you want to get started and the docs are not enough, see the examples in the 'examples' folder!
Expand Down
15 changes: 0 additions & 15 deletions src/ocLazyLoad.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,21 +991,6 @@
return ngModuleFct(name, requires, configFn);
};

// add unit tests support
if((window.jasmine || window.mocha) && angular.isDefined(angular.mock)) {
var ngMockModuleFct = angular.mock.module;
window.module = angular.mock.module = function(module) {
if (angular.isObject(module) && !angular.isArray(module)) {
angular.forEach(module, function(value, key) {
addToLoadList(key);
});
} else if(angular.isString(module)) {
addToLoadList(module);
}
ngMockModuleFct(module);
}
}

var hashCode = function hashCode(str) {
var hash = 0, i, chr, len;
if (str.length == 0) return hash;
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/specs/ocLazyLoad.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('Module: oc.lazyLoad', function() {

// test 3
it('loadedModules should be working', function() {
expect($ocLazyLoad.getModules()).toEqual(['ng', 'app1', 'oc.lazyLoad', 'ngMockE2E']);
expect($ocLazyLoad.getModules()).toEqual(['ng', 'app1', 'oc.lazyLoad']);
});

// test 4
Expand Down

0 comments on commit 3108296

Please # to comment.