aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/ng/directive/booleanAttrsSpec.js58
1 files changed, 23 insertions, 35 deletions
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('<a ng-href="{{url}}"></a>')($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('<a ng-href="http://server"></a>')($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('<button ng-disabled="isDisabled">Button</button>')($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('<div ng-src="{{url}}" />')($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('<a ng-href="{{url}}" rel="{{rel}}"></a>')($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('<div ng-href="some/{{id}}"></div>')($rootScope)
+ element = $compile('<div ng-href="some/{{id}}"></div>')($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('<a ng-href="{{url}}" rel="{{rel}}"></a>')($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('<a ng-href="http://server"></a>')($rootScope)
+ $rootScope.$digest();
+ expect(element.attr('href')).toEqual('http://server');
}));
});