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:
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -3,5 +3,5 @@ library web_foo;
|
||||
import 'bar.dart';
|
||||
|
||||
void main() {
|
||||
new Component('Things');
|
||||
new MyComponent('Things');
|
||||
}
|
||||
|
Reference in New Issue
Block a user