Skip to content

Commit

Permalink
modify test to improve codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
Wendell committed Oct 4, 2018
1 parent 3f366e8 commit 69fdc33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions components/cascader/nz-cascader.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
TemplateRef,
ViewChild
} from '@angular/core';
import { cp } from '@angular/core/src/render3';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';

import { BACKSPACE, DOWN_ARROW, ENTER, ESCAPE, LEFT_ARROW, RIGHT_ARROW, UP_ARROW } from '@angular/cdk/keycodes';
Expand Down Expand Up @@ -1206,7 +1205,7 @@ export class NzCascaderComponent implements OnInit, OnDestroy, ControlValueAcces
const defaultFilter = (inputValue: string, p: CascaderOption[]): boolean => {
let flag = false;
p.forEach(n => {
const labelName = this.nzLabelProperty || 'label';
const labelName = this.nzLabelProperty;
if (n[ labelName ] && n[ labelName ].indexOf(inputValue) > -1) {
flag = true;
}
Expand Down Expand Up @@ -1246,7 +1245,7 @@ export class NzCascaderComponent implements OnInit, OnDestroy, ControlValueAcces
disabled,
isLeaf : true,
path : cPath,
[ this.nzLabelProperty || 'label' ]: cPath.map(p => p.label).join(' / ')
[ this.nzLabelProperty ]: cPath.map(p => p.label).join(' / ')
};
results.push(option);
}
Expand Down
2 changes: 1 addition & 1 deletion components/cascader/nz-cascader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1326,9 +1326,9 @@ describe('cascader', () => {
});
});
it('should support nzLabelProperty', (done) => {
fixture.detectChanges();
testComponent.nzShowSearch = true;
testComponent.nzLabelProperty = 'l';
fixture.detectChanges();
cascader.nativeElement.click();
fixture.detectChanges();
testComponent.cascader.inputValue = 'o';
Expand Down

0 comments on commit 69fdc33

Please sign in to comment.