diff --git a/src/util/options.js b/src/util/options.js index de930798e20..068ad7af3ec 100644 --- a/src/util/options.js +++ b/src/util/options.js @@ -307,10 +307,11 @@ exports.mergeOptions = function merge (parent, child, vm) { */ exports.resolveAsset = function resolve (options, type, id) { - var asset = options[type][id] + var camelizedId = _.camelize(id) + var asset = options[type][id] || options[type][camelizedId] while (!asset && options._parent) { options = options._parent.$options - asset = options[type][id] + asset = options[type][id] || options[type][camelizedId] } return asset } diff --git a/test/unit/specs/util/options_spec.js b/test/unit/specs/util/options_spec.js index 78f2fb37919..fc1419bb35a 100644 --- a/test/unit/specs/util/options_spec.js +++ b/test/unit/specs/util/options_spec.js @@ -1,6 +1,7 @@ var _ = require('../../../../src/util') var Vue = require('../../../../src/vue') var merge = _.mergeOptions +var resolveAsset = _.resolveAsset describe('Util - Option merging', function () { @@ -275,3 +276,27 @@ describe('Util - Option merging', function () { }) }) + +describe('Util - Option resolveAsset', function () { + + var vm + beforeEach(function () { + vm = new Vue({ + data: {}, + components: { + 'hyphenated-component': { + template: 'hi' + }, + camelCasedComponent: { + template: 'yo' + } + } + }) + }) + + it('resolves', function () { + expect(resolveAsset(vm.$options, 'components', 'hyphenated-component')).toBeTruthy() + expect(resolveAsset(vm.$options, 'components', 'camel-cased-component')).toBeTruthy() + }) + +})