@@ -286,7 +286,6 @@ class BuildStandardAngularTest extends AbstractAngularTest {
286
286
expect (ng.elementRef, isNotNull);
287
287
expect (ng.queryList, isNotNull);
288
288
expect (ng.pipeTransform, isNotNull);
289
- expect (ng.view, isNotNull);
290
289
expect (ng.component, isNotNull);
291
290
}
292
291
@@ -2000,42 +1999,13 @@ class MyComponent {}
2000
1999
errorListener.assertNoErrors ();
2001
2000
}
2002
2001
2003
- // ignore: non_constant_identifier_names
2004
- Future test_directives_not_list_syntax_view () async {
2005
- final code = r'''
2006
- import 'package:angular2/angular2.dart';
2007
-
2008
- @Directive(selector: '[aaa]')
2009
- class DirectiveA {}
2010
-
2011
- @Directive(selector: '[bbb]')
2012
- class DirectiveB {}
2013
-
2014
- const VARIABLE = const [DirectiveA, DirectiveB];
2015
-
2016
- @Component(selector: 'my-component')
2017
- @View(template: 'My template', directives: VARIABLE)
2018
- class MyComponent {}
2019
- ''' ;
2020
- final source = newSource ('/test.dart' , code);
2021
- await getViews (source);
2022
- final view = getViewByClassName (views, 'MyComponent' );
2023
- expect (
2024
- view.directivesStrategy, const isInstanceOf <UseConstValueStrategy >());
2025
- final directiveClassNames =
2026
- view.directives.map ((directive) => directive.name).toList ();
2027
- expect (directiveClassNames, unorderedEquals (['DirectiveA' , 'DirectiveB' ]));
2028
- // no errors
2029
- errorListener.assertNoErrors ();
2030
- }
2031
-
2032
2002
// ignore: non_constant_identifier_names
2033
2003
Future test_directives_not_list_syntax_errorWithinVariable () async {
2034
2004
final code = r'''
2035
2005
import 'package:angular2/angular2.dart';
2036
2006
2037
- @Component(selector: 'my-component')
2038
- @View(template: 'My template', directives: VARIABLE)
2007
+ @Component(selector: 'my-component', template: 'My template',
2008
+ directives: VARIABLE)
2039
2009
class MyComponent {}
2040
2010
2041
2011
// A non-array is a type error in the analyzer; a non-component in an array is
@@ -2213,20 +2183,6 @@ class MyComponent {}
2213
2183
< ErrorCode > [AngularWarningCode .TYPE_IS_NOT_A_DIRECTIVE ]);
2214
2184
}
2215
2185
2216
- // ignore: non_constant_identifier_names
2217
- Future test_hasError_ComponentAnnotationMissing () async {
2218
- final source = newSource ('/test.dart' , r'''
2219
- import 'package:angular2/angular2.dart';
2220
-
2221
- @View(template: 'AAA')
2222
- class ComponentA {
2223
- }
2224
- ''' );
2225
- await getViews (source);
2226
- errorListener.assertErrorsWithCodes (
2227
- < ErrorCode > [AngularWarningCode .COMPONENT_ANNOTATION_MISSING ]);
2228
- }
2229
-
2230
2186
// ignore: non_constant_identifier_names
2231
2187
Future test_hasError_StringValueExpected () async {
2232
2188
final source = newSource ('/test.dart' , r'''
@@ -2357,33 +2313,6 @@ class MyComponent {}
2357
2313
}
2358
2314
}
2359
2315
2360
- // ignore: non_constant_identifier_names
2361
- Future test_templateExternalUsingViewAnnotation () async {
2362
- final code = r'''
2363
- import 'package:angular2/angular2.dart';
2364
-
2365
- @Component(selector: 'my-component')
2366
- @View(templateUrl: 'my-template.html')
2367
- class MyComponent {}
2368
- ''' ;
2369
- final dartSource = newSource ('/test.dart' , code);
2370
- final htmlSource = newSource ('/my-template.html' , '' );
2371
- await getViews (dartSource);
2372
- expect (views, hasLength (1 ));
2373
- // MyComponent
2374
- final view = getViewByClassName (views, 'MyComponent' );
2375
- expect (view.component, getComponentByName (directives, 'MyComponent' ));
2376
- expect (view.templateText, isNull);
2377
- expect (view.templateUriSource, isNotNull);
2378
- expect (view.templateUriSource, htmlSource);
2379
- expect (view.templateSource, htmlSource);
2380
- {
2381
- final url = "'my-template.html'" ;
2382
- expect (view.templateUrlRange,
2383
- new SourceRange (code.indexOf (url), url.length));
2384
- }
2385
- }
2386
-
2387
2316
// ignore: non_constant_identifier_names
2388
2317
Future test_templateInline () async {
2389
2318
final code = r'''
@@ -2419,42 +2348,6 @@ class MyComponent {}
2419
2348
}
2420
2349
}
2421
2350
2422
- // ignore: non_constant_identifier_names
2423
- Future test_templateInlineUsingViewAnnotation () async {
2424
- final code = r'''
2425
- import 'package:angular2/angular2.dart';
2426
-
2427
- @Directive(selector: 'my-directive')
2428
- class MyDirective {}
2429
-
2430
- @Component(selector: 'other-component')
2431
- @View(template: 'Other template')
2432
- class OtherComponent {}
2433
-
2434
- @Component(selector: 'my-component')
2435
- @View(template: 'My template', directives: const [MyDirective, OtherComponent])
2436
- class MyComponent {}
2437
- ''' ;
2438
- final source = newSource ('/test.dart' , code);
2439
- await getViews (source);
2440
- expect (views, hasLength (2 ));
2441
- {
2442
- final view = getViewByClassName (views, 'MyComponent' );
2443
- expect (view.component, getComponentByName (directives, 'MyComponent' ));
2444
- expect (view.templateText, ' My template ' ); // spaces preserve offsets
2445
- expect (view.templateOffset, code.indexOf ('My template' ) - 1 );
2446
- expect (view.templateUriSource, isNull);
2447
- expect (view.templateSource, source);
2448
- {
2449
- expect (view.directives, hasLength (2 ));
2450
- final directiveClassNames =
2451
- view.directives.map ((directive) => directive.name).toList ();
2452
- expect (directiveClassNames,
2453
- unorderedEquals (['OtherComponent' , 'MyDirective' ]));
2454
- }
2455
- }
2456
- }
2457
-
2458
2351
// ignore: non_constant_identifier_names
2459
2352
Future test_useFunctionalDirective () async {
2460
2353
final code = r'''
0 commit comments