Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep consistency in dev and prod env #4093

Merged
merged 5 commits into from
Nov 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/core/global-api/extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 0 additions & 8 deletions test/unit/features/options/name.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down