Skip to content

Commit

Permalink
Improve upload status test case (ant-design#7869)
Browse files Browse the repository at this point in the history
* Add some companies

* test: generate snapshot in upload onChange

* change action

* upgrade travis node version

* fix ci
  • Loading branch information
afc163 authored Oct 12, 2017
1 parent 2799b73 commit b77cc63
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: false
language: node_js

node_js:
- "6"
- "8"

env:
matrix:
Expand Down
74 changes: 74 additions & 0 deletions components/upload/__tests__/__snapshots__/uploadlist.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,77 @@ exports[`Upload List should be uploading when upload a file 1`] = `
</div>
</span>
`;

exports[`Upload List should be uploading when upload a file 2`] = `
<span
class=""
>
<div
class="ant-upload ant-upload-select ant-upload-select-text"
>
<span
class="ant-upload"
role="button"
tabindex="0"
>
<input
accept=""
style="display: none;"
type="file"
/>
<button>
upload
</button>
</span>
</div>
<div
class="ant-upload-list ant-upload-list-text"
>
<div
class="ant-upload-list-item ant-upload-list-item-error"
>
<div
class="ant-upload-list-item-info"
>
<span>
<i
class="anticon anticon-paper-clip"
/>
<span
class="ant-upload-list-item-name"
title="foo.png"
>
foo.png
</span>
</span>
</div>
<i
class="anticon anticon-cross"
title="删除文件"
/>
<div
class="ant-upload-list-item-progress fade-leave"
>
<div
class="ant-progress ant-progress-line ant-progress-status-normal"
>
<div>
<div
class="ant-progress-outer"
>
<div
class="ant-progress-inner"
>
<div
class="ant-progress-bg"
style="width: 0%; height: 2px;"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</span>
`;
24 changes: 19 additions & 5 deletions components/upload/__tests__/uploadlist.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,25 @@ describe('Upload List', () => {
expect(wrapper.find('.ant-upload-list-item').length).toBe(1);
});

it('should be uploading when upload a file', async () => {
const wrapper = mount(
<Upload action="http://uploadcare.com/">
it('should be uploading when upload a file', (done) => {
let wrapper;
let finished;
const onChange = ({ file }) => {
if (finished) {
done();
return;
}
if (file.status === 'uploading') {
expect(wrapper.render()).toMatchSnapshot();
}
if (file.status === 'error') {
expect(wrapper.render()).toMatchSnapshot();
finished = true;
done();
}
};
wrapper = mount(
<Upload action="http://jsonplaceholder.typicode.com/posts/" onChange={onChange}>
<button>upload</button>
</Upload>
);
Expand All @@ -73,7 +89,5 @@ describe('Upload List', () => {
],
},
});
await delay(20);
expect(wrapper.render()).toMatchSnapshot();
});
});
3 changes: 3 additions & 0 deletions docs/react/introduce.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,12 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'

- [Ant Financial](http://www.antgroup.com/index.htm?locale=en_US)
- [Alibaba](http://www.alibaba.com/)
- [Tencent](http://www.tencent.com)
- [Baidu](http://www.baidu.com)
- [Koubei](http://www.koubei.com/)
- [Meituan](http://www.meituan.com)
- [Didi](http://www.xiaojukeji.com/)
- [Eleme](https://www.ele.me/)

> If your company or product uses Ant Design, let us know [here](https://github.com/ant-design/ant-design/issues/477)!
Expand Down
3 changes: 3 additions & 0 deletions docs/react/introduce.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'

- [蚂蚁金服](http://www.antgroup.com/)
- [阿里巴巴](http://www.alibaba.com/)
- [腾讯](http://www.tencent.com)
- [百度](http://www.baidu.com)
- [口碑](http://www.koubei.com/)
- [美团](http://www.meituan.com)
- [滴滴](http://www.xiaojukeji.com/)
- [饿了么](https://www.ele.me/)

> 如果你的公司和产品使用了 Ant Design,欢迎到 [这里](https://github.com/ant-design/ant-design/issues/477) 留言。
Expand Down
3 changes: 3 additions & 0 deletions docs/spec/introduce.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ We supply a series of design principles, practical patterns and high quality des

- [Ant Financial](http://www.antgroup.com/index.htm?locale=en_US)
- [Alibaba](http://www.alibaba.com/)
- [Tencent](http://www.tencent.com)
- [Baidu](http://www.baidu.com)
- [Koubei](http://www.koubei.com/)
- [Meituan](http://www.meituan.com)
- [Didi](http://www.xiaojukeji.com/)
- [Eleme](https://www.ele.me/)

> If your company or products use Ant Design, welcome to click [here](https://github.com/ant-design/ant-design/issues/477) to leave a message.
Expand Down
3 changes: 3 additions & 0 deletions docs/spec/introduce.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ Ant Design 是一个致力于提升『用户』和『设计者』使用体验的

- [蚂蚁金服](http://www.antgroup.com/)
- [阿里巴巴](http://www.alibaba.com/)
- [腾讯](http://www.tencent.com)
- [百度](http://www.baidu.com)
- [口碑](http://www.koubei.com/)
- [美团](http://www.meituan.com)
- [滴滴](http://www.xiaojukeji.com/)
- [饿了么](https://www.ele.me/)

> 如果你的公司和产品使用了 Ant Design,欢迎到 [这里](https://github.com/ant-design/ant-design/issues/477) 留言。
Expand Down

0 comments on commit b77cc63

Please sign in to comment.