Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Unified Diff: third_party/pkg/angular/test/core_dom/element_binder_builder_spec.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698