mirror of https://github.com/ElemeFE/element
parent
d26809cb35
commit
d1255684d4
|
@ -173,6 +173,10 @@ export default {
|
|||
mounted() {
|
||||
const unwatch = this.$watch('index', val => {
|
||||
this.$watch('$parent.active', this.updateStatus, { immediate: true });
|
||||
this.$watch('$parent.processStatus', () => {
|
||||
const activeIndex = this.$parent.active;
|
||||
this.updateStatus(activeIndex);
|
||||
}, { immediate: true });
|
||||
unwatch();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -59,6 +59,29 @@ describe('Steps', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('update processStatus', done => {
|
||||
vm = createVue({
|
||||
template: `
|
||||
<el-steps :active="1" :process-status="processStatus">
|
||||
<el-step title="abc"></el-step>
|
||||
<el-step title="abc2"></el-step>
|
||||
</el-steps>
|
||||
`,
|
||||
data() {
|
||||
return { processStatus: 'error' };
|
||||
}
|
||||
});
|
||||
|
||||
vm.$nextTick(_ => {
|
||||
expect(vm.$el.querySelectorAll('.el-step__head.is-error')).to.length(1);
|
||||
vm.processStatus = 'process';
|
||||
vm.$nextTick(_ => {
|
||||
expect(vm.$el.querySelectorAll('.el-step__head.is-process')).to.length(1);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('finishStatus', done => {
|
||||
vm = createVue(`
|
||||
<el-steps :active="1" finish-status="error">
|
||||
|
|
Loading…
Reference in New Issue