Skip to content

Commit 51dcc9e

Browse files
committed
build: add dist files
1 parent 2be2c30 commit 51dcc9e

File tree

4 files changed

+625
-568
lines changed

4 files changed

+625
-568
lines changed

Diff for: packages/server-test-utils/dist/vue-server-test-utils.js

+19-10
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,20 @@ var cheerio = _interopDefault(require('cheerio'));
1010

1111
//
1212

13+
function startsWithTag (str) {
14+
return str && str.trim()[0] === '<'
15+
}
16+
1317
function createVNodesForSlot (
1418
h,
1519
slotValue,
1620
name
1721
) {
22+
if (typeof slotValue === 'string' &&
23+
!startsWithTag(slotValue)) {
24+
return slotValue
25+
}
26+
1827
var el = typeof slotValue === 'string'
1928
? vueTemplateCompiler.compileToFunctions(slotValue)
2029
: slotValue;
@@ -199,9 +208,16 @@ function createStubFromString (
199208
}
200209

201210
function createBlankStub (originalComponent) {
211+
var name = (originalComponent.name) + "-stub";
212+
213+
// ignoreElements does not exist in Vue 2.0.x
214+
if (Vue.config.ignoredElements) {
215+
Vue.config.ignoredElements.push(name);
216+
}
217+
202218
return Object.assign({}, getCoreProperties(originalComponent),
203219
{render: function render (h) {
204-
return h(((originalComponent.name) + "-stub"))
220+
return h(name)
205221
}})
206222
}
207223

@@ -262,10 +278,6 @@ function createComponentStubs (
262278
components[stub] = Object.assign({}, stubs[stub]);
263279
}
264280
}
265-
// ignoreElements does not exist in Vue 2.0.x
266-
if (Vue.config.ignoredElements) {
267-
Vue.config.ignoredElements.push((stub + "-stub"));
268-
}
269281
});
270282
}
271283
return components
@@ -397,8 +409,7 @@ function createInstance (
397409

398410
addEventLogger(_Vue);
399411

400-
var instanceOptions = Object.assign({}, options,
401-
{propsData: Object.assign({}, options.propsData)});
412+
var instanceOptions = Object.assign({}, options);
402413

403414
deleteMountingOptions(instanceOptions);
404415

@@ -424,12 +435,10 @@ function createInstance (
424435
_Vue.component(c, stubComponents[c]);
425436
});
426437

427-
var Constructor = (typeof component === 'function' && component.prototype instanceof Vue)
438+
var Constructor = vueVersion < 2.3 && typeof component === 'function'
428439
? component.extend(instanceOptions)
429440
: _Vue.extend(component).extend(instanceOptions);
430441

431-
// const Constructor = _Vue.extend(component).extend(instanceOptions)
432-
433442
Object.keys(instanceOptions.components || {}).forEach(function (key) {
434443
Constructor.component(key, instanceOptions.components[key]);
435444
_Vue.component(key, instanceOptions.components[key]);

0 commit comments

Comments
 (0)