From 85776c0d37316c5aaecd84eedec275bac2cd0298 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Wed, 4 Apr 2012 15:01:27 -0700 Subject: refactor(ngHref, ngSrc): remove duplicate tests --- test/ng/directive/booleanAttrsSpec.js | 58 ++++++++++++++--------------------- 1 file changed, 23 insertions(+), 35 deletions(-) (limited to 'test/ng/directive/booleanAttrsSpec.js') diff --git a/test/ng/directive/booleanAttrsSpec.js b/test/ng/directive/booleanAttrsSpec.js index d58ffced..dd96ebf5 100644 --- a/test/ng/directive/booleanAttrsSpec.js +++ b/test/ng/directive/booleanAttrsSpec.js @@ -8,21 +8,6 @@ describe('boolean attr directives', function() { }); - it('should bind href', inject(function($rootScope, $compile) { - element = $compile('')($rootScope) - $rootScope.url = 'http://server'; - $rootScope.$digest(); - expect(element.attr('href')).toEqual('http://server'); - })); - - - it('should bind href even if no interpolation', inject(function($rootScope, $compile) { - element = $compile('')($rootScope) - $rootScope.$digest(); - expect(element.attr('href')).toEqual('http://server'); - })); - - it('should properly evaluate 0 as false', inject(function($rootScope, $compile) { // jQuery does not treat 0 as false, when setting attr() element = $compile('')($rootScope) @@ -89,24 +74,6 @@ describe('boolean attr directives', function() { $rootScope.$digest(); expect(element.attr('multiple')).toBeTruthy(); })); - - - it('should bind src', inject(function($rootScope, $compile) { - element = $compile('
')($rootScope) - $rootScope.url = 'http://localhost/'; - $rootScope.$digest(); - expect(element.attr('src')).toEqual('http://localhost/'); - })); - - - it('should bind href and merge with other attrs', inject(function($rootScope, $compile) { - element = $compile('')($rootScope); - $rootScope.url = 'http://server'; - $rootScope.rel = 'REL'; - $rootScope.$digest(); - expect(element.attr('href')).toEqual('http://server'); - expect(element.attr('rel')).toEqual('REL'); - })); }); @@ -128,9 +95,15 @@ describe('ng-src', function() { describe('ng-href', function() { + var element; + + afterEach(function() { + dealoc(element); + }); + it('should interpolate the expression and bind to href', inject(function($compile, $rootScope) { - var element = $compile('
')($rootScope) + element = $compile('
')($rootScope) $rootScope.$digest(); expect(element.attr('href')).toEqual('some/'); @@ -138,7 +111,22 @@ describe('ng-href', function() { $rootScope.id = 1; }); expect(element.attr('href')).toEqual('some/1'); + })); - dealoc(element); + + it('should bind href and merge with other attrs', inject(function($rootScope, $compile) { + element = $compile('')($rootScope); + $rootScope.url = 'http://server'; + $rootScope.rel = 'REL'; + $rootScope.$digest(); + expect(element.attr('href')).toEqual('http://server'); + expect(element.attr('rel')).toEqual('REL'); + })); + + + it('should bind href even if no interpolation', inject(function($rootScope, $compile) { + element = $compile('')($rootScope) + $rootScope.$digest(); + expect(element.attr('href')).toEqual('http://server'); })); }); -- cgit v1.2.3