Skip to content

Commit b2ec189

Browse files
committed
add bind() test
1 parent a9dba56 commit b2ec189

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

test/localFactory.spec.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,35 @@ describe('angular-localStorage module', function () {
2424
});
2525
});
2626

27-
describe('when remove() value from localStorage', function () {
27+
describe('when bind() $scope field to localStorage', function () {
28+
var scope;
29+
30+
beforeEach(function () {
31+
inject(function ($rootScope) {
32+
scope = $rootScope.$new();
33+
34+
scope.$apply(function () {
35+
scope.spec = true;
36+
});
37+
38+
$store.bind(scope, 'spec');
39+
40+
scope.$apply(function () {
41+
scope.spec = false;
42+
});
43+
});
44+
});
45+
46+
beforeEach(function () {
47+
testValue = $store.get('specy');
48+
});
49+
50+
it('should have $scope value', function () {
51+
expect(testValue).toBe(false);
52+
});
53+
});
54+
55+
describe('when remove() field from localStorage', function () {
2856
beforeEach(function () {
2957
$store.remove('spec');
3058
});
@@ -33,7 +61,7 @@ describe('angular-localStorage module', function () {
3361
testValue = $store.get('spec');
3462
});
3563

36-
it('should not contain value', function () {
64+
it('should not contain field', function () {
3765
expect(testValue).toBeNull();
3866
});
3967
});

0 commit comments

Comments
 (0)