mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
bump vue-test-utils (#1338)
This commit is contained in:
parent
30928595d3
commit
83ab9b1917
@ -56,8 +56,8 @@
|
|||||||
"vue": ">= 2.5.0"
|
"vue": ">= 2.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/server-test-utils": "^1.0.0-beta.16",
|
"@vue/server-test-utils": "^1.0.0-beta.20",
|
||||||
"@vue/test-utils": "^1.0.0-beta.16",
|
"@vue/test-utils": "^1.0.0-beta.20",
|
||||||
"autoprefixer": "^8.6.4",
|
"autoprefixer": "^8.6.4",
|
||||||
"babel-cli": "^6.26.0",
|
"babel-cli": "^6.26.0",
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { shallowMount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
import Actionsheet from '../';
|
import Actionsheet from '../';
|
||||||
|
|
||||||
test('callback events', () => {
|
test('callback events', () => {
|
||||||
const callback = jest.fn();
|
const callback = jest.fn();
|
||||||
const wrapper = shallowMount(Actionsheet, {
|
const wrapper = mount(Actionsheet, {
|
||||||
propsData: {
|
propsData: {
|
||||||
actions: [
|
actions: [
|
||||||
{ name: 'Option', callback },
|
{ name: 'Option', callback },
|
||||||
|
@ -216,9 +216,9 @@ export default create({
|
|||||||
|
|
||||||
assignAreaValues(values) {
|
assignAreaValues(values) {
|
||||||
Object.assign(this.data, {
|
Object.assign(this.data, {
|
||||||
province: values[0].name,
|
province: values[0] ? values[0].name : '',
|
||||||
city: values[1].name,
|
city: values[1] ? values[1].name : '',
|
||||||
county: values[2].name
|
county: values[2] ? values[2].name : ''
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
import { mount } from '@vue/test-utils';
|
|
||||||
import { renderToString } from '@vue/server-test-utils';
|
import { renderToString } from '@vue/server-test-utils';
|
||||||
import AddressEdit from '../';
|
import AddressEdit from '../';
|
||||||
import areaList from '../../area/demo/area.simple';
|
import areaList from '../../area/demo/area.simple';
|
||||||
import { later, transitionStub } from '../../../test/utils';
|
import { mount, later, transitionStub } from '../../../test/utils';
|
||||||
|
|
||||||
transitionStub();
|
transitionStub();
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import Area from '..';
|
import Area from '..';
|
||||||
import { mount } from '@vue/test-utils';
|
|
||||||
import areaList from '../demo/area.simple';
|
import areaList from '../demo/area.simple';
|
||||||
import { later, triggerDrag } from '../../../test/utils';
|
import { mount, later, triggerDrag } from '../../../test/utils';
|
||||||
|
|
||||||
const firstOption = [
|
const firstOption = [
|
||||||
{ code: '110000', name: '北京市' },
|
{ code: '110000', name: '北京市' },
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
import Badge from '../';
|
import Badge from '../';
|
||||||
import BadgeGroup from '../../badge-group';
|
import BadgeGroup from '../../badge-group';
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import CellSwipe from '..';
|
import CellSwipe from '..';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount, triggerDrag } from '../../../test/utils';
|
||||||
import { triggerDrag } from '../../../test/utils';
|
|
||||||
|
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
propsData: {
|
propsData: {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Cell from '..';
|
import Cell from '..';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('click event', () => {
|
test('click event', () => {
|
||||||
const wrapper = mount(Cell);
|
const wrapper = mount(Cell);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Checkbox from '..';
|
import Checkbox from '..';
|
||||||
import CheckboxGroup from '../../checkbox-group';
|
import CheckboxGroup from '../../checkbox-group';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('switch checkbox', () => {
|
test('switch checkbox', () => {
|
||||||
const wrapper = mount(Checkbox);
|
const wrapper = mount(Checkbox);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Collapse from '..';
|
import Collapse from '..';
|
||||||
import CollapseItem from '../../collapse-item';
|
import CollapseItem from '../../collapse-item';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
const component = {
|
const component = {
|
||||||
template: `
|
template: `
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import ContactCard from '..';
|
import ContactCard from '..';
|
||||||
import ContactList from '../../contact-list';
|
import ContactList from '../../contact-list';
|
||||||
import ContactEdit from '../../contact-edit';
|
import ContactEdit from '../../contact-edit';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount, later } from '../../../test/utils';
|
||||||
import { later } from '../../../test/utils';
|
|
||||||
|
|
||||||
const contactInfo = {
|
const contactInfo = {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import CouponList from '../../coupon-list';
|
import CouponList from '../../coupon-list';
|
||||||
import CouponCell from '../../coupon-cell';
|
import CouponCell from '../../coupon-cell';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('exchange coupon', () => {
|
test('exchange coupon', () => {
|
||||||
const wrapper = mount(CouponList);
|
const wrapper = mount(CouponList);
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Dialog from '..';
|
import Dialog from '..';
|
||||||
import DialogVue from '../dialog';
|
import DialogVue from '../dialog';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount, later, transitionStub } from '../../../test/utils';
|
||||||
import { later, transitionStub } from '../../../test/utils';
|
|
||||||
|
|
||||||
transitionStub();
|
transitionStub();
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import Field from '../';
|
import Field from '../';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount, later } from '../../../test/utils';
|
||||||
import { later } from '../../../test/utils';
|
|
||||||
|
|
||||||
test('input event', () => {
|
test('input event', () => {
|
||||||
const wrapper = mount(Field);
|
const wrapper = mount(Field);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BigBtn from '../../goods-action-big-btn';
|
import BigBtn from '../../goods-action-big-btn';
|
||||||
import SmallBtn from '../../goods-action-mini-btn';
|
import SmallBtn from '../../goods-action-mini-btn';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('big btn click event', () => {
|
test('big btn click event', () => {
|
||||||
const wrapper = mount(BigBtn);
|
const wrapper = mount(BigBtn);
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import ImagePreview from '..';
|
import ImagePreview from '..';
|
||||||
import ImagePreviewVue from '../image-preview';
|
import ImagePreviewVue from '../image-preview';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount, triggerDrag } from '../../../test/utils';
|
||||||
import { triggerDrag } from '../../../test/utils';
|
|
||||||
|
|
||||||
const images = [
|
const images = [
|
||||||
'https://img.yzcdn.cn/1.png',
|
'https://img.yzcdn.cn/1.png',
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import List from '..';
|
import List from '..';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount, later } from '../../../test/utils';
|
||||||
import { later } from '../../../test/utils';
|
|
||||||
|
|
||||||
test('load event', async() => {
|
test('load event', async() => {
|
||||||
const wrapper = mount(List);
|
const wrapper = mount(List);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import NumberKeyboard from '../';
|
import NumberKeyboard from '../';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
function mockTouch(wrapper, event, keyIndex) {
|
function mockTouch(wrapper, event, keyIndex) {
|
||||||
const key = wrapper.element.querySelectorAll('.van-key')[keyIndex];
|
const key = wrapper.element.querySelectorAll('.van-key')[keyIndex];
|
||||||
|
@ -59,7 +59,7 @@ export default create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.$parent && this.$parent.children.push(this);
|
this.$parent.children && this.$parent.children.push(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -67,7 +67,7 @@ export default create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
destroyed() {
|
||||||
this.$parent && this.$parent.children.splice(this.$parent.children.indexOf(this), 1);
|
this.$parent.children && this.$parent.children.splice(this.$parent.children.indexOf(this), 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import Picker from '../';
|
import Picker from '../';
|
||||||
import PickerColumn from '../PickerColumn';
|
import PickerColumn from '../PickerColumn';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount, triggerDrag } from '../../../test/utils';
|
||||||
import { triggerDrag } from '../../../test/utils';
|
|
||||||
|
|
||||||
const simpleColumn = ['1990', '1991', '1992', '1993', '1994', '1995'];
|
const simpleColumn = ['1990', '1991', '1992', '1993', '1994', '1995'];
|
||||||
const columns = [
|
const columns = [
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import Vue from 'vue';
|
|
||||||
import Popup from '../';
|
import Popup from '../';
|
||||||
import { mount, TransitionStub } from '@vue/test-utils';
|
import { mount, triggerDrag, transitionStub } from '../../../test/utils';
|
||||||
import { triggerDrag } from '../../../test/utils';
|
|
||||||
|
|
||||||
Vue.component('transition', TransitionStub);
|
transitionStub();
|
||||||
|
|
||||||
let wrapper;
|
let wrapper;
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Progress from '../';
|
import Progress from '../';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('calc width', () => {
|
test('calc width', () => {
|
||||||
const wrapper = mount(Progress, {
|
const wrapper = mount(Progress, {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import PullRefresh from '..';
|
import PullRefresh from '..';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount, trigger, triggerDrag } from '../../../test/utils';
|
||||||
import { trigger, triggerDrag } from '../../../test/utils';
|
|
||||||
|
|
||||||
test('change head content when pulling down', () => {
|
test('change head content when pulling down', () => {
|
||||||
const wrapper = mount(PullRefresh, {
|
const wrapper = mount(PullRefresh, {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Rate from '../';
|
import Rate from '../';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('change event', () => {
|
test('change event', () => {
|
||||||
const wrapper = mount(Rate, {
|
const wrapper = mount(Rate, {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Search from '..';
|
import Search from '..';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('listen input event', () => {
|
test('listen input event', () => {
|
||||||
const wrapper = mount(Search);
|
const wrapper = mount(Search);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import Slider from '..';
|
import Slider from '..';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount, triggerDrag, trigger } from '../../../test/utils';
|
||||||
import { triggerDrag, trigger } from '../../../test/utils';
|
|
||||||
|
|
||||||
Element.prototype.getBoundingClientRect = jest.fn(() => ({ width: 100, left: 0 }));
|
Element.prototype.getBoundingClientRect = jest.fn(() => ({ width: 100, left: 0 }));
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Stepper from '..';
|
import Stepper from '..';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('disabled stepper', () => {
|
test('disabled stepper', () => {
|
||||||
const wrapper = mount(Stepper, {
|
const wrapper = mount(Stepper, {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import SubmitBar from '../';
|
import SubmitBar from '../';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('submit', () => {
|
test('submit', () => {
|
||||||
const wrapper = mount(SubmitBar, {
|
const wrapper = mount(SubmitBar, {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import Swipe from '..';
|
import Swipe from '..';
|
||||||
import SwipeItem from '../../swipe-item';
|
import SwipeItem from '../../swipe-item';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount, triggerDrag, later } from '../../../test/utils';
|
||||||
import { triggerDrag, later } from '../../../test/utils';
|
|
||||||
|
|
||||||
const Component = {
|
const Component = {
|
||||||
template: `
|
template: `
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import SwitchCell from '..';
|
import SwitchCell from '..';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('emit event', () => {
|
test('emit event', () => {
|
||||||
const wrapper = mount(SwitchCell);
|
const wrapper = mount(SwitchCell);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Switch from '..';
|
import Switch from '..';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('emit event', () => {
|
test('emit event', () => {
|
||||||
const wrapper = mount(Switch);
|
const wrapper = mount(Switch);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import TreeSelect from '../';
|
import TreeSelect from '../';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '../../../test/utils';
|
||||||
|
|
||||||
test('empty list', () => {
|
test('empty list', () => {
|
||||||
expect(mount(TreeSelect)).toMatchSnapshot();
|
expect(mount(TreeSelect)).toMatchSnapshot();
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import Uploader from '..';
|
import Uploader from '..';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount, later } from '../../../test/utils';
|
||||||
import { later } from '../../../test/utils';
|
|
||||||
|
|
||||||
window.File = function() {
|
window.File = function() {
|
||||||
this.size = 10000;
|
this.size = 10000;
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { TransitionStub } from '@vue/test-utils';
|
import { mount, TransitionStub } from '@vue/test-utils';
|
||||||
|
|
||||||
|
// prevent vue warning log
|
||||||
|
Vue.config.silent = true;
|
||||||
|
|
||||||
|
export {
|
||||||
|
mount
|
||||||
|
};
|
||||||
|
|
||||||
// Trigger pointer/touch event
|
// Trigger pointer/touch event
|
||||||
export function trigger(wrapper, eventName, x = 0, y = 0) {
|
export function trigger(wrapper, eventName, x = 0, y = 0) {
|
||||||
|
12
yarn.lock
12
yarn.lock
@ -137,15 +137,15 @@
|
|||||||
source-map "^0.5.6"
|
source-map "^0.5.6"
|
||||||
vue-template-es2015-compiler "^1.6.0"
|
vue-template-es2015-compiler "^1.6.0"
|
||||||
|
|
||||||
"@vue/server-test-utils@^1.0.0-beta.16":
|
"@vue/server-test-utils@^1.0.0-beta.20":
|
||||||
version "1.0.0-beta.16"
|
version "1.0.0-beta.20"
|
||||||
resolved "https://registry.yarnpkg.com/@vue/server-test-utils/-/server-test-utils-1.0.0-beta.16.tgz#6fee1d086171b5581321de54b21ed16ef464813f"
|
resolved "https://registry.yarnpkg.com/@vue/server-test-utils/-/server-test-utils-1.0.0-beta.20.tgz#d71e3bacfc381a65b8c262a1787b1518b5017f35"
|
||||||
dependencies:
|
dependencies:
|
||||||
cheerio "^1.0.0-rc.2"
|
cheerio "^1.0.0-rc.2"
|
||||||
|
|
||||||
"@vue/test-utils@^1.0.0-beta.16":
|
"@vue/test-utils@^1.0.0-beta.20":
|
||||||
version "1.0.0-beta.16"
|
version "1.0.0-beta.20"
|
||||||
resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-1.0.0-beta.16.tgz#dcf7a30304391422e382b5f97db6eb9508112906"
|
resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-1.0.0-beta.20.tgz#ef4505341b802f3de1c06b3cb8651378c87371fa"
|
||||||
dependencies:
|
dependencies:
|
||||||
lodash "^4.17.4"
|
lodash "^4.17.4"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user