aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/rootScopeSpec.js
diff options
context:
space:
mode:
authorMatias Niemelä2013-04-02 18:20:33 -0400
committerMisko Hevery2013-04-02 15:52:32 -0700
commit2845dd159087fc59eb29845a578f32c7c462e8e6 (patch)
tree991fd12f424fd432a658bdd93ea5c4c5d922ee18 /test/ng/rootScopeSpec.js
parent0b6f1ce5f89f47f9302ff1e8cd8f4b92f837c413 (diff)
downloadangular.js-2845dd159087fc59eb29845a578f32c7c462e8e6.tar.bz2
feat(ngdocs): added functionality to import and extract contents of external files inside docs comment code
Diffstat (limited to 'test/ng/rootScopeSpec.js')
-rw-r--r--test/ng/rootScopeSpec.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ng/rootScopeSpec.js b/test/ng/rootScopeSpec.js
index f4b6e8a1..cd8d4109 100644
--- a/test/ng/rootScopeSpec.js
+++ b/test/ng/rootScopeSpec.js
@@ -1114,4 +1114,30 @@ describe('Scope', function() {
});
});
});
+
+ describe("doc examples", function() {
+
+ it("should properly fire off watch listeners upon scope changes", inject(function($rootScope) {
+//<docs tag="docs1">
+ var scope = $rootScope.$new();
+ scope.salutation = 'Hello';
+ scope.name = 'World';
+
+ expect(scope.greeting).toEqual(undefined);
+
+ scope.$watch('name', function() {
+ scope.greeting = scope.salutation + ' ' + scope.name + '!';
+ }); // initialize the watch
+
+ expect(scope.greeting).toEqual(undefined);
+ scope.name = 'Misko';
+ // still old value, since watches have not been called yet
+ expect(scope.greeting).toEqual(undefined);
+
+ scope.$digest(); // fire all the watches
+ expect(scope.greeting).toEqual('Hello Misko!');
+//</docs>
+ }));
+
+ });
});