Skip to content

Release: 1.0.0 #1523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "1.0.0-beta.33"
"version": "1.0.0"
}
90 changes: 76 additions & 14 deletions packages/server-test-utils/dist/vue-server-test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau

var Vue = _interopDefault(require('vue'));
var vueTemplateCompiler = require('vue-template-compiler');
var vueServerRenderer = require('vue-server-renderer');
var testUtils = require('@vue/test-utils');
var testUtils__default = _interopDefault(testUtils);
var vueServerRenderer = require('vue-server-renderer');
var cheerio = _interopDefault(require('cheerio'));

//
Expand Down Expand Up @@ -1701,6 +1701,18 @@ var semver_40 = semver.prerelease;
var semver_41 = semver.intersects;
var semver_42 = semver.coerce;

var VUE_VERSION = Number(
((Vue.version.split('.')[0]) + "." + (Vue.version.split('.')[1]))
);

var BEFORE_RENDER_LIFECYCLE_HOOK = semver.gt(Vue.version, '2.1.8')
? 'beforeCreate'
: 'beforeMount';

var CREATE_ELEMENT_ALIAS = semver.gt(Vue.version, '2.1.5')
? '_c'
: '_h';

//

function throwError(msg) {
Expand Down Expand Up @@ -1768,6 +1780,15 @@ var isPhantomJS = UA && UA.includes && UA.match(/phantomjs/i);
var isEdge = UA && UA.indexOf('edge/') > 0;
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;

function warnDeprecated(method, fallback) {
if ( fallback === void 0 ) fallback = '';

if (!testUtils.config.showDeprecationWarnings) { return }
var msg = method + " is deprecated and will removed in the next major version";
if (fallback) { msg += " " + fallback; }
warn(msg);
}

//

function addMocks(
Expand Down Expand Up @@ -1822,18 +1843,6 @@ function addEventLogger(_Vue) {
});
}

var VUE_VERSION = Number(
((Vue.version.split('.')[0]) + "." + (Vue.version.split('.')[1]))
);

var BEFORE_RENDER_LIFECYCLE_HOOK = semver.gt(Vue.version, '2.1.8')
? 'beforeCreate'
: 'beforeMount';

var CREATE_ELEMENT_ALIAS = semver.gt(Vue.version, '2.1.5')
? '_c'
: '_h';

function addStubs(_Vue, stubComponents) {
var obj;

Expand All @@ -1846,6 +1855,33 @@ function addStubs(_Vue, stubComponents) {

//

function isDomSelector(selector) {
if (typeof selector !== 'string') {
return false
}

try {
if (typeof document === 'undefined') {
throwError(
"mount must be run in a browser environment like " +
"PhantomJS, jsdom or chrome"
);
}
} catch (error) {
throwError(
"mount must be run in a browser environment like " +
"PhantomJS, jsdom or chrome"
);
}

try {
document.querySelector(selector);
return true
} catch (error) {
return false
}
}

function isVueComponent(c) {
if (isConstructor(c)) {
return true
Expand Down Expand Up @@ -1911,6 +1947,14 @@ function isPlainObject(c) {
return Object.prototype.toString.call(c) === '[object Object]'
}

function isHTMLElement(c) {
if (typeof HTMLElement === 'undefined') {
return false
}
// eslint-disable-next-line no-undef
return c instanceof HTMLElement
}

function makeMap(str, expectsLowerCase) {
var map = Object.create(null);
var list = str.split(',');
Expand Down Expand Up @@ -2297,7 +2341,7 @@ function createStubFromComponent(

// DEPRECATED: converts string stub to template stub.
function createStubFromString(templateString, name) {
warn('String stubs are deprecated and will be removed in future versions');
warnDeprecated('Using a string for stubs');

if (templateContainsComponent(templateString, name)) {
throwError('options.stub cannot contain a circular reference');
Expand Down Expand Up @@ -2644,6 +2688,10 @@ function mergeOptions(
) {
var mocks = (getOption(options.mocks, config.mocks));
var methods = (getOption(options.methods, config.methods));
if (methods && Object.keys(methods).length) {
warnDeprecated('overwriting methods via the `methods` property');
}

var provide = (getOption(options.provide, config.provide));
var stubs = (getStubs(options.stubs, config.stubs));
// $FlowIgnore
Expand Down Expand Up @@ -2702,6 +2750,20 @@ function vueExtendUnsupportedOption(option) {
var UNSUPPORTED_VERSION_OPTIONS = ['mocks', 'stubs', 'localVue'];

function validateOptions(options, component) {
if (
options.attachTo &&
!isHTMLElement(options.attachTo) &&
!isDomSelector(options.attachTo)
) {
throwError(
"options.attachTo should be a valid HTMLElement or CSS selector string"
);
}
if ('attachToDocument' in options) {
warn(
"options.attachToDocument is deprecated in favor of options.attachTo and will be removed in a future release"
);
}
if (options.parentComponent && !isPlainObject(options.parentComponent)) {
throwError(
"options.parentComponent should be a valid Vue component options object"
Expand Down
Loading