Browse Source

Steps: fixes issue #14502 (#14596)

* Steps: fixes issue #14502

* Update

* f
Jeff Wen 6 years ago
parent
commit
d1255684d4
2 changed files with 27 additions and 0 deletions
  1. 4 0
      packages/steps/src/step.vue
  2. 23 0
      test/unit/specs/steps.spec.js

+ 4 - 0
packages/steps/src/step.vue

@@ -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();
     });
   }

+ 23 - 0
test/unit/specs/steps.spec.js

@@ -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">