aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/service/scopeSpec.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/service/scopeSpec.js b/test/service/scopeSpec.js
index 30805684..b1b870f4 100644
--- a/test/service/scopeSpec.js
+++ b/test/service/scopeSpec.js
@@ -248,6 +248,22 @@ describe('Scope', function() {
}));
+ it('should watch functions', function() {
+ module(provideLog);
+ inject(function($rootScope, log) {
+ $rootScope.fn = function() {return 'a'};
+ $rootScope.$watch('fn', function(scope, fn) {
+ log(fn());
+ });
+ $rootScope.$digest();
+ expect(log).toEqual('a');
+ $rootScope.fn = function() {return 'b'};
+ $rootScope.$digest();
+ expect(log).toEqual('a; b');
+ })
+ });
+
+
it('should prevent $digest recursion', inject(function($rootScope) {
var callCount = 0;
$rootScope.$watch('name', function() {