@@ -8,21 +8,6 @@ describe('boolean attr directives', function() {
8
8
} ) ;
9
9
10
10
11
- it ( 'should bind href' , inject ( function ( $rootScope , $compile ) {
12
- element = $compile ( '<a ng-href="{{url}}"></a>' ) ( $rootScope )
13
- $rootScope . url = 'http://server' ;
14
- $rootScope . $digest ( ) ;
15
- expect ( element . attr ( 'href' ) ) . toEqual ( 'http://server' ) ;
16
- } ) ) ;
17
-
18
-
19
- it ( 'should bind href even if no interpolation' , inject ( function ( $rootScope , $compile ) {
20
- element = $compile ( '<a ng-href="http://server"></a>' ) ( $rootScope )
21
- $rootScope . $digest ( ) ;
22
- expect ( element . attr ( 'href' ) ) . toEqual ( 'http://server' ) ;
23
- } ) ) ;
24
-
25
-
26
11
it ( 'should properly evaluate 0 as false' , inject ( function ( $rootScope , $compile ) {
27
12
// jQuery does not treat 0 as false, when setting attr()
28
13
element = $compile ( '<button ng-disabled="isDisabled">Button</button>' ) ( $rootScope )
@@ -89,24 +74,6 @@ describe('boolean attr directives', function() {
89
74
$rootScope . $digest ( ) ;
90
75
expect ( element . attr ( 'multiple' ) ) . toBeTruthy ( ) ;
91
76
} ) ) ;
92
-
93
-
94
- it ( 'should bind src' , inject ( function ( $rootScope , $compile ) {
95
- element = $compile ( '<div ng-src="{{url}}" />' ) ( $rootScope )
96
- $rootScope . url = 'http://localhost/' ;
97
- $rootScope . $digest ( ) ;
98
- expect ( element . attr ( 'src' ) ) . toEqual ( 'http://localhost/' ) ;
99
- } ) ) ;
100
-
101
-
102
- it ( 'should bind href and merge with other attrs' , inject ( function ( $rootScope , $compile ) {
103
- element = $compile ( '<a ng-href="{{url}}" rel="{{rel}}"></a>' ) ( $rootScope ) ;
104
- $rootScope . url = 'http://server' ;
105
- $rootScope . rel = 'REL' ;
106
- $rootScope . $digest ( ) ;
107
- expect ( element . attr ( 'href' ) ) . toEqual ( 'http://server' ) ;
108
- expect ( element . attr ( 'rel' ) ) . toEqual ( 'REL' ) ;
109
- } ) ) ;
110
77
} ) ;
111
78
112
79
@@ -128,17 +95,38 @@ describe('ng-src', function() {
128
95
129
96
130
97
describe ( 'ng-href' , function ( ) {
98
+ var element ;
99
+
100
+ afterEach ( function ( ) {
101
+ dealoc ( element ) ;
102
+ } ) ;
103
+
131
104
132
105
it ( 'should interpolate the expression and bind to href' , inject ( function ( $compile , $rootScope ) {
133
- var element = $compile ( '<div ng-href="some/{{id}}"></div>' ) ( $rootScope )
106
+ element = $compile ( '<div ng-href="some/{{id}}"></div>' ) ( $rootScope )
134
107
$rootScope . $digest ( ) ;
135
108
expect ( element . attr ( 'href' ) ) . toEqual ( 'some/' ) ;
136
109
137
110
$rootScope . $apply ( function ( ) {
138
111
$rootScope . id = 1 ;
139
112
} ) ;
140
113
expect ( element . attr ( 'href' ) ) . toEqual ( 'some/1' ) ;
114
+ } ) ) ;
141
115
142
- dealoc ( element ) ;
116
+
117
+ it ( 'should bind href and merge with other attrs' , inject ( function ( $rootScope , $compile ) {
118
+ element = $compile ( '<a ng-href="{{url}}" rel="{{rel}}"></a>' ) ( $rootScope ) ;
119
+ $rootScope . url = 'http://server' ;
120
+ $rootScope . rel = 'REL' ;
121
+ $rootScope . $digest ( ) ;
122
+ expect ( element . attr ( 'href' ) ) . toEqual ( 'http://server' ) ;
123
+ expect ( element . attr ( 'rel' ) ) . toEqual ( 'REL' ) ;
124
+ } ) ) ;
125
+
126
+
127
+ it ( 'should bind href even if no interpolation' , inject ( function ( $rootScope , $compile ) {
128
+ element = $compile ( '<a ng-href="http://server"></a>' ) ( $rootScope )
129
+ $rootScope . $digest ( ) ;
130
+ expect ( element . attr ( 'href' ) ) . toEqual ( 'http://server' ) ;
143
131
} ) ) ;
144
132
} ) ;
0 commit comments