| OLD | NEW |
| 1 library ng_src_boolean_spec; | 1 library ng_src_boolean_spec; |
| 2 | 2 |
| 3 import '../_specs.dart'; | 3 import '../_specs.dart'; |
| 4 import 'dart:html' as dom; | 4 import 'dart:html' as dom; |
| 5 | 5 |
| 6 main() { | 6 main() { |
| 7 describe('boolean attr directives', () { | 7 describe('boolean attr directives', () { |
| 8 TestBed _; | 8 TestBed _; |
| 9 beforeEach(inject((TestBed tb) => _ = tb)); | 9 beforeEach(inject((TestBed tb) => _ = tb)); |
| 10 | 10 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 expect(_.rootElement.attributes['rel']).toEqual('REL'); | 197 expect(_.rootElement.attributes['rel']).toEqual('REL'); |
| 198 })); | 198 })); |
| 199 | 199 |
| 200 | 200 |
| 201 it('should bind href even if no interpolation', inject(() { | 201 it('should bind href even if no interpolation', inject(() { |
| 202 _.compile('<a ng-href="http://server"></a>'); | 202 _.compile('<a ng-href="http://server"></a>'); |
| 203 _.rootScope.$digest(); | 203 _.rootScope.$digest(); |
| 204 expect(_.rootElement.attributes['href']).toEqual('http://server'); | 204 expect(_.rootElement.attributes['href']).toEqual('http://server'); |
| 205 })); | 205 })); |
| 206 }); | 206 }); |
| 207 |
| 208 describe('ngAttr', () { |
| 209 TestBed _; |
| 210 beforeEach(inject((TestBed tb) => _ = tb)); |
| 211 |
| 212 it('should interpolate the expression and bind to *', inject(() { |
| 213 _.compile('<div ng-attr-foo="some/{{id}}"></div>'); |
| 214 _.rootScope.$digest(); |
| 215 expect(_.rootElement.attributes['foo']).toEqual('some/'); |
| 216 |
| 217 _.rootScope.$apply(() { |
| 218 _.rootScope.id = 1; |
| 219 }); |
| 220 expect(_.rootElement.attributes['foo']).toEqual('some/1'); |
| 221 })); |
| 222 |
| 223 |
| 224 it('should bind * and merge with other attrs', inject(() { |
| 225 _.compile('<div ng-attr-bar="{{bar}}" ng-attr-bar2="{{bar2}}" bam="{{bam}}
"></a>'); |
| 226 _.rootScope.bar = 'foo'; |
| 227 _.rootScope.bar2 = 'foo2'; |
| 228 _.rootScope.bam = 'boom'; |
| 229 _.rootScope.$digest(); |
| 230 expect(_.rootElement.attributes['bar']).toEqual('foo'); |
| 231 expect(_.rootElement.attributes['bar2']).toEqual('foo2'); |
| 232 expect(_.rootElement.attributes['bam']).toEqual('boom'); |
| 233 _.rootScope.bar = 'FOO'; |
| 234 _.rootScope.bar2 = 'FOO2'; |
| 235 _.rootScope.bam = 'BOOM'; |
| 236 _.rootScope.$digest(); |
| 237 expect(_.rootElement.attributes['bar']).toEqual('FOO'); |
| 238 expect(_.rootElement.attributes['bar2']).toEqual('FOO2'); |
| 239 expect(_.rootElement.attributes['bam']).toEqual('BOOM'); |
| 240 })); |
| 241 |
| 242 |
| 243 it('should bind * even if no interpolation', inject(() { |
| 244 _.compile('<a ng-attr-quack="vanilla"></a>'); |
| 245 _.rootScope.$digest(); |
| 246 expect(_.rootElement.attributes['quack']).toEqual('vanilla'); |
| 247 })); |
| 248 }); |
| 207 } | 249 } |
| OLD | NEW |