From b9a65ab422ff13f7b15d70780ae04209503bf50c Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Tue, 28 Jun 2016 06:56:08 -0700 Subject: [PATCH] docs(guide/lifecycle-hooks): follow-up to #1654 Mainly Dart-side review, following #1654: - Updates to follow style guide - Enabled e2e tests - Fixes to ensure tests pass: in after_view_component.dart and after_content_component.dart - Changed test over comment field in template to be: *ngIf="comment.isNotEmpty" - Suites passed: public/docs/_examples/lifecycle-hooks/dart public/docs/_examples/lifecycle-hooks/ts --- .../docs/_examples/lifecycle-hooks/dart/example-config.json | 0 .../lifecycle-hooks/dart/lib/after_content_component.dart | 2 +- .../lifecycle-hooks/dart/lib/after_view_component.dart | 6 +++--- .../lifecycle-hooks/dart/lib/counter_component.dart | 6 +++--- .../_examples/lifecycle-hooks/dart/lib/spy_component.dart | 4 ++-- .../_examples/lifecycle-hooks/dart/lib/spy_directive.dart | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 public/docs/_examples/lifecycle-hooks/dart/example-config.json diff --git a/public/docs/_examples/lifecycle-hooks/dart/example-config.json b/public/docs/_examples/lifecycle-hooks/dart/example-config.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/public/docs/_examples/lifecycle-hooks/dart/lib/after_content_component.dart b/public/docs/_examples/lifecycle-hooks/dart/lib/after_content_component.dart index 4e11dc702b..c43ea4de73 100644 --- a/public/docs/_examples/lifecycle-hooks/dart/lib/after_content_component.dart +++ b/public/docs/_examples/lifecycle-hooks/dart/lib/after_content_component.dart @@ -20,7 +20,7 @@ class ChildComponent {
-- projected content begins --
-- projected content ends --
-

{{comment}}

+

{{comment}}

''' // #enddocregion template ) diff --git a/public/docs/_examples/lifecycle-hooks/dart/lib/after_view_component.dart b/public/docs/_examples/lifecycle-hooks/dart/lib/after_view_component.dart index 308e36d9cd..c405c874ac 100644 --- a/public/docs/_examples/lifecycle-hooks/dart/lib/after_view_component.dart +++ b/public/docs/_examples/lifecycle-hooks/dart/lib/after_view_component.dart @@ -22,16 +22,16 @@ class ChildViewComponent {
-- child view begins --
-- child view ends --
-

{{comment}}

''', +

{{comment}}

''', // #enddocregion template directives: const [ChildViewComponent]) // #docregion hooks class AfterViewComponent implements AfterViewChecked, AfterViewInit { var _prevHero = ''; - + // Query for a VIEW child of type `ChildViewComponent` @ViewChild(ChildViewComponent) ChildViewComponent viewChild; - + // #enddocregion hooks final LoggerService _logger; diff --git a/public/docs/_examples/lifecycle-hooks/dart/lib/counter_component.dart b/public/docs/_examples/lifecycle-hooks/dart/lib/counter_component.dart index 65ae6d00f6..6434b9f8b5 100644 --- a/public/docs/_examples/lifecycle-hooks/dart/lib/counter_component.dart +++ b/public/docs/_examples/lifecycle-hooks/dart/lib/counter_component.dart @@ -17,8 +17,8 @@ import 'spy_directive.dart'; styles: const [ '.counter {background: LightYellow; padding: 8px; margin-top: 8px}' ], - directives: const [Spy]) -class MyCounter implements OnChanges { + directives: const [SpyDirective]) +class MyCounterComponent implements OnChanges { @Input() num counter; List changeLog = []; @@ -53,7 +53,7 @@ class MyCounter implements OnChanges { ''', styles: const ['.parent {background: gold;}'], - directives: const [MyCounter], + directives: const [MyCounterComponent], providers: const [LoggerService]) class CounterParentComponent { final LoggerService _logger; diff --git a/public/docs/_examples/lifecycle-hooks/dart/lib/spy_component.dart b/public/docs/_examples/lifecycle-hooks/dart/lib/spy_component.dart index 815c8441d1..8006c39a14 100644 --- a/public/docs/_examples/lifecycle-hooks/dart/lib/spy_component.dart +++ b/public/docs/_examples/lifecycle-hooks/dart/lib/spy_component.dart @@ -11,7 +11,7 @@ import 'spy_directive.dart'; '.parent {background: khaki}', '.heroes {background: LightYellow; padding: 0 8px}' ], - directives: const [Spy], + directives: const [SpyDirective], providers: const [LoggerService]) class SpyParentComponent { final LoggerService _logger; @@ -31,7 +31,7 @@ class SpyParentComponent { } // removeHero(String hero) { } is not used. - + void reset() { _logger.log('-- reset --'); heroes.clear(); diff --git a/public/docs/_examples/lifecycle-hooks/dart/lib/spy_directive.dart b/public/docs/_examples/lifecycle-hooks/dart/lib/spy_directive.dart index 42db9f591a..c8656eceba 100644 --- a/public/docs/_examples/lifecycle-hooks/dart/lib/spy_directive.dart +++ b/public/docs/_examples/lifecycle-hooks/dart/lib/spy_directive.dart @@ -9,10 +9,10 @@ int _nextId = 1; // Spy on any element to which it is applied. // Usage:
...
@Directive(selector: '[mySpy]') -class Spy implements OnInit, OnDestroy { +class SpyDirective implements OnInit, OnDestroy { final LoggerService _logger; - Spy(this._logger); + SpyDirective(this._logger); ngOnInit() => _logIt('onInit');