From 41a5c408c242269bf31bc0b774c7304fdf7c2f1c Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 8 Apr 2010 15:05:05 -0700 Subject: tests pass jstd has issues --- test/BinderTest.js | 6 ++---- test/directivesSpec.js | 10 ++++------ test/servicesSpec.js | 4 +--- 3 files changed, 7 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/BinderTest.js b/test/BinderTest.js index e72afa9f..ec0c1cb4 100644 --- a/test/BinderTest.js +++ b/test/BinderTest.js @@ -506,10 +506,8 @@ BinderTest.prototype.testFillInOptionValueWhenMissing = function() { }; BinderTest.prototype.testValidateForm = function() { - var doc = jqLite(document.body); - doc.append('
' + + var c = this.compile('
' + '
'); - var c = this.compile(doc); var items = [{}, {}]; c.scope.$set("items", items); c.scope.$eval(); @@ -545,7 +543,7 @@ BinderTest.prototype.testValidateOnlyVisibleItems = function(){ c.scope.$set("show", false); c.scope.$eval(); - assertEquals(1, c.scope.$get("$invalidWidgets.length")); + assertEquals(1, c.scope.$invalidWidgets.visible()); }; BinderTest.prototype.testDeleteAttributeIfEvaluatesFalse = function() { diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 0af61997..1def9584 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -141,22 +141,20 @@ describe("directives", function(){ it('should ng-show', function(){ var scope = compile('
'); - jqLite(document.body).append(scope.$element); scope.$eval(); - expect(isVisible(scope.$element)).toEqual(true); + expect(isCssVisible(scope.$element)).toEqual(true); scope.$set('hide', true); scope.$eval(); - expect(isVisible(scope.$element)).toEqual(false); + expect(isCssVisible(scope.$element)).toEqual(false); }); it('should ng-hide', function(){ var scope = compile('
'); - jqLite(document.body).append(scope.$element); scope.$eval(); - expect(isVisible(scope.$element)).toEqual(false); + expect(isCssVisible(scope.$element)).toEqual(false); scope.$set('show', true); scope.$eval(); - expect(isVisible(scope.$element)).toEqual(true); + expect(isCssVisible(scope.$element)).toEqual(true); }); it('should ng-controller', function(){ diff --git a/test/servicesSpec.js b/test/servicesSpec.js index a3841c2f..b7dfe4c8 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -66,9 +66,7 @@ describe("service $invalidWidgets", function(){ }); it("should count number of invalid widgets", function(){ - var doc = jqLite(window.document.body); - doc.append(''); - var scope = compile(doc).$init(); + var scope = compile('').$init(); expect(scope.$invalidWidgets.length).toEqual(1); scope.price = 123; scope.$eval(); -- cgit v1.2.3