Skip to content

Commit cc559c5

Browse files
committed
build: 1.0.0-beta.10
1 parent 3026fbf commit cc559c5

File tree

4 files changed

+98
-27
lines changed

4 files changed

+98
-27
lines changed

RELEASE_NOTE_undefined.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<a name="vundefined"></a>
2+
# [vundefined](/compare/v1.0.0-beta.9...vundefined) (2018-01-10)
3+
4+
5+
### Bug Fixes
6+
7+
* #306 issue with typescript types. (#307) 1482c2b
8+
* **types:** make compatible with Vue 2.5 and TypeScript 2.6 (#317) fad069d
9+
* compile uncompiled components 562fd33, closes #329
10+
* make find work for unnamed components in shallow 60dde1e
11+
* run watchers before updating component c095221
12+
* throw error if functional find not supported d064eaa, closes #296
13+
14+
15+
### Features
16+
17+
* add attributes, classes, and props to wrapper type definitions (#311) 45a445b
18+
19+
20+

dist/vue-test-utils.iife.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ function createComponentStubsForAll (component) {
131131
Object.keys(component.components).forEach(function (c) {
132132
// Remove cached constructor
133133
delete component.components[c]._Ctor;
134+
if (!component.components[c].name) {
135+
component.components[c].name = c;
136+
}
134137
components[c] = createBlankStub(component.components[c]);
135138

136139
// ignoreElements does not exist in Vue 2.0.x
@@ -245,6 +248,8 @@ var NAME_SELECTOR = 'NAME_SELECTOR';
245248
var COMPONENT_SELECTOR = 'COMPONENT_SELECTOR';
246249
var REF_SELECTOR = 'REF_SELECTOR';
247250
var DOM_SELECTOR = 'DOM_SELECTOR';
251+
var VUE_VERSION = Number(((Vue.version.split('.')[0]) + "." + (Vue.version.split('.')[1])));
252+
var FUNCTIONAL_OPTIONS = VUE_VERSION >= 2.5 ? 'fnOptions' : 'functionalOptions';
248253

249254
//
250255

@@ -313,7 +318,7 @@ function findAllFunctionalComponentsFromVnode (
313318
) {
314319
if ( components === void 0 ) components = [];
315320

316-
if (vnode.fnOptions) {
321+
if (vnode[FUNCTIONAL_OPTIONS] || vnode.functionalContext) {
317322
components.push(vnode);
318323
}
319324
if (vnode.children) {
@@ -339,11 +344,15 @@ function vmCtorMatchesSelector (component, selector) {
339344
}
340345

341346
function vmFunctionalCtorMatchesSelector (component, Ctor) {
342-
if (!component.fnOptions) {
347+
if (VUE_VERSION < 2.3) {
348+
throwError('find for functional components is not support in Vue < 2.3');
349+
}
350+
351+
if (!component[FUNCTIONAL_OPTIONS]) {
343352
return false
344353
}
345-
var Ctors = Object.keys(component.fnOptions._Ctor);
346-
return Ctors.some(function (c) { return Ctor[c] === component.fnOptions._Ctor[c]; })
354+
var Ctors = Object.keys(component[FUNCTIONAL_OPTIONS]._Ctor);
355+
return Ctors.some(function (c) { return Ctor[c] === component[FUNCTIONAL_OPTIONS]._Ctor[c]; })
347356
}
348357

349358
function findVueComponents (
@@ -352,10 +361,10 @@ function findVueComponents (
352361
selector
353362
) {
354363
if (selector.functional) {
355-
var components$1 = root._vnode
364+
var nodes = root._vnode
356365
? findAllFunctionalComponentsFromVnode(root._vnode)
357366
: findAllFunctionalComponentsFromVnode(root);
358-
return components$1.filter(function (component) { return vmFunctionalCtorMatchesSelector(component, selector._Ctor); })
367+
return nodes.filter(function (node) { return vmFunctionalCtorMatchesSelector(node, selector._Ctor); })
359368
}
360369
var components = root._isVue
361370
? findAllVueComponentsFromVm(root)
@@ -3881,12 +3890,12 @@ function update () {
38813890
if (this.$_mountingOptionsSlots) {
38823891
addSlots(this, this.$_mountingOptionsSlots);
38833892
}
3884-
var vnodes = this._render();
3885-
this._update(vnodes);
3886-
this.$children.forEach(function (child) { return update.call(child); });
38873893
this._watchers.forEach(function (watcher) {
38883894
watcher.run();
38893895
});
3896+
var vnodes = this._render();
3897+
this._update(vnodes);
3898+
this.$children.forEach(function (child) { return update.call(child); });
38903899
}
38913900

38923901
var VueWrapper = (function (Wrapper$$1) {
@@ -3985,6 +3994,14 @@ function addEventLogger (vue) {
39853994
//
39863995

39873996
function compileTemplate (component) {
3997+
if (component.components) {
3998+
Object.keys(component.components).forEach(function (c) {
3999+
var cmp = component.components[c];
4000+
if (!cmp.render) {
4001+
compileTemplate(cmp);
4002+
}
4003+
});
4004+
}
39884005
if (component.extends) {
39894006
compileTemplate(component.extends);
39904007
}

dist/vue-test-utils.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ function createComponentStubsForAll (component) {
133133
Object.keys(component.components).forEach(function (c) {
134134
// Remove cached constructor
135135
delete component.components[c]._Ctor;
136+
if (!component.components[c].name) {
137+
component.components[c].name = c;
138+
}
136139
components[c] = createBlankStub(component.components[c]);
137140

138141
// ignoreElements does not exist in Vue 2.0.x
@@ -247,6 +250,8 @@ var NAME_SELECTOR = 'NAME_SELECTOR';
247250
var COMPONENT_SELECTOR = 'COMPONENT_SELECTOR';
248251
var REF_SELECTOR = 'REF_SELECTOR';
249252
var DOM_SELECTOR = 'DOM_SELECTOR';
253+
var VUE_VERSION = Number(((Vue.version.split('.')[0]) + "." + (Vue.version.split('.')[1])));
254+
var FUNCTIONAL_OPTIONS = VUE_VERSION >= 2.5 ? 'fnOptions' : 'functionalOptions';
250255

251256
//
252257

@@ -315,7 +320,7 @@ function findAllFunctionalComponentsFromVnode (
315320
) {
316321
if ( components === void 0 ) components = [];
317322

318-
if (vnode.fnOptions) {
323+
if (vnode[FUNCTIONAL_OPTIONS] || vnode.functionalContext) {
319324
components.push(vnode);
320325
}
321326
if (vnode.children) {
@@ -341,11 +346,15 @@ function vmCtorMatchesSelector (component, selector) {
341346
}
342347

343348
function vmFunctionalCtorMatchesSelector (component, Ctor) {
344-
if (!component.fnOptions) {
349+
if (VUE_VERSION < 2.3) {
350+
throwError('find for functional components is not support in Vue < 2.3');
351+
}
352+
353+
if (!component[FUNCTIONAL_OPTIONS]) {
345354
return false
346355
}
347-
var Ctors = Object.keys(component.fnOptions._Ctor);
348-
return Ctors.some(function (c) { return Ctor[c] === component.fnOptions._Ctor[c]; })
356+
var Ctors = Object.keys(component[FUNCTIONAL_OPTIONS]._Ctor);
357+
return Ctors.some(function (c) { return Ctor[c] === component[FUNCTIONAL_OPTIONS]._Ctor[c]; })
349358
}
350359

351360
function findVueComponents (
@@ -354,10 +363,10 @@ function findVueComponents (
354363
selector
355364
) {
356365
if (selector.functional) {
357-
var components$1 = root._vnode
366+
var nodes = root._vnode
358367
? findAllFunctionalComponentsFromVnode(root._vnode)
359368
: findAllFunctionalComponentsFromVnode(root);
360-
return components$1.filter(function (component) { return vmFunctionalCtorMatchesSelector(component, selector._Ctor); })
369+
return nodes.filter(function (node) { return vmFunctionalCtorMatchesSelector(node, selector._Ctor); })
361370
}
362371
var components = root._isVue
363372
? findAllVueComponentsFromVm(root)
@@ -3883,12 +3892,12 @@ function update () {
38833892
if (this.$_mountingOptionsSlots) {
38843893
addSlots(this, this.$_mountingOptionsSlots);
38853894
}
3886-
var vnodes = this._render();
3887-
this._update(vnodes);
3888-
this.$children.forEach(function (child) { return update.call(child); });
38893895
this._watchers.forEach(function (watcher) {
38903896
watcher.run();
38913897
});
3898+
var vnodes = this._render();
3899+
this._update(vnodes);
3900+
this.$children.forEach(function (child) { return update.call(child); });
38923901
}
38933902

38943903
var VueWrapper = (function (Wrapper$$1) {
@@ -3987,6 +3996,14 @@ function addEventLogger (vue) {
39873996
//
39883997

39893998
function compileTemplate (component) {
3999+
if (component.components) {
4000+
Object.keys(component.components).forEach(function (c) {
4001+
var cmp = component.components[c];
4002+
if (!cmp.render) {
4003+
compileTemplate(cmp);
4004+
}
4005+
});
4006+
}
39904007
if (component.extends) {
39914008
compileTemplate(component.extends);
39924009
}

dist/vue-test-utils.umd.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ function createComponentStubsForAll (component) {
134134
Object.keys(component.components).forEach(function (c) {
135135
// Remove cached constructor
136136
delete component.components[c]._Ctor;
137+
if (!component.components[c].name) {
138+
component.components[c].name = c;
139+
}
137140
components[c] = createBlankStub(component.components[c]);
138141

139142
// ignoreElements does not exist in Vue 2.0.x
@@ -248,6 +251,8 @@ var NAME_SELECTOR = 'NAME_SELECTOR';
248251
var COMPONENT_SELECTOR = 'COMPONENT_SELECTOR';
249252
var REF_SELECTOR = 'REF_SELECTOR';
250253
var DOM_SELECTOR = 'DOM_SELECTOR';
254+
var VUE_VERSION = Number(((Vue.version.split('.')[0]) + "." + (Vue.version.split('.')[1])));
255+
var FUNCTIONAL_OPTIONS = VUE_VERSION >= 2.5 ? 'fnOptions' : 'functionalOptions';
251256

252257
//
253258

@@ -316,7 +321,7 @@ function findAllFunctionalComponentsFromVnode (
316321
) {
317322
if ( components === void 0 ) components = [];
318323

319-
if (vnode.fnOptions) {
324+
if (vnode[FUNCTIONAL_OPTIONS] || vnode.functionalContext) {
320325
components.push(vnode);
321326
}
322327
if (vnode.children) {
@@ -342,11 +347,15 @@ function vmCtorMatchesSelector (component, selector) {
342347
}
343348

344349
function vmFunctionalCtorMatchesSelector (component, Ctor) {
345-
if (!component.fnOptions) {
350+
if (VUE_VERSION < 2.3) {
351+
throwError('find for functional components is not support in Vue < 2.3');
352+
}
353+
354+
if (!component[FUNCTIONAL_OPTIONS]) {
346355
return false
347356
}
348-
var Ctors = Object.keys(component.fnOptions._Ctor);
349-
return Ctors.some(function (c) { return Ctor[c] === component.fnOptions._Ctor[c]; })
357+
var Ctors = Object.keys(component[FUNCTIONAL_OPTIONS]._Ctor);
358+
return Ctors.some(function (c) { return Ctor[c] === component[FUNCTIONAL_OPTIONS]._Ctor[c]; })
350359
}
351360

352361
function findVueComponents (
@@ -355,10 +364,10 @@ function findVueComponents (
355364
selector
356365
) {
357366
if (selector.functional) {
358-
var components$1 = root._vnode
367+
var nodes = root._vnode
359368
? findAllFunctionalComponentsFromVnode(root._vnode)
360369
: findAllFunctionalComponentsFromVnode(root);
361-
return components$1.filter(function (component) { return vmFunctionalCtorMatchesSelector(component, selector._Ctor); })
370+
return nodes.filter(function (node) { return vmFunctionalCtorMatchesSelector(node, selector._Ctor); })
362371
}
363372
var components = root._isVue
364373
? findAllVueComponentsFromVm(root)
@@ -3884,12 +3893,12 @@ function update () {
38843893
if (this.$_mountingOptionsSlots) {
38853894
addSlots(this, this.$_mountingOptionsSlots);
38863895
}
3887-
var vnodes = this._render();
3888-
this._update(vnodes);
3889-
this.$children.forEach(function (child) { return update.call(child); });
38903896
this._watchers.forEach(function (watcher) {
38913897
watcher.run();
38923898
});
3899+
var vnodes = this._render();
3900+
this._update(vnodes);
3901+
this.$children.forEach(function (child) { return update.call(child); });
38933902
}
38943903

38953904
var VueWrapper = (function (Wrapper$$1) {
@@ -3988,6 +3997,14 @@ function addEventLogger (vue) {
39883997
//
39893998

39903999
function compileTemplate (component) {
4000+
if (component.components) {
4001+
Object.keys(component.components).forEach(function (c) {
4002+
var cmp = component.components[c];
4003+
if (!cmp.render) {
4004+
compileTemplate(cmp);
4005+
}
4006+
});
4007+
}
39914008
if (component.extends) {
39924009
compileTemplate(component.extends);
39934010
}

0 commit comments

Comments
 (0)