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

Commit

Permalink
test(transformer): fix
Browse files Browse the repository at this point in the history
- remove usage of obsolet syntax,
- re-enable the parsing of attribute annotations by adding a class level annotation.

Closes #941
  • Loading branch information
vicb authored and travis@travis-ci.org committed Apr 23, 2014
1 parent 133d896 commit 9dacfa6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion test/tools/transformer/expression_generator_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ main() {
'a|web/main.dart': '''
import 'package:angular/angular.dart';
@NgComponent(
@Component(
templateUrl: 'lib/foo.html',
selector: 'my-component')
class FooComponent extends BarComponent {
Expand Down
31 changes: 26 additions & 5 deletions test/tools/transformer/metadata_generator_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ main() {
String get twoWayStuff => null;
}
@NgDirective(selector: r'[*=/{{.*}}/]')
@Decorator(selector: r'[*=/{{.*}}/]')
class InternalCombustionEngine extends Engine {
@NgOneWay('ice-expression')
String iceExpression;
Expand All @@ -91,7 +91,7 @@ main() {
],
classes: {
'import_0.InternalCombustionEngine': [
'const import_1.NgDirective(selector: r\'[*=/{{.*}}/]\', '
'const import_1.Decorator(selector: r\'[*=/{{.*}}/]\', '
'map: const {'
'\'ice-expression\': \'=>iceExpression\', '
'\'another-expression\': \'=>anotherExpression\', '
Expand All @@ -109,6 +109,7 @@ main() {
'a|web/main.dart': '''
import 'package:angular/angular.dart';
@DummyAnnotation("parse attribute annotations")
class Engine {
@NgCallback('callback')
@NgOneWay('another-expression')
Expand All @@ -117,8 +118,17 @@ main() {
main() {}
'''
},
imports: [
'import \'main.dart\' as import_0;',
'import \'package:angular/angular.dart\' as import_1;',
],
classes: {
'import_0.Engine': [
'const import_1.DummyAnnotation("parse attribute annotations")',
]
},
messages: ['warning: callback can only have one annotation. '
'(web/main.dart 3 18)']);
'(web/main.dart 4 18)']);
});

it('should warn on duplicated annotations', () {
Expand Down Expand Up @@ -200,6 +210,7 @@ main() {
'a|web/main.dart': '''
import 'package:angular/angular.dart';
@DummyAnnotation("parse attribute annotations")
class Engine {
@NgCallback('callback')
set callback(Function) {}
Expand All @@ -210,8 +221,17 @@ main() {
main() {}
'''
},
imports: [
'import \'main.dart\' as import_0;',
'import \'package:angular/angular.dart\' as import_1;',
],
classes: {
'import_0.Engine': [
'const import_1.DummyAnnotation("parse attribute annotations")',
]
},
messages: ['warning: callback can only have one annotation. '
'(web/main.dart 3 18)']);
'(web/main.dart 4 18)']);
});

it('should extract map arguments', () {
Expand Down Expand Up @@ -722,8 +742,9 @@ class NgCallback {
}
class NgAttr {
const NgAttr();
const NgAttr(arg);
}
class NgOneWayOneTime {
const NgOneWayOneTime(arg);
}
Expand Down

0 comments on commit 9dacfa6

Please sign in to comment.