Skip to content

Commit

Permalink
#64 Jest compatible with babel7.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 1, 2018
1 parent c82e753 commit 03b145c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,17 @@
"@babel/preset-react": "^7.0.0",
"@nuxtjs/friendly-errors-webpack-plugin": "^2.0.2",
"autoprefixer": "^9.1.3",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^8.2.3",
"babel-jest": "^23.0.1",
"babel-jest": "^23.4.2",
"babel-loader": "^8.0.0-beta.6",
"babel-standalone": "^6.26.0",
"bundle-loader": "^0.5.6",
"colors-cli": "^1.0.9",
"css-loader": "^0.28.11",
"detect-port": "^1.2.2",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"enzyme": "^3.5.0",
"enzyme-adapter-react-16": "^1.3.1",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-loader": "^2.0.0",
Expand All @@ -85,7 +86,7 @@
"html-webpack-plugin": "^3.2.0",
"husky": "0.14.3",
"identity-obj-proxy": "3.0.0",
"jest": "^23.1.0",
"jest": "^23.5.0",
"less": "^3.0.2",
"less-loader": "^4.1.0",
"lint-staged": "^5.0.0",
Expand All @@ -112,10 +113,10 @@
"stylelint-config-standard": "^17.0.0",
"uglifyjs-webpack-plugin": "^1.2.5",
"url-loader": "^1.0.1",
"webpack": "^4.10.1",
"webpack-cli": "^2.1.4",
"webpack-dev-server": "^3.1.4",
"webpack-hot-dev-clients": "^1.0.4"
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.7",
"webpack-hot-dev-clients": "^1.0.6"
},
"lint-staged": {
"*.js": "lint-staged:js",
Expand Down
11 changes: 7 additions & 4 deletions src/steps/__test__/Steps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ describe('<Steps>', () => {
expect(wrapper.at(0).prop('status')).toBe('process');
expect(wrapper.at(0).prop('direction')).toBe('horizontal');
expect(wrapper.at(0).prop('current')).toBe(1);
expect(wrapper.at(0).find('.w-steps-item .w-steps-item-process').html()).toContain('<div class="w-steps-item w-steps-item-process" style="width: 33.333333333333336%; margin-right: -1px;"><div class="w-steps-item-tail"><i></i></div><div class="w-steps-item-head"><div class="w-steps-item-inner"><span class="w-steps-icon">2</span></div></div><div class="w-steps-item-main"><div class="w-steps-item-title">步骤二</div><div class="w-steps-item-description">这里是步骤二的说明,可以很长很长哦。</div></div></div>');
expect(wrapper.find('.w-steps-item').at(0).prop('className')).toBe('w-steps-item w-steps-item-finish');
expect(wrapper.find('.w-steps-item').at(1).prop('className')).toBe('w-steps-item w-steps-item-process');
expect(wrapper.find('.w-steps-item').at(2).prop('className')).toBe('w-steps-item w-steps-item-wait');
expect(wrapper.find('.w-steps-item').at(3).prop('className')).toBe('w-steps-item w-steps-item-wait');
});

it('Test current attributes', () => {
wrapper.setProps({ current: 2 });
expect(wrapper.at(0).find('.w-steps-item .w-steps-item-process').html()).toContain('<div class="w-steps-item w-steps-item-process" style="width: 33.333333333333336%; margin-right: -1px;"><div class="w-steps-item-tail"><i></i></div><div class="w-steps-item-head"><div class="w-steps-item-inner"><span class="w-steps-icon">3</span></div></div><div class="w-steps-item-main"><div class="w-steps-item-title">步骤三</div><div class="w-steps-item-description">这里是步骤三的说明,可以很长很长哦。</div></div></div>');
it('Test current attributes', async () => {
await wrapper.setProps({ current: 2 });
expect(wrapper.find('.w-steps-item-process').at(0).prop('className')).toBe('w-steps-item w-steps-item-process');
});

it('Test status attributes', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/mock.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = 'test-file-stub';
module.exports = 'test-file-stub';

0 comments on commit 03b145c

Please sign in to comment.