Skip to content

Commit dcf1fde

Browse files
committed
fix extends test
1 parent f1bf59d commit dcf1fde

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/util/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ strats.activate = function (parentVal, childVal) {
149149
*/
150150

151151
function mergeAssets (parentVal, childVal) {
152-
var res = Object.create(parentVal)
152+
var res = Object.create(parentVal || null)
153153
return childVal
154154
? extend(res, guardArrayAssets(childVal))
155155
: res

test/unit/specs/util/options_spec.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,9 @@ describe('Util - Option merging', function () {
282282
var f1 = function () {}
283283
var f2 = function () {}
284284
var f3 = function () {}
285-
var componentA = function () {}
286-
componentA.options = { template: 'foo', methods: { f1: f1, f2: function () {} } }
287-
var componentB = { extends: componentA, methods: { f2: f2 } }
288-
var componentC = { extends: componentB, template: 'bar', methods: { f3: f3 } }
285+
var componentA = Vue.extend({ template: 'foo', methods: { f1: f1, f2: function () {} }})
286+
var componentB = { extends: componentA, methods: { f2: f2 }}
287+
var componentC = { extends: componentB, template: 'bar', methods: { f3: f3 }}
289288
var res = merge({}, componentC)
290289
expect(res.template).toBe('bar')
291290
expect(res.methods.f1).toBe(f1)

0 commit comments

Comments
 (0)