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

Unified Diff: third_party/pkg/angular/test/core/core_directive_spec.dart

Issue 256553002: Revert "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/core_directive_spec.dart
diff --git a/third_party/pkg/angular/test/core/core_directive_spec.dart b/third_party/pkg/angular/test/core/core_directive_spec.dart
index 48f60b5ede1f5ee1ca987dec87bea7f34e098d8e..2e1927fc8b1206b67b932100b16f54e74b73ce3a 100644
--- a/third_party/pkg/angular/test/core/core_directive_spec.dart
+++ b/third_party/pkg/angular/test/core/core_directive_spec.dart
@@ -1,121 +1,87 @@
library core_directive_spec;
import '../_specs.dart';
-import 'package:angular/application_factory.dart';
-void main() {
- describe('DirectiveMap', () {
-
- beforeEachModule((Module module) {
- module..type(AnnotatedIoComponent);
- });
-
- it('should extract attr map from annotated component', (DirectiveMap directives) {
- var annotations = directives.annotationsFor(AnnotatedIoComponent);
- expect(annotations.length).toEqual(1);
- expect(annotations[0] is Component).toBeTruthy();
-
- Component annotation = annotations[0];
- expect(annotation.selector).toEqual('annotated-io');
- expect(annotation.visibility).toEqual(Directive.LOCAL_VISIBILITY);
- expect(annotation.exportExpressions).toEqual(['exportExpressions']);
- expect(annotation.module).toEqual(AnnotatedIoComponent.module);
- expect(annotation.template).toEqual('template');
- expect(annotation.templateUrl).toEqual('templateUrl');
- expect(annotation.cssUrls).toEqual(['cssUrls']);
- expect(annotation.publishAs).toEqual('ctrl');
- expect(annotation.map).toEqual({
- 'foo': '=>foo',
- 'attr': '@attr',
- 'expr': '<=>expr',
- 'expr-one-way': '=>exprOneWay',
- 'expr-one-way-one-shot': '=>!exprOneWayOneShot',
- 'callback': '&callback',
- 'expr-one-way2': '=>exprOneWay2',
- 'expr-two-way': '<=>exprTwoWay'
- });
+main() => describe('DirectiveMap', () {
+
+ beforeEach(module((Module module) {
+ module..type(AnnotatedIoComponent);
+ }));
+
+ it('should extract attr map from annotated component', inject((DirectiveMap directives) {
+ var annotations = directives.annotationsFor(AnnotatedIoComponent);
+ expect(annotations.length).toEqual(1);
+ expect(annotations[0] is NgComponent).toBeTruthy();
+
+ NgComponent annotation = annotations[0];
+ expect(annotation.selector).toEqual('annotated-io');
+ expect(annotation.visibility).toEqual(NgDirective.LOCAL_VISIBILITY);
+ expect(annotation.exportExpressions).toEqual(['exportExpressions']);
+ expect(annotation.publishTypes).toEqual([String]);
+ expect(annotation.template).toEqual('template');
+ expect(annotation.templateUrl).toEqual('templateUrl');
+ expect(annotation.cssUrls).toEqual(['cssUrls']);
+ expect(annotation.applyAuthorStyles).toEqual(true);
+ expect(annotation.resetStyleInheritance).toEqual(true);
+ expect(annotation.publishAs).toEqual('ctrl');
+ expect(annotation.map).toEqual({
+ 'foo': '=>foo',
+ 'attr': '@attr',
+ 'expr': '<=>expr',
+ 'expr-one-way': '=>exprOneWay',
+ 'expr-one-way-one-shot': '=>!exprOneWayOneShot',
+ 'callback': '&callback',
+ 'expr-one-way2': '=>exprOneWay2',
+ 'expr-two-way': '<=>exprTwoWay'
});
+ }));
- describe('exceptions', () {
- var baseModule;
- beforeEach(() {
- baseModule = new Module()
+ describe('exceptions', () {
+ it('should throw when annotation is for existing mapping', () {
+ var module = new Module()
..type(DirectiveMap)
- ..type(DirectiveSelectorFactory)
- ..type(MetadataExtractor);
- });
-
- it('should throw when annotation is for existing mapping', () {
- var module = new Module()
- ..type(Bad1Component);
-
- var injector = applicationFactory().addModule(module).createInjector();
- expect(() {
- injector.get(DirectiveMap);
- }).toThrow('Mapping for attribute foo is already defined (while '
- 'processing annottation for field foo of Bad1Component)');
- });
-
- it('should throw when annotated both getter and setter', () {
- var module = new Module()
- ..type(Bad2Component);
-
- var injector = applicationFactory().addModule(module).createInjector();
- expect(() {
- injector.get(DirectiveMap);
- }).toThrow('Attribute annotation for foo is defined more than once '
- 'in Bad2Component');
- });
+ ..type(Bad1Component)
+ ..type(MetadataExtractor)
+ ..type(FieldMetadataExtractor);
+
+ var injector = new DynamicInjector(modules: [module]);
+ expect(() {
+ injector.get(DirectiveMap);
+ }).toThrow('Mapping for attribute foo is already defined (while '
+ 'processing annottation for field foo of Bad1Component)');
});
- describe("Inheritance", () {
- var element;
- var nodeAttrs;
-
- beforeEachModule((Module module) {
- module..type(Sub)..type(Base);
- });
-
- it("should extract attr map from annotated component which inherits other component", (DirectiveMap directives) {
- var annotations = directives.annotationsFor(Sub);
- expect(annotations.length).toEqual(1);
- expect(annotations[0] is Directive).toBeTruthy();
-
- Directive annotation = annotations[0];
- expect(annotation.selector).toEqual('[sub]');
- expect(annotation.map).toEqual({
- "foo": "=>foo",
- "bar": "=>bar",
- "baz": "=>baz"
- });
- });
+ it('should throw when annotated both getter and setter', () {
+ var module = new Module()
+ ..type(DirectiveMap)
+ ..type(Bad2Component)
+ ..type(MetadataExtractor)
+ ..type(FieldMetadataExtractor);
+
+ var injector = new DynamicInjector(modules: [module]);
+ expect(() {
+ injector.get(DirectiveMap);
+ }).toThrow('Attribute annotation for foo is defined more than once '
+ 'in Bad2Component');
});
});
-}
-
-class NullParser implements Parser {
- call(x) {
- throw "NullParser";
- }
-}
+});
-@Component(
+@NgComponent(
selector: 'annotated-io',
template: 'template',
templateUrl: 'templateUrl',
cssUrl: const ['cssUrls'],
+ applyAuthorStyles: true,
+ resetStyleInheritance: true,
publishAs: 'ctrl',
- module: AnnotatedIoComponent.module,
- visibility: Directive.LOCAL_VISIBILITY,
+ publishTypes: const [String],
+ visibility: NgDirective.LOCAL_VISIBILITY,
exportExpressions: const ['exportExpressions'],
map: const {
'foo': '=>foo'
})
class AnnotatedIoComponent {
- static module() => new Module()..factory(String,
- (i) => i.get(AnnotatedIoComponent),
- visibility: Directive.LOCAL_VISIBILITY);
-
AnnotatedIoComponent(Scope scope) {
scope.rootScope.context['ioComponent'] = this;
}
@@ -143,7 +109,7 @@ class AnnotatedIoComponent {
set exprTwoWay(val) {}
}
-@Component(
+@NgComponent(
selector: 'bad1',
template: r'<content></content>',
map: const {
@@ -154,7 +120,7 @@ class Bad1Component {
String foo;
}
-@Component(
+@NgComponent(
selector: 'bad2',
template: r'<content></content>')
class Bad2Component {
@@ -164,18 +130,3 @@ class Bad2Component {
@NgOneWay('foo')
set foo(val) {}
}
-
-@Decorator(selector: '[sub]')
-class Sub extends Base {
- @NgOneWay('bar')
- String bar;
-}
-
-class Base {
- @NgOneWay('baz')
- String baz;
-
- @NgOneWay('foo')
- String foo;
-}
-
« no previous file with comments | « third_party/pkg/angular/test/core/cache_spec.dart ('k') | third_party/pkg/angular/test/core/interpolate_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698