-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
增加对文件夹上传的支持 #114
增加对文件夹上传的支持 #114
Conversation
src/traverseFileTree.js
Outdated
@@ -0,0 +1,25 @@ | |||
const traverseFileTree = (files, callback, judge) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 judge 的意思是?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为这个地方有个accept属性,过滤下不符合的文件
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以把命名修改的更语义化一点。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
或许这个变量叫做 isAccepted
会好点?
我明天看下这边单测怎么写,补一下吧 |
终于绿了( 还有点小问题,如果测试目录上传成功的话,会有报错,测试代码如下 ● uploader › directory uploader › upload success
Timeout - Async callback was not invoked within timeout specified by
jasmine.DEFAULT_TIMEOUT_INTERVAL. it('upload success', (done) => {
const input = TestUtils.findRenderedDOMComponentWithTag(uploader, 'input');
const files = {
name: 'foo',
children: [
{
name: 'foo.png',
},
],
};
handlers.onSuccess = (ret, file) => {
expect(ret[1]).to.eql(file.name);
expect(file).to.have.property('uid');
done();
};
handlers.onError = (err) => {
done(err);
};
Simulate.drop(input, { dataTransfer: { items: [makeDataTransferItem(files)] } });
setTimeout(() => {
requests[0].respond(200, {}, `["","${files[0].children[0].name}"]`);
}, 100);
}); |
This resolved ant-design/ant-design#7315 |
这边还有俩问题,
readEntries
file
这些api其实是异步回调的,很难把目录下的文件合并到一次上传中,只能一个文件传一次