aboutsummaryrefslogtreecommitdiffstats
path: root/test/servicesSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2010-04-07 14:13:10 -0700
committerMisko Hevery2010-04-07 14:13:10 -0700
commit6ea1ac7b05a4079bcda0356e095703d36ccdf6b3 (patch)
treece5fd6f406a2311e2b2dbaf06d3263ef3b18b42f /test/servicesSpec.js
parentee327a1f4f75f57c2a2c6166520c092d4942ffe0 (diff)
downloadangular.js-6ea1ac7b05a4079bcda0356e095703d36ccdf6b3.tar.bz2
added $invalidWidget service
Diffstat (limited to 'test/servicesSpec.js')
-rw-r--r--test/servicesSpec.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js
index 43511853..b7dfe4c8 100644
--- a/test/servicesSpec.js
+++ b/test/servicesSpec.js
@@ -54,3 +54,23 @@ describe("services", function(){
});
});
+
+describe("service $invalidWidgets", function(){
+ var scope;
+ beforeEach(function(){
+ scope = null;
+ });
+ afterEach(function(){
+ if (scope && scope.$element)
+ scope.$element.remove();
+ });
+
+ it("should count number of invalid widgets", function(){
+ var scope = compile('<input name="price" ng-required></input>').$init();
+ expect(scope.$invalidWidgets.length).toEqual(1);
+ scope.price = 123;
+ scope.$eval();
+ expect(scope.$invalidWidgets.length).toEqual(0);
+ scope.$element.remove();
+ });
+});