| Index: third_party/pkg/angular/test/core_dom/element_binder_builder_spec.dart
|
| diff --git a/third_party/pkg/angular/test/core_dom/element_binder_builder_spec.dart b/third_party/pkg/angular/test/core_dom/element_binder_builder_spec.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..013753be7f448aecd9132c90ec0a6e0836cf0840
|
| --- /dev/null
|
| +++ b/third_party/pkg/angular/test/core_dom/element_binder_builder_spec.dart
|
| @@ -0,0 +1,77 @@
|
| +library angular.dom.element_binder_spec;
|
| +
|
| +import '../_specs.dart';
|
| +import 'dart:mirrors';
|
| +
|
| +@Component(selector:'component') class _Component{}
|
| +@Decorator(selector:'[ignore-children]',
|
| + children: Directive.IGNORE_CHILDREN)
|
| + class _IgnoreChildren{}
|
| +@Decorator(selector:'[structural]',
|
| + children: Directive.TRANSCLUDE_CHILDREN)
|
| + class _Structural{}
|
| +@Decorator(selector:'[directive]') class _DirectiveAttr{}
|
| +
|
| +
|
| +directiveFor(i) {
|
| + ClassMirror cm = reflectType(i);
|
| +
|
| +}
|
| +main() => describe('ElementBinderBuilder', () {
|
| + var b;
|
| + var directives;
|
| + var node = null;
|
| +
|
| + beforeEachModule((Module module) {
|
| + module
|
| + ..type(_DirectiveAttr)
|
| + ..type(_Component)
|
| + ..type(_IgnoreChildren)
|
| + ..type(_Structural);
|
| + });
|
| +
|
| + beforeEach((DirectiveMap d, ElementBinderFactory f) {
|
| + directives = d;
|
| + b = f.builder();
|
| + });
|
| +
|
| + addDirective(selector) {
|
| + directives.forEach((Directive annotation, Type type) {
|
| + if (annotation.selector == selector)
|
| + b.addDirective(new DirectiveRef(node, type, annotation, null));
|
| + });
|
| + b = b.binder;
|
| + }
|
| +
|
| + it('should add a decorator', () {
|
| + expect(b.decorators.length).toEqual(0);
|
| +
|
| + addDirective('[directive]');
|
| +
|
| + expect(b.decorators.length).toEqual(1);
|
| + expect(b.component).toBeNull();
|
| + expect(b.childMode).toEqual(Directive.COMPILE_CHILDREN);
|
| +
|
| + });
|
| +
|
| + it('should add a component', () {
|
| + addDirective('component');
|
| +
|
| + expect(b.decorators.length).toEqual(0);
|
| + expect(b.component).toBeNotNull();
|
| + });
|
| +
|
| + it('should add a template', () {
|
| + addDirective('[structural]');
|
| +
|
| + expect(b.template).toBeNotNull();
|
| + });
|
| +
|
| + it('should add a directive that ignores children', () {
|
| + addDirective('[ignore-children]');
|
| +
|
| + expect(b.decorators.length).toEqual(1);
|
| + expect(b.component).toBeNull();
|
| + expect(b.childMode).toEqual(Directive.IGNORE_CHILDREN);
|
| + });
|
| +});
|
|
|