Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(module:upload): fix missing remove event when type is drag #3114

Merged
merged 11 commits into from
Mar 27, 2019
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