Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 02e69a3

Browse files
vicbjbdeboer
authored andcommitted
test(transformer): fix
- remove usage of obsolet syntax, - re-enable the parsing of attribute annotations by adding a class level annotation. Closes #941
1 parent 8f7eff2 commit 02e69a3

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

test/tools/transformer/expression_generator_spec.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ main() {
9797
'a|web/main.dart': '''
9898
import 'package:angular/angular.dart';
9999
100-
@NgComponent(
100+
@Component(
101101
templateUrl: 'lib/foo.html',
102102
selector: 'my-component')
103103
class FooComponent extends BarComponent {

test/tools/transformer/metadata_generator_spec.dart

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ main() {
7777
String get twoWayStuff => null;
7878
}
7979
80-
@NgDirective(selector: r'[*=/{{.*}}/]')
80+
@Decorator(selector: r'[*=/{{.*}}/]')
8181
class InternalCombustionEngine extends Engine {
8282
@NgOneWay('ice-expression')
8383
String iceExpression;
@@ -91,7 +91,7 @@ main() {
9191
],
9292
classes: {
9393
'import_0.InternalCombustionEngine': [
94-
'const import_1.NgDirective(selector: r\'[*=/{{.*}}/]\', '
94+
'const import_1.Decorator(selector: r\'[*=/{{.*}}/]\', '
9595
'map: const {'
9696
'\'ice-expression\': \'=>iceExpression\', '
9797
'\'another-expression\': \'=>anotherExpression\', '
@@ -109,6 +109,7 @@ main() {
109109
'a|web/main.dart': '''
110110
import 'package:angular/angular.dart';
111111
112+
@DummyAnnotation("parse attribute annotations")
112113
class Engine {
113114
@NgCallback('callback')
114115
@NgOneWay('another-expression')
@@ -117,8 +118,17 @@ main() {
117118
main() {}
118119
'''
119120
},
121+
imports: [
122+
'import \'main.dart\' as import_0;',
123+
'import \'package:angular/angular.dart\' as import_1;',
124+
],
125+
classes: {
126+
'import_0.Engine': [
127+
'const import_1.DummyAnnotation("parse attribute annotations")',
128+
]
129+
},
120130
messages: ['warning: callback can only have one annotation. '
121-
'(web/main.dart 3 18)']);
131+
'(web/main.dart 4 18)']);
122132
});
123133

124134
it('should warn on duplicated annotations', () {
@@ -200,6 +210,7 @@ main() {
200210
'a|web/main.dart': '''
201211
import 'package:angular/angular.dart';
202212
213+
@DummyAnnotation("parse attribute annotations")
203214
class Engine {
204215
@NgCallback('callback')
205216
set callback(Function) {}
@@ -210,8 +221,17 @@ main() {
210221
main() {}
211222
'''
212223
},
224+
imports: [
225+
'import \'main.dart\' as import_0;',
226+
'import \'package:angular/angular.dart\' as import_1;',
227+
],
228+
classes: {
229+
'import_0.Engine': [
230+
'const import_1.DummyAnnotation("parse attribute annotations")',
231+
]
232+
},
213233
messages: ['warning: callback can only have one annotation. '
214-
'(web/main.dart 3 18)']);
234+
'(web/main.dart 4 18)']);
215235
});
216236

217237
it('should extract map arguments', () {
@@ -722,8 +742,9 @@ class NgCallback {
722742
}
723743
724744
class NgAttr {
725-
const NgAttr();
745+
const NgAttr(arg);
726746
}
747+
727748
class NgOneWayOneTime {
728749
const NgOneWayOneTime(arg);
729750
}

0 commit comments

Comments
 (0)