Evan You 9 лет назад
Родитель
Сommit
16e3dae245
2 измененных файлов с 8 добавлено и 1 удалено
  1. 1 1
      src/core/instance/render.js
  2. 7 0
      test/unit/features/transition/transition.spec.js

+ 1 - 1
src/core/instance/render.js

@@ -4,7 +4,7 @@ import config from '../config'
 import VNode, { emptyVNode, cloneVNode, cloneVNodes } from '../vdom/vnode'
 import { normalizeChildren } from '../vdom/helpers/index'
 import {
-  warn, formatComponentName, bind, isObject, toObject, isServerRendering,
+  warn, formatComponentName, bind, isObject, toObject,
   nextTick, resolveAsset, _toString, toNumber, looseEqual, looseIndexOf
 } from '../util/index'
 

+ 7 - 0
test/unit/features/transition/transition.spec.js

@@ -849,5 +849,12 @@ if (!isIE9) {
         expect(vm.$el.children[0].className).toBe('test')
       }).then(done)
     })
+
+    it('warn when used on multiple elements', () => {
+      new Vue({
+        template: `<transition><p>1</p><p>2</p></transition>`
+      }).$mount()
+      expect(`<transition> can only be used on a single element`).toHaveBeenWarned()
+    })
   })
 }