diff options
| author | Misko Hevery | 2010-04-07 14:13:10 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-04-07 14:13:10 -0700 | 
| commit | 6ea1ac7b05a4079bcda0356e095703d36ccdf6b3 (patch) | |
| tree | ce5fd6f406a2311e2b2dbaf06d3263ef3b18b42f /test/servicesSpec.js | |
| parent | ee327a1f4f75f57c2a2c6166520c092d4942ffe0 (diff) | |
| download | angular.js-6ea1ac7b05a4079bcda0356e095703d36ccdf6b3.tar.bz2 | |
added $invalidWidget service
Diffstat (limited to 'test/servicesSpec.js')
| -rw-r--r-- | test/servicesSpec.js | 20 | 
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(); +  }); +});  | 
