| OLD | NEW |
| 1 library introspection_spec; | 1 library introspection_spec; |
| 2 | 2 |
| 3 import '_specs.dart'; | 3 import '_specs.dart'; |
| 4 | 4 |
| 5 main() => describe('introspection', () { | 5 main() => describe('introspection', () { |
| 6 it('should retrieve ElementProbe', inject((TestBed _) { | 6 it('should retrieve ElementProbe', inject((TestBed _) { |
| 7 _.compile('<div ng-bind="true"></div>'); | 7 _.compile('<div ng-bind="true"></div>'); |
| 8 ElementProbe probe = ngProbe(_.rootElement); | 8 ElementProbe probe = ngProbe(_.rootElement); |
| 9 expect(probe.injector.parent).toBe(_.injector); | 9 expect(probe.injector.parent).toBe(_.injector); |
| 10 expect(ngInjector(_.rootElement).parent).toBe(_.injector); | 10 expect(ngInjector(_.rootElement).parent).toBe(_.injector); |
| 11 expect(probe.directives[0] is NgBindDirective).toBe(true); | 11 expect(probe.directives[0] is NgBindDirective).toBe(true); |
| 12 expect(ngDirectives(_.rootElement)[0] is NgBindDirective).toBe(true); | 12 expect(ngDirectives(_.rootElement)[0] is NgBindDirective).toBe(true); |
| 13 expect(probe.scope).toBe(_.rootScope); | 13 expect(probe.scope).toBe(_.rootScope); |
| 14 expect(ngScope(_.rootElement)).toBe(_.rootScope); | 14 expect(ngScope(_.rootElement)).toBe(_.rootScope); |
| 15 })); | 15 })); |
| 16 | 16 |
| 17 toHtml(List list) => list.map((e) => e.outerHtml).join(''); | 17 toHtml(List list) => list.map((e) => e.outerHtml).join(''); |
| 18 | 18 |
| 19 it('should select elements using CSS selector', () { | 19 it('should select elements using CSS selector', () { |
| 20 var div = new Element.html('<div><p><span></span></p></div>'); | 20 var div = new Element.html('<div><p><span></span></p></div>'); |
| 21 var span = div.querySelector('span'); | 21 var span = div.querySelector('span'); |
| 22 var shadowRoot = span.createShadowRoot(); | 22 var shadowRoot = span.createShadowRoot(); |
| 23 shadowRoot.innerHtml = '<ul><li>stash</li><li>secret</li><ul>'; | 23 shadowRoot.innerHtml = '<ul><li>stash</li><li>secret</li><ul>'; |
| 24 | 24 |
| 25 expect(toHtml(ngQuery(div, 'li'))).toEqual('<li>stash</li><li>secret</li>'); | 25 expect(toHtml(ngQuery(div, 'li'))).toEqual('<li>stash</li><li>secret</li>'); |
| 26 expect(toHtml(ngQuery(div, 'li', 'stash'))).toEqual('<li>stash</li>'); | 26 expect(toHtml(ngQuery(div, 'li', 'stash'))).toEqual('<li>stash</li>'); |
| 27 expect(toHtml(ngQuery(div, 'li', 'secret'))).toEqual('<li>secret</li>'); | 27 expect(toHtml(ngQuery(div, 'li', 'secret'))).toEqual('<li>secret</li>'); |
| 28 expect(toHtml(ngQuery(div, 'li', 'xxx'))).toEqual(''); | 28 expect(toHtml(ngQuery(div, 'li', 'xxx'))).toEqual(''); |
| 29 }); | 29 }); |
| 30 |
| 31 it('should select elements in the root shadow root', () { |
| 32 var div = new Element.html('<div></div>'); |
| 33 var shadowRoot = div.createShadowRoot(); |
| 34 shadowRoot.innerHtml = '<ul><li>stash</li><li>secret</li><ul>'; |
| 35 expect(toHtml(ngQuery(div, 'li'))).toEqual('<li>stash</li><li>secret</li>'); |
| 36 }); |
| 30 }); | 37 }); |
| OLD | NEW |