test(localStorageSpec): test .bind with deep comparison

master
Ariel Mashraki 10 years ago
parent a425b43caa
commit 6a3c74b43a

@ -320,6 +320,23 @@ describe('localStorageService', function() {
expect($rootScope.property).toEqual(localStorageService.get('lsProperty'));
}));
it('should $watch with deep comparison only for objects', inject(function($rootScope, localStorageService) {
var mocks = [{}, [], 'string', 90, false];
var expectation = [true, true, false, false, false];
var results = [];
spyOn($rootScope, '$watch').andCallFake(function(key, func, eq) {
results.push(eq);
});
mocks.forEach(function(elm, i) {
localStorageService.set('mock' + i, elm);
localStorageService.bind($rootScope, 'mock' + i);
});
expect(results).toEqual(expectation);
}));
it('should be able to return it\'s owned keys amount', inject(
function(localStorageService, $window) {