| OLD | NEW |
| (Empty) |
| 1 library ng_include_spec; | |
| 2 | |
| 3 import '../_specs.dart'; | |
| 4 | |
| 5 main() { | |
| 6 describe('NgInclude', () { | |
| 7 TestBed _; | |
| 8 | |
| 9 beforeEach(inject((TestBed tb) => _ = tb)); | |
| 10 | |
| 11 it('should fetch template from literal url', async(inject((Scope scope, Temp
lateCache cache) { | |
| 12 cache.put('tpl.html', new HttpResponse(200, 'my name is {{name}}')); | |
| 13 | |
| 14 var element = _.compile('<div ng-include="tpl.html"></div>'); | |
| 15 | |
| 16 expect(element.innerHtml).toEqual(''); | |
| 17 | |
| 18 microLeap(); // load the template from cache. | |
| 19 scope.applyInZone(() { | |
| 20 scope.context['name'] = 'Vojta'; | |
| 21 }); | |
| 22 expect(element.text).toEqual('my name is Vojta'); | |
| 23 }))); | |
| 24 | |
| 25 it('should fetch template from url using interpolation', async(inject((Scope
scope, TemplateCache cache) { | |
| 26 cache.put('tpl1.html', new HttpResponse(200, 'My name is {{name}}')); | |
| 27 cache.put('tpl2.html', new HttpResponse(200, 'I am {{name}}')); | |
| 28 | |
| 29 var element = _.compile('<div ng-include="{{template}}"></div>'); | |
| 30 | |
| 31 expect(element.innerHtml).toEqual(''); | |
| 32 | |
| 33 scope.applyInZone(() { | |
| 34 scope.context['name'] = 'Vojta'; | |
| 35 scope.context['template'] = 'tpl1.html'; | |
| 36 }); | |
| 37 expect(element.text).toEqual('My name is Vojta'); | |
| 38 | |
| 39 scope.applyInZone(() { | |
| 40 scope.context['template'] = 'tpl2.html'; | |
| 41 }); | |
| 42 expect(element.text).toEqual('I am Vojta'); | |
| 43 }))); | |
| 44 | |
| 45 }); | |
| 46 } | |
| OLD | NEW |