Jelajahi Sumber

fix move test case

Evan You 10 tahun lalu
induk
melakukan
593cf3929e

+ 1 - 0
src/platforms/web/runtime/components/transition.js

@@ -93,6 +93,7 @@ export default {
     // apply transition data to child
     // use getRealChild() to ignore abstract components e.g. keep-alive
     const child = getRealChild(rawChild)
+    /* istanbul ignore if */
     if (!child) return
     child.key = child.key || `__v${child.tag + this._uid}__`
     const data = (child.data || (child.data = {})).transition = extractTransitionData(this)

+ 4 - 4
test/unit/features/transition/transition-group.spec.js

@@ -259,7 +259,7 @@ if (!isIE9) {
 
       vm.items = ['d', 'b', 'a']
       waitForUpdate(() => {
-        expect(vm.$el.innerHTML.replace(/\s?style=""\s?/g, '')).toBe(
+        expect(vm.$el.innerHTML.replace(/\s?style=""(\s?)/g, '$1')).toBe(
           `<span>` +
             `<div class="test group-enter group-enter-active">d</div>` +
             `<div class="test">b</div>` +
@@ -268,7 +268,7 @@ if (!isIE9) {
           `</span>`
         )
       }).thenWaitFor(nextFrame).then(() => {
-        expect(vm.$el.innerHTML.replace(/\s?style=""\s?/g, '')).toBe(
+        expect(vm.$el.innerHTML.replace(/\s?style=""(\s?)/g, '$1')).toBe(
           `<span>` +
             `<div class="test group-enter-active">d</div>` +
             `<div class="test">b</div>` +
@@ -276,8 +276,8 @@ if (!isIE9) {
             `<div class="test group-leave-active group-move">c</div>` +
           `</span>`
         )
-      }).thenWaitFor(duration + 10).then(() => {
-        expect(vm.$el.innerHTML.replace(/\s?style=""\s?/g, '')).toBe(
+      }).thenWaitFor(duration * 2).then(() => {
+        expect(vm.$el.innerHTML.replace(/\s?style=""(\s?)/g, '$1')).toBe(
           `<span>` +
             `<div class="test">d</div>` +
             `<div class="test">b</div>` +