mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-19 15:01:57 +08:00

* fix(components): sSR hydration error caused by disabled prop of teleport * fix(components): [teleport] type error * chore: type error
41 lines
854 B
TypeScript
41 lines
854 B
TypeScript
import { mount } from '@vue/test-utils'
|
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
import Teleport from '../src/teleport.vue'
|
|
|
|
const AXIOM = 'rem is the best girl'
|
|
|
|
describe('ElTeleport', () => {
|
|
afterEach(() => {
|
|
document.body.innerHTML = ''
|
|
})
|
|
|
|
it('should render slot to body', () => {
|
|
const wrapper = mount(() => (
|
|
<Teleport
|
|
to="body"
|
|
v-slots={{
|
|
default: () => AXIOM,
|
|
}}
|
|
/>
|
|
))
|
|
|
|
expect(wrapper.text()).toBe('')
|
|
expect(document.body.textContent).toBe(AXIOM)
|
|
})
|
|
|
|
it('should render slot correctly', () => {
|
|
const wrapper = mount(() => (
|
|
<Teleport
|
|
to="body"
|
|
disabled
|
|
v-slots={{
|
|
default: () => AXIOM,
|
|
}}
|
|
/>
|
|
))
|
|
|
|
expect(wrapper.text()).toBe(AXIOM)
|
|
expect(document.body.textContent).toBe('')
|
|
})
|
|
})
|