Skip to content

Commit

Permalink
fix: 修复 FormImageUpload on remove 不生效的问题 (#842)
Browse files Browse the repository at this point in the history
Co-authored-by: DiamondYuan <fandi.yfd@antgroup.com>
  • Loading branch information
DiamondYuan and DiamondYuan committed Sep 25, 2023
1 parent d6997bf commit 91c2e44
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/Form/FormImageUpload/__tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { getInstance } from '../../../../tests/utils';
import { describe, it, expect } from 'vitest';

describe('badge overCount', () => {
it('badge overCount true', () => {
const instance = getInstance('Form/FormImageUpload', {
onRemove: () => {
return false;
},
});

expect(instance.callMethod('onRemove')).toBe(false);
});
});
5 changes: 2 additions & 3 deletions src/Form/FormImageUpload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ createComponent({
},
onRemove(file) {
if (this.props.onRemove) {
this.props.onRemove(file);
return this.props.onRemove(file);
}
},
onPreview(file) {
Expand All @@ -36,6 +36,5 @@ createComponent({
this.props.onChooseImageError(err);
}
},
}
},
});

0 comments on commit 91c2e44

Please sign in to comment.