Skip to content

Commit 2f50519

Browse files
committed
chore: update
1 parent 288a787 commit 2f50519

File tree

6 files changed

+252
-282
lines changed

6 files changed

+252
-282
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dist
1+
**/dist/**

packages/server-test-utils/dist/vue-server-test-utils.js

Lines changed: 47 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
1313
var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);
1414
var cheerio__default = /*#__PURE__*/_interopDefaultLegacy(cheerio);
1515

16-
//
16+
//
1717

1818
function createVNodes(vm, slotValue, name) {
1919
var el = vueTemplateCompiler.compileToFunctions(
@@ -1698,7 +1698,7 @@ var CREATE_ELEMENT_ALIAS = semver.gt(Vue__default['default'].version, '2.1.5')
16981698
? '_c'
16991699
: '_h';
17001700

1701-
//
1701+
//
17021702

17031703
function findDOMNodes(
17041704
element,
@@ -1716,7 +1716,7 @@ function findDOMNodes(
17161716
return nodes.concat([].slice.call(element.querySelectorAll(selector)))
17171717
}
17181718

1719-
//
1719+
//
17201720

17211721
function isDomSelector(selector) {
17221722
if (typeof selector !== 'string') {
@@ -1750,7 +1750,7 @@ function isVueComponent(c) {
17501750
return true
17511751
}
17521752

1753-
if (!isPlainObject(c)) {
1753+
if (c === null || typeof c !== 'object') {
17541754
return false
17551755
}
17561756

@@ -1780,7 +1780,7 @@ function componentNeedsCompiling(component) {
17801780

17811781
function isRefSelector(refOptionsObject) {
17821782
if (
1783-
!isPlainObject(refOptionsObject) ||
1783+
typeof refOptionsObject !== 'object' ||
17841784
Object.keys(refOptionsObject || {}).length !== 1
17851785
) {
17861786
return false
@@ -1790,7 +1790,7 @@ function isRefSelector(refOptionsObject) {
17901790
}
17911791

17921792
function isNameSelector(nameOptionsObject) {
1793-
if (!isPlainObject(nameOptionsObject)) {
1793+
if (typeof nameOptionsObject !== 'object' || nameOptionsObject === null) {
17941794
return false
17951795
}
17961796

@@ -1806,7 +1806,7 @@ function isDynamicComponent(c) {
18061806
}
18071807

18081808
function isComponentOptions(c) {
1809-
return isPlainObject(c) && (c.template || c.render)
1809+
return c !== null && typeof c === 'object' && (c.template || c.render)
18101810
}
18111811

18121812
function isFunctionalComponent(c) {
@@ -1848,10 +1848,10 @@ function makeMap(str, expectsLowerCase) {
18481848
map[list[i]] = true;
18491849
}
18501850
return expectsLowerCase
1851-
? function (val) {
1851+
? function(val) {
18521852
return map[val.toLowerCase()]
18531853
}
1854-
: function (val) {
1854+
: function(val) {
18551855
return map[val]
18561856
}
18571857
}
@@ -1961,7 +1961,7 @@ function matches(node, selector) {
19611961
return vmMatchesName(componentInstance, nameSelector)
19621962
}
19631963

1964-
//
1964+
//
19651965

19661966
function findAllInstances(rootVm) {
19671967
var instances = [rootVm];
@@ -2099,7 +2099,7 @@ function normalizeProvide(provide) {
20992099
return provide
21002100
}
21012101

2102-
//
2102+
//
21032103

21042104
function getOption(option, config) {
21052105
if (option === false) {
@@ -7545,7 +7545,7 @@ function ocd(str, options) {
75457545
.replace(/>(\s*)(?=<!--\s*\/)/g, '> ');
75467546
}
75477547

7548-
//
7548+
//
75497549

75507550
function getSelectorType(selector) {
75517551
if (isDomSelector(selector)) { return DOM_SELECTOR }
@@ -7573,7 +7573,7 @@ function getSelector(
75737573
}
75747574
}
75757575

7576-
//
7576+
//
75777577

75787578
var WrapperArray = function WrapperArray(wrappers) {
75797579
var length = wrappers.length;
@@ -7799,7 +7799,7 @@ WrapperArray.prototype.destroy = function destroy () {
77997799
this.wrappers.forEach(function (wrapper) { return wrapper.destroy(); });
78007800
};
78017801

7802-
//
7802+
//
78037803

78047804
var buildSelectorString = function (selector) {
78057805
if (getSelectorType(selector) === REF_SELECTOR) {
@@ -8084,10 +8084,7 @@ ErrorWrapper.prototype.destroy = function destroy () {
80848084
*/
80858085

80868086
function isStyleVisible(element) {
8087-
if (
8088-
!(element instanceof window.HTMLElement) &&
8089-
!(element instanceof window.SVGElement)
8090-
) {
8087+
if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) {
80918088
return false
80928089
}
80938090

@@ -9487,7 +9484,7 @@ function createDOMEvent(type, options) {
94879484
return event
94889485
}
94899486

9490-
//
9487+
//
94919488

94929489
var Wrapper = function Wrapper(
94939490
node,
@@ -9964,7 +9961,9 @@ Wrapper.prototype.overview = function overview () {
99649961
var emittedJSONReplacer = function (key, value) { return value instanceof Array
99659962
? value.map(function (calledWith, index) {
99669963
var callParams = calledWith.map(function (param) { return typeof param === 'object'
9967-
? JSON.stringify(param).replace(/"/g, '').replace(/,/g, ', ')
9964+
? JSON.stringify(param)
9965+
.replace(/"/g, '')
9966+
.replace(/,/g, ', ')
99689967
: param; }
99699968
);
99709969

@@ -10188,7 +10187,8 @@ Wrapper.prototype.setProps = function setProps (data) {
1018810187
Object.keys(data).forEach(function (key) {
1018910188
// Don't let people set entire objects, because reactivity won't work
1019010189
if (
10191-
isPlainObject(data[key]) &&
10190+
typeof data[key] === 'object' &&
10191+
data[key] !== null &&
1019210192
// $FlowIgnore : Problem with possibly null this.vm
1019310193
data[key] === this$1.vm[key]
1019410194
) {
@@ -10359,7 +10359,7 @@ Wrapper.prototype.trigger = function trigger (type, options) {
1035910359
return nextTick()
1036010360
};
1036110361

10362-
//
10362+
//
1036310363

1036410364
var VueWrapper = /*@__PURE__*/(function (Wrapper) {
1036510365
function VueWrapper(vm, options) {
@@ -10398,7 +10398,7 @@ var VueWrapper = /*@__PURE__*/(function (Wrapper) {
1039810398
return VueWrapper;
1039910399
}(Wrapper));
1040010400

10401-
//
10401+
//
1040210402

1040310403
function createWrapper(
1040410404
node,
@@ -12900,7 +12900,7 @@ function cloneDeep(value) {
1290012900

1290112901
var cloneDeep_1 = cloneDeep;
1290212902

12903-
//
12903+
//
1290412904

1290512905
/**
1290612906
* Used internally by vue-server-test-utils and test-utils to propagate/create vue instances.
@@ -12969,7 +12969,7 @@ function _createLocalVue(
1296912969
return instance
1297012970
}
1297112971

12972-
//
12972+
//
1297312973

1297412974
function compileTemplate(component) {
1297512975
if (component.template) {
@@ -13024,7 +13024,7 @@ function compileTemplateForSlots(slots) {
1302413024
});
1302513025
}
1302613026

13027-
//
13027+
//
1302813028

1302913029
function isValidSlot(slot) {
1303013030
return isVueComponent(slot) || typeof slot === 'string'
@@ -13121,7 +13121,7 @@ function validateOptions(options, component) {
1312113121
Vue__default['default'].config.productionTip = false;
1312213122
Vue__default['default'].config.devtools = false;
1312313123

13124-
//
13124+
//
1312513125

1312613126
function throwError(msg) {
1312713127
throw new Error(("[vue-test-utils]: " + msg))
@@ -13234,7 +13234,7 @@ function isVueWrapper(wrapper) {
1323413234
return wrapper.vm || wrapper.isFunctionalComponent
1323513235
}
1323613236

13237-
//
13237+
//
1323813238

1323913239
function addMocks(
1324013240
_Vue,
@@ -13261,7 +13261,7 @@ function addMocks(
1326113261
});
1326213262
}
1326313263

13264-
//
13264+
//
1326513265

1326613266
function logEvents(
1326713267
vm,
@@ -13280,7 +13280,7 @@ function logEvents(
1328013280

1328113281
function addEventLogger(_Vue) {
1328213282
_Vue.mixin({
13283-
beforeCreate: function () {
13283+
beforeCreate: function() {
1328413284
this.__emitted = Object.create(null);
1328513285
this.__emittedByOrder = [];
1328613286
logEvents(this, this.__emitted, this.__emittedByOrder);
@@ -13298,7 +13298,7 @@ function addStubs(_Vue, stubComponents) {
1329813298
_Vue.mixin(( obj = {}, obj[BEFORE_RENDER_LIFECYCLE_HOOK] = addStubComponentsMixin, obj ));
1329913299
}
1330013300

13301-
//
13301+
//
1330213302

1330313303
var MOUNTING_OPTIONS = [
1330413304
'attachToDocument',
@@ -13322,13 +13322,15 @@ function extractInstanceOptions(options) {
1332213322
return instanceOptions
1332313323
}
1332413324

13325-
//
13325+
//
1332613326

1332713327
function isDestructuringSlotScope(slotScope) {
1332813328
return /^{.*}$/.test(slotScope)
1332913329
}
1333013330

13331-
function getVueTemplateCompilerHelpers(_Vue) {
13331+
function getVueTemplateCompilerHelpers(
13332+
_Vue
13333+
) {
1333213334
// $FlowIgnore
1333313335
var vue = new _Vue();
1333413336
var helpers = {};
@@ -13427,7 +13429,7 @@ function createScopedSlots(
1342713429

1342813430
var slotScope = scopedSlotMatches.match && scopedSlotMatches.match[1];
1342913431

13430-
scopedSlots[scopedSlotName] = function (props) {
13432+
scopedSlots[scopedSlotName] = function(props) {
1343113433
var obj;
1343213434

1343313435
var res;
@@ -13449,7 +13451,7 @@ function createScopedSlots(
1344913451
return scopedSlots
1345013452
}
1345113453

13452-
//
13454+
//
1345313455

1345413456
var FUNCTION_PLACEHOLDER = '[Function]';
1345513457

@@ -13476,10 +13478,10 @@ function resolveComponent$1(obj, component) {
1347613478
)
1347713479
}
1347813480

13479-
function getCoreProperties(componentOptions, name) {
13481+
function getCoreProperties(componentOptions) {
1348013482
return {
1348113483
attrs: componentOptions.attrs,
13482-
name: componentOptions.name || name,
13484+
name: componentOptions.name,
1348313485
model: componentOptions.model,
1348413486
props: componentOptions.props,
1348513487
on: componentOptions.on,
@@ -13540,7 +13542,7 @@ function createStubFromComponent(
1354013542
Vue__default['default'].config.ignoredElements.push(tagName);
1354113543
}
1354213544

13543-
return Object.assign({}, getCoreProperties(componentOptions, name),
13545+
return Object.assign({}, getCoreProperties(componentOptions),
1354413546
{$_vueTestUtils_original: originalComponent,
1354513547
$_doNotStubChildren: true,
1354613548
render: function render(h, context) {
@@ -13721,16 +13723,8 @@ function patchCreateElement(_Vue, stubs, stubAllComponents) {
1372113723
}
1372213724

1372313725
if (isConstructor(el) || isComponentOptions(el)) {
13724-
var componentOptions = isConstructor(el) ? el.options : el;
13725-
var elName = componentOptions.name;
13726-
13727-
var stubbedComponent = resolveComponent(elName, stubs);
13728-
if (stubbedComponent) {
13729-
return originalCreateElement.apply(void 0, [ stubbedComponent ].concat( args ))
13730-
}
13731-
1373213726
if (stubAllComponents) {
13733-
var stub = createStubFromComponent(el, elName || 'anonymous', _Vue);
13727+
var stub = createStubFromComponent(el, el.name || 'anonymous', _Vue);
1373413728
return originalCreateElement.apply(void 0, [ stub ].concat( args ))
1373513729
}
1373613730
var Constructor = shouldExtend(el) ? extend(el, _Vue) : el;
@@ -13767,7 +13761,7 @@ function patchCreateElement(_Vue, stubs, stubAllComponents) {
1376713761
_Vue.mixin(( obj = {}, obj[BEFORE_RENDER_LIFECYCLE_HOOK] = patchCreateElementMixin, obj ));
1376813762
}
1376913763

13770-
//
13764+
//
1377113765

1377213766
function objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }
1377313767

@@ -13864,22 +13858,22 @@ function createInstance(
1386413858
var parentComponentOptions = options.parentComponent || {};
1386513859

1386613860
var originalParentComponentProvide = parentComponentOptions.provide;
13867-
parentComponentOptions.provide = function () {
13861+
parentComponentOptions.provide = function() {
1386813862
return Object.assign({}, getValuesFromCallableOption.call(this, originalParentComponentProvide),
1386913863
// $FlowIgnore
1387013864
getValuesFromCallableOption.call(this, options.provide))
1387113865
};
1387213866

1387313867
var originalParentComponentData = parentComponentOptions.data;
13874-
parentComponentOptions.data = function () {
13868+
parentComponentOptions.data = function() {
1387513869
return Object.assign({}, getValuesFromCallableOption.call(this, originalParentComponentData),
1387613870
{vueTestUtils_childProps: Object.assign({}, options.propsData)})
1387713871
};
1387813872

1387913873
parentComponentOptions.$_doNotStubChildren = true;
1388013874
parentComponentOptions.$_isWrapperParent = true;
1388113875
parentComponentOptions._isFunctionalContainer = componentOptions.functional;
13882-
parentComponentOptions.render = function (h) {
13876+
parentComponentOptions.render = function(h) {
1388313877
return h(
1388413878
Constructor,
1388513879
createContext(options, scopedSlots, this.vueTestUtils_childProps),
@@ -13901,7 +13895,7 @@ function createInstance(
1390113895

1390213896
var config$1 = testUtils.config;
1390313897

13904-
//
13898+
//
1390513899

1390613900
Vue__default['default'].config.productionTip = false;
1390713901
Vue__default['default'].config.devtools = false;
@@ -13936,7 +13930,7 @@ function renderToString(
1393613930
return renderer.renderToString(vm)
1393713931
}
1393813932

13939-
//
13933+
//
1394013934

1394113935
function render(
1394213936
component,

0 commit comments

Comments
 (0)