Просмотр исходного кода

keep consistency in dev and prod env (#4093)

* keep consistency in dev and prod env

* Update extend.js

* delete name=null

* fixup

* Update name.spec.js
jingsam 9 лет назад
Родитель
Сommit
c23c5c5d70
2 измененных файлов с 1 добавлено и 10 удалено
  1. 1 2
      src/core/global-api/extend.js
  2. 0 8
      test/unit/features/options/name.spec.js

+ 1 - 2
src/core/global-api/extend.js

@@ -22,14 +22,13 @@ export function initExtend (Vue: GlobalAPI) {
     if (isFirstExtend && extendOptions._Ctor) {
       return extendOptions._Ctor
     }
-    let name = extendOptions.name || Super.options.name
+    const name = extendOptions.name || Super.options.name
     if (process.env.NODE_ENV !== 'production') {
       if (!/^[a-zA-Z][\w-]*$/.test(name)) {
         warn(
           'Invalid component name: "' + name + '". Component names ' +
           'can only contain alphanumeric characaters and the hyphen.'
         )
-        name = null
       }
     }
     const Sub = function VueComponent (options) {

+ 0 - 8
test/unit/features/options/name.spec.js

@@ -20,14 +20,6 @@ describe('Options name', () => {
     /* eslint-enable */
   })
 
-  it('when incorrect name given it should not contain itself in self components', () => {
-    const vm = Vue.extend({
-      name: 'Hyper*Vue'
-    })
-
-    expect(vm.options.components['Hyper*Vue']).toBeUndefined()
-  })
-
   it('id should not override given name when using Vue.component', () => {
     const SuperComponent = Vue.component('super-component', {
       name: 'SuperVue'