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

Commit

Permalink
fix(cb-component-comm): check for isFirstChange (#3073)
Browse files Browse the repository at this point in the history
* fix(cb-component-comm): check for isFirstChange

* update initial message
  • Loading branch information
filipesilva authored Jan 5, 2017
1 parent aa6f503 commit aff39d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions public/docs/_examples/cb-component-communication/e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node

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

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

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.count).toBe(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ export class VersionChildComponent implements OnChanges {
let log: string[] = [];
for (let propName in changes) {
let changedProp = changes[propName];
let from = JSON.stringify(changedProp.previousValue);
let to = JSON.stringify(changedProp.currentValue);
log.push( `${propName} changed from ${from} to ${to}`);
let to = JSON.stringify(changedProp.currentValue);
if (changedProp.isFirstChange()) {
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(', '));
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit aff39d2

Please sign in to comment.