Skip to content

Commit

Permalink
fix(Step): step-item param of labelPlacement change update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zobor committed Mar 7, 2019
1 parent f52c5c2 commit f0939af
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/step/view/step-item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ class StepItem extends Component {
width: '',
[pos]: '',
});
} else if (
shape === 'circle' &&
(labelPlacement === 'horizontal' || labelPlacement === 'hoz') &&
index !== total - 1
) {
// 调整横向Content
this.adjustTail();
if (
shape === 'circle' &&
(labelPlacement === 'horizontal' || labelPlacement === 'hoz') &&
index !== total - 1
) {
// 调整横向Content
this.adjustTail();
}
} else if (index !== total - 1) {
dom.setStyle(this.tail, {
width: '',
Expand Down
10 changes: 9 additions & 1 deletion test/step/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,15 @@ describe('Step', () => {
);

assert(wrapper.find('.next-step-label-vertical').length === 1);
wrapper.setProps({ labelPlacement: 'horizontal' });
wrapper.setProps({ labelPlacement: 'horizontal' }, () => {
// 横向模式下会调整 next-step-item-tail 的宽度值
const $tail = wrapper.find('.next-step-item-tail');
assert(
$tail.length === 3 &&
$tail.at(0).instance().style.width !== "" &&
$tail.at(2).instance().style.width === ""
);
});
assert(wrapper.find('.next-step-label-horizontal').length === 1);
});

Expand Down

0 comments on commit f0939af

Please sign in to comment.