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
This commit is contained in:
parent
f06398cd89
commit
eda47f64e8
|
@ -20,7 +20,7 @@ class ChildComponent {
|
||||||
<div>-- projected content begins --</div>
|
<div>-- projected content begins --</div>
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
<div>-- projected content ends --</div>
|
<div>-- projected content ends --</div>
|
||||||
<p *ngIf="comment != null" class="comment">{{comment}}</p>
|
<p *ngIf="comment.isNotEmpty" class="comment">{{comment}}</p>
|
||||||
'''
|
'''
|
||||||
// #enddocregion template
|
// #enddocregion template
|
||||||
)
|
)
|
||||||
|
|
|
@ -22,16 +22,16 @@ class ChildViewComponent {
|
||||||
<div>-- child view begins --</div>
|
<div>-- child view begins --</div>
|
||||||
<my-child></my-child>
|
<my-child></my-child>
|
||||||
<div>-- child view ends --</div>
|
<div>-- child view ends --</div>
|
||||||
<p *ngIf="comment != null" class="comment">{{comment}}</p>''',
|
<p *ngIf="comment.isNotEmpty" class="comment">{{comment}}</p>''',
|
||||||
// #enddocregion template
|
// #enddocregion template
|
||||||
directives: const [ChildViewComponent])
|
directives: const [ChildViewComponent])
|
||||||
// #docregion hooks
|
// #docregion hooks
|
||||||
class AfterViewComponent implements AfterViewChecked, AfterViewInit {
|
class AfterViewComponent implements AfterViewChecked, AfterViewInit {
|
||||||
var _prevHero = '';
|
var _prevHero = '';
|
||||||
|
|
||||||
// Query for a VIEW child of type `ChildViewComponent`
|
// Query for a VIEW child of type `ChildViewComponent`
|
||||||
@ViewChild(ChildViewComponent) ChildViewComponent viewChild;
|
@ViewChild(ChildViewComponent) ChildViewComponent viewChild;
|
||||||
|
|
||||||
// #enddocregion hooks
|
// #enddocregion hooks
|
||||||
final LoggerService _logger;
|
final LoggerService _logger;
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ import 'spy_directive.dart';
|
||||||
styles: const [
|
styles: const [
|
||||||
'.counter {background: LightYellow; padding: 8px; margin-top: 8px}'
|
'.counter {background: LightYellow; padding: 8px; margin-top: 8px}'
|
||||||
],
|
],
|
||||||
directives: const [Spy])
|
directives: const [SpyDirective])
|
||||||
class MyCounter implements OnChanges {
|
class MyCounterComponent implements OnChanges {
|
||||||
@Input() num counter;
|
@Input() num counter;
|
||||||
List<String> changeLog = [];
|
List<String> changeLog = [];
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class MyCounter implements OnChanges {
|
||||||
</div>
|
</div>
|
||||||
''',
|
''',
|
||||||
styles: const ['.parent {background: gold;}'],
|
styles: const ['.parent {background: gold;}'],
|
||||||
directives: const [MyCounter],
|
directives: const [MyCounterComponent],
|
||||||
providers: const [LoggerService])
|
providers: const [LoggerService])
|
||||||
class CounterParentComponent {
|
class CounterParentComponent {
|
||||||
final LoggerService _logger;
|
final LoggerService _logger;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import 'spy_directive.dart';
|
||||||
'.parent {background: khaki}',
|
'.parent {background: khaki}',
|
||||||
'.heroes {background: LightYellow; padding: 0 8px}'
|
'.heroes {background: LightYellow; padding: 0 8px}'
|
||||||
],
|
],
|
||||||
directives: const [Spy],
|
directives: const [SpyDirective],
|
||||||
providers: const [LoggerService])
|
providers: const [LoggerService])
|
||||||
class SpyParentComponent {
|
class SpyParentComponent {
|
||||||
final LoggerService _logger;
|
final LoggerService _logger;
|
||||||
|
@ -31,7 +31,7 @@ class SpyParentComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
// removeHero(String hero) { } is not used.
|
// removeHero(String hero) { } is not used.
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
_logger.log('-- reset --');
|
_logger.log('-- reset --');
|
||||||
heroes.clear();
|
heroes.clear();
|
||||||
|
|
|
@ -9,10 +9,10 @@ int _nextId = 1;
|
||||||
// Spy on any element to which it is applied.
|
// Spy on any element to which it is applied.
|
||||||
// Usage: <div mySpy>...</div>
|
// Usage: <div mySpy>...</div>
|
||||||
@Directive(selector: '[mySpy]')
|
@Directive(selector: '[mySpy]')
|
||||||
class Spy implements OnInit, OnDestroy {
|
class SpyDirective implements OnInit, OnDestroy {
|
||||||
final LoggerService _logger;
|
final LoggerService _logger;
|
||||||
|
|
||||||
Spy(this._logger);
|
SpyDirective(this._logger);
|
||||||
|
|
||||||
ngOnInit() => _logIt('onInit');
|
ngOnInit() => _logIt('onInit');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue