diff options
Diffstat (limited to 'test/servicesSpec.js')
| -rw-r--r-- | test/servicesSpec.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js index 91cc1f0e..618d9a15 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -80,11 +80,22 @@ describe("service $invalidWidgets", function(){ }); it("should count number of invalid widgets", function(){ - var scope = compile('<input name="price" ng-required></input>').$init(); + var scope = compile('<input name="price" ng-required ng-validate="number"></input>').$init(); expect(scope.$invalidWidgets.length).toEqual(1); scope.price = 123; scope.$eval(); expect(scope.$invalidWidgets.length).toEqual(0); scope.$element.remove(); + scope.price = 'abc'; + scope.$eval(); + expect(scope.$invalidWidgets.length).toEqual(1); + + jqLite(document.body).append(scope.$element); + scope.$invalidWidgets.clearOrphans(); + expect(scope.$invalidWidgets.length).toEqual(1); + + jqLite(document.body).html(''); + scope.$invalidWidgets.clearOrphans(); + expect(scope.$invalidWidgets.length).toEqual(0); }); }); |
