Skip to content

Commit c23c5c5

Browse files
jingsamyyx990803
authored andcommitted
keep consistency in dev and prod env (vuejs#4093)
* keep consistency in dev and prod env * Update extend.js * delete name=null * fixup * Update name.spec.js
1 parent 4078ce9 commit c23c5c5

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

src/core/global-api/extend.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ export function initExtend (Vue: GlobalAPI) {
2222
if (isFirstExtend && extendOptions._Ctor) {
2323
return extendOptions._Ctor
2424
}
25-
let name = extendOptions.name || Super.options.name
25+
const name = extendOptions.name || Super.options.name
2626
if (process.env.NODE_ENV !== 'production') {
2727
if (!/^[a-zA-Z][\w-]*$/.test(name)) {
2828
warn(
2929
'Invalid component name: "' + name + '". Component names ' +
3030
'can only contain alphanumeric characaters and the hyphen.'
3131
)
32-
name = null
3332
}
3433
}
3534
const Sub = function VueComponent (options) {

test/unit/features/options/name.spec.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ describe('Options name', () => {
2020
/* eslint-enable */
2121
})
2222

23-
it('when incorrect name given it should not contain itself in self components', () => {
24-
const vm = Vue.extend({
25-
name: 'Hyper*Vue'
26-
})
27-
28-
expect(vm.options.components['Hyper*Vue']).toBeUndefined()
29-
})
30-
3123
it('id should not override given name when using Vue.component', () => {
3224
const SuperComponent = Vue.component('super-component', {
3325
name: 'SuperVue'

0 commit comments

Comments
 (0)