| Index: third_party/pkg/angular/test/introspection_spec.dart
|
| diff --git a/third_party/pkg/angular/test/introspection_spec.dart b/third_party/pkg/angular/test/introspection_spec.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7740d2a0b21b80e05e50c8c5be66f5324aec7177
|
| --- /dev/null
|
| +++ b/third_party/pkg/angular/test/introspection_spec.dart
|
| @@ -0,0 +1,30 @@
|
| +library introspection_spec;
|
| +
|
| +import '_specs.dart';
|
| +
|
| +main() => describe('introspection', () {
|
| + it('should retrieve ElementProbe', inject((TestBed _) {
|
| + _.compile('<div ng-bind="true"></div>');
|
| + ElementProbe probe = ngProbe(_.rootElement);
|
| + expect(probe.injector.parent).toBe(_.injector);
|
| + expect(ngInjector(_.rootElement).parent).toBe(_.injector);
|
| + expect(probe.directives[0] is NgBindDirective).toBe(true);
|
| + expect(ngDirectives(_.rootElement)[0] is NgBindDirective).toBe(true);
|
| + expect(probe.scope).toBe(_.rootScope);
|
| + expect(ngScope(_.rootElement)).toBe(_.rootScope);
|
| + }));
|
| +
|
| + toHtml(List list) => list.map((e) => e.outerHtml).join('');
|
| +
|
| + it('should select elements using CSS selector', () {
|
| + var div = new Element.html('<div><p><span></span></p></div>');
|
| + var span = div.querySelector('span');
|
| + var shadowRoot = span.createShadowRoot();
|
| + shadowRoot.innerHtml = '<ul><li>stash</li><li>secret</li><ul>';
|
| +
|
| + expect(toHtml(ngQuery(div, 'li'))).toEqual('<li>stash</li><li>secret</li>');
|
| + expect(toHtml(ngQuery(div, 'li', 'stash'))).toEqual('<li>stash</li>');
|
| + expect(toHtml(ngQuery(div, 'li', 'secret'))).toEqual('<li>secret</li>');
|
| + expect(toHtml(ngQuery(div, 'li', 'xxx'))).toEqual('');
|
| + });
|
| +});
|
|
|