refactor(dart/transform tests): Use actual directive def'n instead of mock.

In the transformer unit tests, we previously used a mock directive annotation. This update
substitutes the actual Angular2 directive annotations.

Closes #706
This commit is contained in:
Tim Blasi
2015-02-19 10:20:38 -08:00
committed by Misko Hevery
parent 85211f0a6b
commit 329b2eda66
18 changed files with 53 additions and 91 deletions

View File

@ -1,13 +1,13 @@
library bar;
import 'package:angular2/src/core/annotations/annotations.dart';
import 'foo.dart';
import 'foo.dart' as prefix;
@Directive(context: const MyContext(contextString))
class Component2 {
final MyContext c;
@Component(selector: prefix.preDefinedSelector)
class MyComponent {
final prefix.MyContext c;
final String generatedValue;
Component2(this.c, String inValue) {
MyComponent(this.c, String inValue) {
generatedValue = 'generated ' + inValue;
}
}

View File

@ -6,12 +6,12 @@ import 'index.dart' as i3;
main() {
reflector
..registerType(i0.Component2, {
..registerType(i0.MyComponent, {
"factory":
(i1.MyContext c, String inValue) => new i0.Component2(c, inValue),
(i1.MyContext c, String inValue) => new i0.MyComponent(c, inValue),
"parameters": const [const [i1.MyContext, String]],
"annotations": const [
const i2.Directive(context: const i1.MyContext(i1.contextString))
const i2.Component(selector: i1.preDefinedSelector)
]
});
i3.main();

View File

@ -1,8 +1,8 @@
library foo;
const contextString = 'soup';
const preDefinedSelector = 'soup';
class MyContext {
final String s;
const MyContext(this.s);
final String selector;
const MyContext(this.selector);
}

View File

@ -3,5 +3,5 @@ library web_foo;
import 'bar.dart';
void main() {
new Component('Things');
new MyComponent('Things');
}