Skip to content

Commit

Permalink
test: try to increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ex90rts committed Oct 18, 2017
1 parent 50b9667 commit 3e59e85
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
16 changes: 2 additions & 14 deletions src/Steps.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ class Steps extends React.Component {
}

const $dom = this.root;
if (!$dom || !$dom.children) {
return;
}

const len = $dom.children.length;
this.itemsWidth = new Array(len);

Expand Down Expand Up @@ -92,10 +88,6 @@ class Steps extends React.Component {

this.resize();
const $dom = this.root;
if (!$dom || !$dom.children) {
return;
}

const len = $dom.children.length - 1;

/*
Expand All @@ -122,12 +114,12 @@ class Steps extends React.Component {
}

resize() {
this.fixLastDetailHeight();

if (!this.root) {
return;
}

this.fixLastDetailHeight();

const w = Math.floor(this.root.offsetWidth);
if (this.previousStepsWidth === w) {
return;
Expand All @@ -146,10 +138,6 @@ class Steps extends React.Component {
}

const $dom = this.root;
if (!$dom || !$dom.children) {
return;
}

const len = $dom.children.length - 1;
const $domLastDetail = $dom.children[len];
if (this.props.currentDetail === len && $dom.offsetHeight <= $domLastDetail.offsetHeight) {
Expand Down
6 changes: 3 additions & 3 deletions tests/Step.spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable react/jsx-filename-extension */

import expect from 'expect.js';
import Enzyme, { mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
Expand All @@ -7,7 +9,6 @@ import Step from '../src/Step';

Enzyme.configure({ adapter: new Adapter() });

/* eslint-disable */
const generateStep = (status, title, desc, icon, options, type = 'default') => {
const wrapper = mount(
<Step
Expand All @@ -21,11 +22,10 @@ const generateStep = (status, title, desc, icon, options, type = 'default') => {
maxDescriptionWidth={200}
stepNumber={2}
{...options}
/>
/>,
);
return wrapper;
};
/* eslint-enable */

describe('Step', () => {
describe('status prop', () => {
Expand Down
6 changes: 4 additions & 2 deletions tests/Steps.spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable react/jsx-filename-extension */

import expect from 'expect.js';
import Enzyme, { mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
Expand All @@ -24,10 +26,10 @@ const generateSteps = (options = {}) => {
{...opts}
>
{items}
</Steps>
</Steps>,
);
return wrapper;
}
};

describe('Steps', () => {
describe('Initial Instance', () => {
Expand Down

0 comments on commit 3e59e85

Please sign in to comment.