mirror of https://github.com/vuejs/core.git
wip(vitest-migration): compat tests passing
This commit is contained in:
parent
dca4224c2c
commit
e478755c7d
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import { vi } from 'vitest'
|
||||
import Vue from '@vue/compat'
|
||||
import { nextTick } from '@vue/runtime-core'
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import Vue from '@vue/compat'
|
||||
import {
|
||||
DeprecationTypes,
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import Vue from '@vue/compat'
|
||||
import {
|
||||
DeprecationTypes,
|
||||
|
@ -52,7 +55,7 @@ describe('COMPONENT_FUNCTIONAL', () => {
|
|||
expect(vm.$el.querySelector('.inject').textContent).toBe('123')
|
||||
expect(vm.$el.querySelector('.slot').textContent).toBe('hello')
|
||||
expect(vm.$el.outerHTML).toMatchInlineSnapshot(
|
||||
`"<div id="foo" class="foo"><div class="inject">123</div><div class="slot">hello</div></div>"`
|
||||
'"<div id=\\"foo\\" class=\\"foo\\"><div class=\\"inject\\">123</div><div class=\\"slot\\">hello</div></div>"'
|
||||
)
|
||||
|
||||
expect(
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import Vue from '@vue/compat'
|
||||
import { ComponentOptions } from '../../runtime-core/src/component'
|
||||
import { nextTick } from '../../runtime-core/src/scheduler'
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import Vue from '@vue/compat'
|
||||
import { CompilerDeprecationTypes } from '../../compiler-core/src'
|
||||
import {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import { vi } from 'vitest'
|
||||
import Vue from '@vue/compat'
|
||||
import { effect, isReactive } from '@vue/reactivity'
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import { vi } from 'vitest'
|
||||
import Vue from '@vue/compat'
|
||||
import {
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
import { vi } from 'vitest'
|
||||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import { vi, Mock } from 'vitest'
|
||||
import Vue from '@vue/compat'
|
||||
import { Slots } from '../../runtime-core/src/componentSlots'
|
||||
import { Text } from '../../runtime-core/src/vnode'
|
||||
|
@ -50,7 +53,7 @@ test('INSTANCE_DESTROY', () => {
|
|||
// https://github.com/vuejs/vue/blob/dev/test/unit/features/instance/methods-events.spec.js
|
||||
describe('INSTANCE_EVENT_EMITTER', () => {
|
||||
let vm: LegacyPublicInstance
|
||||
let spy: vi.Mock
|
||||
let spy: Mock
|
||||
|
||||
beforeEach(() => {
|
||||
vm = new Vue()
|
||||
|
@ -61,7 +64,7 @@ describe('INSTANCE_EVENT_EMITTER', () => {
|
|||
vm.$on('test', function (this: any) {
|
||||
// expect correct context
|
||||
expect(this).toBe(vm)
|
||||
spy.apply(this, arguments)
|
||||
spy.apply(this, arguments as unknown as any[])
|
||||
})
|
||||
vm.$emit('test', 1, 2, 3, 4)
|
||||
expect(spy).toHaveBeenCalledTimes(1)
|
||||
|
@ -74,7 +77,7 @@ describe('INSTANCE_EVENT_EMITTER', () => {
|
|||
it('$on multi event', () => {
|
||||
vm.$on(['test1', 'test2'], function (this: any) {
|
||||
expect(this).toBe(vm)
|
||||
spy.apply(this, arguments)
|
||||
spy.apply(this, arguments as unknown as any[])
|
||||
})
|
||||
vm.$emit('test1', 1, 2, 3, 4)
|
||||
expect(spy).toHaveBeenCalledTimes(1)
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import { vi } from 'vitest'
|
||||
import Vue from '@vue/compat'
|
||||
import { nextTick } from '../../runtime-core/src/scheduler'
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import { vi } from 'vitest'
|
||||
import Vue from '@vue/compat'
|
||||
import { nextTick } from '../../runtime-core/src/scheduler'
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import { ShapeFlags } from '@vue/shared'
|
||||
import Vue from '@vue/compat'
|
||||
import { createComponentInstance } from '../../runtime-core/src/component'
|
||||
|
|
Loading…
Reference in New Issue