mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-30 11:16:12 +08:00
test: upgrade @vue/test-utils to v2.0.0-rc.15
This commit is contained in:
parent
bf91f72351
commit
cd2bd26d63
@ -7,6 +7,7 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
},
|
||||
setupFiles: ['./jest.setup.js'],
|
||||
testPathIgnorePatterns: ['/node_modules/', 'dist'],
|
||||
modulePathIgnorePatterns: ['/node_modules/', 'dist'],
|
||||
testEnvironment: 'jsdom',
|
||||
|
4
jest.setup.js
Normal file
4
jest.setup.js
Normal file
@ -0,0 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const { config } = require('@vue/test-utils')
|
||||
|
||||
config.global.stubs = {}
|
@ -86,7 +86,7 @@
|
||||
"@typescript-eslint/parser": "^4.31.2",
|
||||
"@vue/compiler-sfc": "^3.2.18",
|
||||
"@vue/component-compiler-utils": "^3.2.2",
|
||||
"@vue/test-utils": "2.0.0-beta.4",
|
||||
"@vue/test-utils": "2.0.0-rc.15",
|
||||
"algoliasearch": "^4.10.5",
|
||||
"chalk": "^4.1.2",
|
||||
"clipboard-copy": "^4.0.1",
|
||||
|
@ -76,7 +76,7 @@ afterAll(() => {
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
const app = document.querySelector('#app')
|
||||
const app = document.querySelector('[data-v-app]')
|
||||
document.body.removeChild(app)
|
||||
})
|
||||
|
||||
|
@ -153,14 +153,14 @@ describe('menu', () => {
|
||||
},
|
||||
}
|
||||
)
|
||||
const elSubMenu = wrapper.findComponent({ ref: 'subMenu' })
|
||||
const instance: any = elSubMenu.vm
|
||||
|
||||
const button = wrapper.find('button')
|
||||
button.trigger('click')
|
||||
|
||||
await nextTick()
|
||||
expect(instance.opened).toBeTruthy()
|
||||
|
||||
const elSubMenu = wrapper.findComponent({ ref: 'subMenu' })
|
||||
expect(elSubMenu.vm.$.exposed.opened).toBeTruthy()
|
||||
})
|
||||
|
||||
test('hover-background-color', async () => {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { nextTick, ref, h } from 'vue'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import Pagination from '../src/pagination'
|
||||
import selectDropdownVue from '../../select/src/select-dropdown.vue'
|
||||
import type { VueWrapper } from '@vue/test-utils'
|
||||
|
||||
const assertElementsExistence = (
|
||||
@ -332,7 +333,7 @@ describe('Pagination', () => {
|
||||
expect(currentPageWatcher).toHaveBeenCalled()
|
||||
await wrapper.find('.el-select').trigger('click')
|
||||
await wrapper
|
||||
.getComponent('.el-select-dropdown')
|
||||
.getComponent(selectDropdownVue)
|
||||
.find('li:nth-child(2)')
|
||||
.trigger('click')
|
||||
expect(pageSizeWatcher).toHaveBeenCalled()
|
||||
|
@ -181,10 +181,10 @@ describe('Popper.vue', () => {
|
||||
disabled: true,
|
||||
appendToBody: false,
|
||||
})
|
||||
const $trigger = () => wrapper.find(`.${TEST_TRIGGER}`)
|
||||
|
||||
const $trigger = wrapper.find(`.${TEST_TRIGGER}`)
|
||||
expect(wrapper.find(selector).attributes('style')).toContain(DISPLAY_NONE)
|
||||
await $trigger.trigger(MOUSE_ENTER_EVENT)
|
||||
await $trigger().trigger(MOUSE_ENTER_EVENT)
|
||||
|
||||
expect(wrapper.find(selector).attributes('style')).toContain(DISPLAY_NONE)
|
||||
|
||||
@ -192,7 +192,7 @@ describe('Popper.vue', () => {
|
||||
disabled: false,
|
||||
})
|
||||
|
||||
await $trigger.trigger(MOUSE_ENTER_EVENT)
|
||||
await $trigger().trigger(MOUSE_ENTER_EVENT)
|
||||
|
||||
expect(wrapper.find(selector).attributes('style')).not.toContain(
|
||||
DISPLAY_NONE
|
||||
@ -232,7 +232,7 @@ describe('Popper.vue', () => {
|
||||
const errorHandler = jest.fn()
|
||||
mount(Wrapped, {
|
||||
slots: {
|
||||
trigger: undefined,
|
||||
// trigger: undefined,
|
||||
},
|
||||
global: {
|
||||
config: {
|
||||
|
@ -1343,6 +1343,11 @@ describe('Select', () => {
|
||||
selectInputEl.value = 'a'
|
||||
selectInput.trigger('input')
|
||||
await vm.$nextTick()
|
||||
|
||||
const timer = sleep(300)
|
||||
jest.runAllTimers()
|
||||
await timer
|
||||
|
||||
expect(innerInputEl.placeholder).toBe('')
|
||||
|
||||
selectInput.trigger('keydown', {
|
||||
|
@ -276,7 +276,7 @@ describe('Tabs.vue', () => {
|
||||
expect(panesWrapper.length).toEqual(2)
|
||||
|
||||
// add one tab, check panes length and current tab
|
||||
await navWrapper.find('.el-tabs__new-tab').trigger('click')
|
||||
await wrapper.find('.el-tabs__new-tab').trigger('click')
|
||||
|
||||
panesWrapper = wrapper.findAllComponents(TabPane)
|
||||
navItemsWrapper = navWrapper.findAll('.el-tabs__item')
|
||||
@ -362,7 +362,7 @@ describe('Tabs.vue', () => {
|
||||
const navWrapper = wrapper.findComponent(TabNav)
|
||||
await nextTick()
|
||||
|
||||
await navWrapper.find('.el-tabs__new-tab').trigger('click')
|
||||
await wrapper.find('.el-tabs__new-tab').trigger('click')
|
||||
|
||||
let navItemsWrapper = navWrapper.findAll('.el-tabs__item')
|
||||
let panesWrapper = wrapper.findAllComponents(TabPane)
|
||||
|
@ -153,7 +153,7 @@ describe('<fixed-size-grid />', () => {
|
||||
|
||||
await nextTick()
|
||||
expect(wrapper.findAll(ITEM_SELECTOR)).toHaveLength(48)
|
||||
expect(wrapper.find(ITEM_SELECTOR)).toEqual(prevFirstItem)
|
||||
expect(wrapper.find(ITEM_SELECTOR).element).toEqual(prevFirstItem.element)
|
||||
})
|
||||
|
||||
it('should scrollToItem with correct alignment', async () => {
|
||||
|
@ -34,7 +34,7 @@ importers:
|
||||
'@typescript-eslint/parser': ^4.31.2
|
||||
'@vue/compiler-sfc': ^3.2.18
|
||||
'@vue/component-compiler-utils': ^3.2.2
|
||||
'@vue/test-utils': 2.0.0-beta.4
|
||||
'@vue/test-utils': 2.0.0-rc.15
|
||||
'@vueuse/core': ~6.1.0
|
||||
algoliasearch: ^4.10.5
|
||||
async-validator: ^4.0.3
|
||||
@ -119,7 +119,7 @@ importers:
|
||||
'@typescript-eslint/parser': 4.31.2_eslint@7.32.0+typescript@4.4.3
|
||||
'@vue/compiler-sfc': 3.2.18
|
||||
'@vue/component-compiler-utils': 3.2.2
|
||||
'@vue/test-utils': 2.0.0-beta.4_vue@3.2.18
|
||||
'@vue/test-utils': 2.0.0-rc.15_vue@3.2.18
|
||||
algoliasearch: 4.10.5
|
||||
chalk: 4.1.2
|
||||
clipboard-copy: 4.0.1
|
||||
@ -176,7 +176,7 @@ importers:
|
||||
dependencies:
|
||||
'@vueuse/core': 6.4.1_vue@3.2.18
|
||||
axios: 0.21.4
|
||||
element-plus: 1.1.0-beta.18_vue@3.2.18
|
||||
element-plus: 1.1.0-beta.19_vue@3.2.18
|
||||
marked: 3.0.4
|
||||
normalize.css: 8.0.1
|
||||
nprogress: 0.2.0
|
||||
@ -2059,10 +2059,10 @@ packages:
|
||||
resolution: {integrity: sha512-vFa2annVlbI082ICC3BH239UFO66nn2Syxy9shI7N2haPrc4rFRyNuDjWKJRe3sX7py4yhYL7fopB5tWGwGVyA==}
|
||||
dev: true
|
||||
|
||||
/@vue/test-utils/2.0.0-beta.4_vue@3.2.18:
|
||||
resolution: {integrity: sha512-uW3GdeEEQFTdRoYmBxxHs0ENpbt8jB6OeQ8JCiTuPQecP51dI8IcGXDJhzv7bjWG6Ej+KjaTxKEmEikCyhLWtQ==}
|
||||
/@vue/test-utils/2.0.0-rc.15_vue@3.2.18:
|
||||
resolution: {integrity: sha512-cb+Ri4PDRhtGCJuaLyl1HO9jXcwEj6AFwcNXace8FhhwelDzOdjyIgOb25xtDiUojzWjPuzGLKZQr/5WB7MLew==}
|
||||
peerDependencies:
|
||||
vue: ^3.0.0-rc.10
|
||||
vue: ^3.0.1
|
||||
dependencies:
|
||||
vue: 3.2.18
|
||||
dev: true
|
||||
@ -3847,8 +3847,8 @@ packages:
|
||||
resolution: {integrity: sha512-2jtSwgyiRzybHRxrc2nKI+39wH3AwQgn+sogQ+q814gv8hIFwrcZbV07Ea9f8AmK0ufPVZUvvAG1uZJ+obV4Jw==}
|
||||
dev: true
|
||||
|
||||
/element-plus/1.1.0-beta.18_vue@3.2.18:
|
||||
resolution: {integrity: sha512-Q2cscYlpcbq/enuU/vlPLBP5K4bHkPakF6IkCiDrSgOkAr7XQYMem6QUOCRZ/8PFV0UnJRMyPJ7Xt0PKTFi8mg==}
|
||||
/element-plus/1.1.0-beta.19_vue@3.2.18:
|
||||
resolution: {integrity: sha512-eKJId8un12eoaL88lfLMBtDxRUJfrAQP3bav9p2QG2agOXu3cvYDGBtT773P0ZEm3/97t+itRbxYIYYLV4iNeQ==}
|
||||
peerDependencies:
|
||||
vue: ^3.2.0
|
||||
dependencies:
|
||||
|
Loading…
Reference in New Issue
Block a user