behave like cacheFactory, add put method

master
Chakib Benziane 9 years ago
parent a07d51c3e7
commit 15ad8a603e

@ -406,6 +406,7 @@ angularLocalStorage.provider('localStorageService', function() {
isSupported: browserSupportsLocalStorage,
getStorageType: getStorageType,
set: addToLocalStorage,
put: addToLocalStorage,
add: addToLocalStorage, //DEPRECATED
get: getFromLocalStorage,
keys: getKeysForLocalStorage,

@ -18,6 +18,14 @@ describe('localStorageService', function() {
};
}
function addItem(key, value) {
return function($window, localStorageService) {
elmSpy = spyOn($window.localStorage, 'setItem').andCallThrough();
localStorageService.put(key, value);
};
}
function removeItem(key) {
return function($window, localStorageService) {
elmSpy = spyOn($window.localStorage, 'removeItem').andCallThrough();