Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit aff39d2

Browse files
authored
fix(cb-component-comm): check for isFirstChange (#3073)
* fix(cb-component-comm): check for isFirstChange * update initial message
1 parent aa6f503 commit aff39d2

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

public/docs/_examples/cb-component-communication/e2e-spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict'; // necessary for es6 output in node
1+
'use strict'; // necessary for es6 output in node
22

33
import { browser, element, by } from 'protractor';
44

@@ -65,7 +65,7 @@ describe('Component Communication Cookbook Tests', function () {
6565
let actual = getActual();
6666

6767
let initialLabel = 'Version 1.23';
68-
let initialLog = 'major changed from {} to 1, minor changed from {} to 23';
68+
let initialLog = 'Initial value of major set to 1, Initial value of minor set to 23';
6969

7070
expect(actual.label).toBe(initialLabel);
7171
expect(actual.count).toBe(1);

public/docs/_examples/cb-component-communication/ts/app/version-child.component.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ export class VersionChildComponent implements OnChanges {
2121
let log: string[] = [];
2222
for (let propName in changes) {
2323
let changedProp = changes[propName];
24-
let from = JSON.stringify(changedProp.previousValue);
25-
let to = JSON.stringify(changedProp.currentValue);
26-
log.push( `${propName} changed from ${from} to ${to}`);
24+
let to = JSON.stringify(changedProp.currentValue);
25+
if (changedProp.isFirstChange()) {
26+
log.push(`Initial value of ${propName} set to ${to}`);
27+
} else {
28+
let from = JSON.stringify(changedProp.previousValue);
29+
log.push(`${propName} changed from ${from} to ${to}`);
30+
}
2731
}
2832
this.changeLog.push(log.join(', '));
2933
}
Loading

0 commit comments

Comments
 (0)