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

增加对文件夹上传的支持 #114

Merged
merged 9 commits into from
May 25, 2018
Merged

增加对文件夹上传的支持 #114

merged 9 commits into from
May 25, 2018

Conversation

muzea
Copy link
Contributor

@muzea muzea commented Apr 26, 2018

这边还有俩问题,

  1. 目录上传的单测不会写
  2. readEntries file 这些api其实是异步回调的,很难把目录下的文件合并到一次上传中,只能一个文件传一次

@coveralls
Copy link

coveralls commented Apr 28, 2018

Coverage Status

Coverage increased (+3.06%) to 84.252% when pulling 01fff02 on muzea:master into ea90bdd on react-component:master.

@@ -0,0 +1,25 @@
const traverseFileTree = (files, callback, judge) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 judge 的意思是?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为这个地方有个accept属性,过滤下不符合的文件

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以把命名修改的更语义化一点。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

或许这个变量叫做 isAccepted 会好点?

@muzea
Copy link
Contributor Author

muzea commented Apr 28, 2018

我明天看下这边单测怎么写,补一下吧

@muzea
Copy link
Contributor Author

muzea commented May 1, 2018

终于绿了(

还有点小问题,如果测试目录上传成功的话,会有报错,测试代码如下

  ● 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);
    });

@afc163 afc163 merged commit 6c7c3a9 into react-component:master May 25, 2018
@afc163
Copy link
Member

afc163 commented Jun 12, 2018

This resolved ant-design/ant-design#7315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants