fix(cb-component-comm): check for isFirstChange (#3073)
* fix(cb-component-comm): check for isFirstChange * update initial message
This commit is contained in:
parent
aa6f503331
commit
aff39d20a9
|
@ -65,7 +65,7 @@ describe('Component Communication Cookbook Tests', function () {
|
||||||
let actual = getActual();
|
let actual = getActual();
|
||||||
|
|
||||||
let initialLabel = 'Version 1.23';
|
let initialLabel = 'Version 1.23';
|
||||||
let initialLog = 'major changed from {} to 1, minor changed from {} to 23';
|
let initialLog = 'Initial value of major set to 1, Initial value of minor set to 23';
|
||||||
|
|
||||||
expect(actual.label).toBe(initialLabel);
|
expect(actual.label).toBe(initialLabel);
|
||||||
expect(actual.count).toBe(1);
|
expect(actual.count).toBe(1);
|
||||||
|
|
|
@ -21,9 +21,13 @@ export class VersionChildComponent implements OnChanges {
|
||||||
let log: string[] = [];
|
let log: string[] = [];
|
||||||
for (let propName in changes) {
|
for (let propName in changes) {
|
||||||
let changedProp = changes[propName];
|
let changedProp = changes[propName];
|
||||||
let from = JSON.stringify(changedProp.previousValue);
|
let to = JSON.stringify(changedProp.currentValue);
|
||||||
let to = JSON.stringify(changedProp.currentValue);
|
if (changedProp.isFirstChange()) {
|
||||||
log.push( `${propName} changed from ${from} to ${to}`);
|
log.push(`Initial value of ${propName} set to ${to}`);
|
||||||
|
} else {
|
||||||
|
let from = JSON.stringify(changedProp.previousValue);
|
||||||
|
log.push(`${propName} changed from ${from} to ${to}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.changeLog.push(log.join(', '));
|
this.changeLog.push(log.join(', '));
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 43 KiB |
Loading…
Reference in New Issue