Skip to content

Commit f0939af

Browse files
committed
fix(Step): step-item param of labelPlacement change update bug
1 parent f52c5c2 commit f0939af

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/step/view/step-item.jsx

+8-7
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,14 @@ class StepItem extends Component {
117117
width: '',
118118
[pos]: '',
119119
});
120-
} else if (
121-
shape === 'circle' &&
122-
(labelPlacement === 'horizontal' || labelPlacement === 'hoz') &&
123-
index !== total - 1
124-
) {
125-
// 调整横向Content
126-
this.adjustTail();
120+
if (
121+
shape === 'circle' &&
122+
(labelPlacement === 'horizontal' || labelPlacement === 'hoz') &&
123+
index !== total - 1
124+
) {
125+
// 调整横向Content
126+
this.adjustTail();
127+
}
127128
} else if (index !== total - 1) {
128129
dom.setStyle(this.tail, {
129130
width: '',

test/step/index-spec.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,15 @@ describe('Step', () => {
273273
);
274274

275275
assert(wrapper.find('.next-step-label-vertical').length === 1);
276-
wrapper.setProps({ labelPlacement: 'horizontal' });
276+
wrapper.setProps({ labelPlacement: 'horizontal' }, () => {
277+
// 横向模式下会调整 next-step-item-tail 的宽度值
278+
const $tail = wrapper.find('.next-step-item-tail');
279+
assert(
280+
$tail.length === 3 &&
281+
$tail.at(0).instance().style.width !== "" &&
282+
$tail.at(2).instance().style.width === ""
283+
);
284+
});
277285
assert(wrapper.find('.next-step-label-horizontal').length === 1);
278286
});
279287

0 commit comments

Comments
 (0)