Skip to content

Commit

Permalink
fix(module:upload): fix missing remove event when type is drag (NG-ZO…
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored and vthinkxie committed Mar 27, 2019
1 parent 2a23a95 commit 1822a44
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/upload/nz-upload.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
(drop)="fileDrop($event)"
(dragover)="fileDrop($event)"
(dragleave)="fileDrop($event)">
<div nz-upload-btn #upload [options]="_btnOptions" [classes]="{'ant-upload-btn': true}">
<div nz-upload-btn #uploadComp [options]="_btnOptions" [classes]="{'ant-upload-btn': true}">
<div class="ant-upload-drag-container">
<ng-template [ngTemplateOutlet]="con"></ng-template>
</div>
Expand Down
27 changes: 23 additions & 4 deletions components/upload/upload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,29 @@ describe('upload', () => {
});
});

it('[nzType]', () => {
instance.nzType = 'drag';
fixture.detectChanges();
expect(pageObject.getByCss('.ant-upload-drag') != null).toBe(true);
describe('when nzType is drag', () => {
it('should working', () => {
instance.nzType = 'drag';
fixture.detectChanges();
expect(pageObject.getByCss('.ant-upload-drag') != null).toBe(true);
});

it('shoule be remove item', () => {
instance.nzType = 'drag';
instance.nzFileList = [
{
uid : 1,
name : 'xxx.png',
status : 'done',
response: 'Server Error 500', // custom error message to show
url : 'http://www.baidu.com/xxx.png'
}
] as any[];
fixture.detectChanges();
expect(instance._onRemove).toBe(false);
dl.query(By.css('.anticon-close')).nativeElement.click();
expect(instance._onRemove).toBe(true);
});
});

it('[nzShowButton]', () => {
Expand Down

0 comments on commit 1822a44

Please sign in to comment.