From b188a21ee856cec3d3a4f6b4c2a29fa310f49712 Mon Sep 17 00:00:00 2001 From: pengchongfu Date: Tue, 27 Mar 2018 15:12:47 +0800 Subject: [PATCH] fix(transition-group): ensure remove class v-enter-to after it was added --- .../runtime/components/transition-group.js | 3 ++- .../transition/transition-group.spec.js | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/platforms/web/runtime/components/transition-group.js b/src/platforms/web/runtime/components/transition-group.js index 81d033d5ad5..c0ea78846f8 100644 --- a/src/platforms/web/runtime/components/transition-group.js +++ b/src/platforms/web/runtime/components/transition-group.js @@ -16,6 +16,7 @@ import { addClass, removeClass } from '../class-util' import { transitionProps, extractTransitionData } from './transition' import { + nextFrame, hasTransition, getTransitionInfo, transitionEndEvent, @@ -162,7 +163,7 @@ function callPendingCbs (c: VNode) { } /* istanbul ignore if */ if (c.elm._enterCb) { - c.elm._enterCb() + nextFrame(c.elm._enterCb) } } diff --git a/test/unit/features/transition/transition-group.spec.js b/test/unit/features/transition/transition-group.spec.js index 2988d5bff4a..453c4d17a9d 100644 --- a/test/unit/features/transition/transition-group.spec.js +++ b/test/unit/features/transition/transition-group.spec.js @@ -340,5 +340,29 @@ if (!isIE9) { ) }).then(done) }) + + it('should remove class v-enter-to', done => { + const vm = new Vue({ + template: ` +
+ +
foo
+
+
+ `, + data: { ok: false } + }).$mount(el) + + vm.ok = true + waitForUpdate(() => { + vm.$forceUpdate() + }).thenWaitFor(duration + buffer).then(() => { + expect(vm.$el.innerHTML).toBe( + `` + + `
foo
` + + `
` + ) + }).then(done) + }) }) }