| OLD | NEW |
| 1 library input_select_spec; | 1 library input_select_spec; |
| 2 | 2 |
| 3 import '../_specs.dart'; | 3 import '../_specs.dart'; |
| 4 | 4 |
| 5 //TODO(misko): re-enabled dissabled tests once we have forms. | 5 //TODO(misko): re-enabled disabled tests once we have forms. |
| 6 | 6 |
| 7 main() { | 7 main() { |
| 8 describe('input-select', () { | 8 describe('input-select', () { |
| 9 | 9 |
| 10 describe('ng-value', () { | 10 describe('ng-value', () { |
| 11 TestBed _; | 11 TestBed _; |
| 12 beforeEach(inject((TestBed tb) => _ = tb)); | 12 beforeEach(inject((TestBed tb) => _ = tb)); |
| 13 | 13 |
| 14 it('should retrieve using ng-value', () { | 14 it('should retrieve using ng-value', () { |
| 15 _.compile( | 15 _.compile( |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 _.rootScope.$apply(() { | 369 _.rootScope.$apply(() { |
| 370 _.rootScope['robots'].clear(); | 370 _.rootScope['robots'].clear(); |
| 371 }); | 371 }); |
| 372 | 372 |
| 373 expect(_.rootElement).toEqualSelect([['?']]); | 373 expect(_.rootElement).toEqualSelect([['?']]); |
| 374 expect(_.rootScope['robot']).toEqual('r2d2'); | 374 expect(_.rootScope['robot']).toEqual('r2d2'); |
| 375 }); | 375 }); |
| 376 }); | 376 }); |
| 377 }); | 377 }); |
| 378 }); | 378 }); |
| 379 |
| 380 it('issue #392', () { |
| 381 _.compile( |
| 382 '<div>' + |
| 383 '<div ng-if="attached">' + |
| 384 '<select ng-model="model">' + |
| 385 '<option value="a">foo</option>' + |
| 386 '<option value="b">bar</option>' + |
| 387 '</select>' + |
| 388 '</div>' + |
| 389 '</div>'); |
| 390 _.rootScope.model = 'a'; |
| 391 _.rootScope.attached = true; |
| 392 _.rootScope.$apply(); |
| 393 expect(_.rootElement).toEqualSelect([['a'], 'b']); |
| 394 _.rootScope.attached = false; |
| 395 _.rootScope.$apply(); |
| 396 expect(_.rootElement).toEqualSelect([]); |
| 397 _.rootScope.attached = true; |
| 398 _.rootScope.$apply(); |
| 399 expect(_.rootElement).toEqualSelect([['a'], 'b']); |
| 400 }); |
| 379 }); | 401 }); |
| 380 | 402 |
| 381 | 403 |
| 382 describe('select from angular.js', () { | 404 describe('select from angular.js', () { |
| 383 TestBed _; | 405 TestBed _; |
| 384 beforeEach(inject((TestBed tb) => _ = tb)); | 406 beforeEach(inject((TestBed tb) => _ = tb)); |
| 385 | 407 |
| 386 var scope, formElement, element; | 408 var scope, formElement, element; |
| 387 | 409 |
| 388 compile(html) { | 410 compile(html) { |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 '</div>'); | 1234 '</div>'); |
| 1213 | 1235 |
| 1214 _.rootScope.foo = 'success'; | 1236 _.rootScope.foo = 'success'; |
| 1215 _.rootScope.$digest(); | 1237 _.rootScope.$digest(); |
| 1216 expect(_.rootElement.querySelector('span').text).toEqual('success'); | 1238 expect(_.rootElement.querySelector('span').text).toEqual('success'); |
| 1217 }); | 1239 }); |
| 1218 }); | 1240 }); |
| 1219 }); | 1241 }); |
| 1220 }); | 1242 }); |
| 1221 } | 1243 } |
| OLD | NEW |