Files
element-plus/packages/components/text/__tests__/text.test.tsx
gimjin 4b5a9bf279 fix(components): [text] not support multi-line ellipsis (#11976)
* docs(components): [text] line-clamp prop and update example

* test(components): [text] line-clamp test

* fix(components): [text] not support multi-line ellipsis

* docs: updata

---------

Co-authored-by: qiang <qw13131wang@gmail.com>
2023-10-13 11:26:54 +08:00

56 lines
1.2 KiB
TypeScript

import { mount } from '@vue/test-utils'
import { describe, expect, test } from 'vitest'
import Text from '../src/text.vue'
const AXIOM = 'Rem is the best girl'
describe('Text.vue', () => {
test('create', () => {
const wrapper = mount(() => <Text />)
expect(wrapper.classes()).toContain('el-text')
})
test('type', () => {
const wrapper = mount(() => <Text type="success" />)
expect(wrapper.classes()).toContain('el-text--success')
})
test('size', () => {
const wrapper = mount(() => <Text size="large" />)
expect(wrapper.classes()).toContain('el-text--large')
})
test('truncated', () => {
const wrapper = mount(() => <Text truncated />)
expect(wrapper.classes()).toContain('is-truncated')
})
test('line-clamp', () => {
const wrapper = mount(() => <Text line-clamp="2" />)
expect(wrapper.classes()).toContain('is-line-clamp')
})
test('tag', () => {
const wrapper = mount(() => <Text tag="del" />)
expect(wrapper.vm.$el.tagName).toEqual('DEL')
})
test('default slot', () => {
const wrapper = mount(() => (
<Text
v-slots={{
default: () => AXIOM,
}}
/>
))
expect(wrapper.text()).toEqual(AXIOM)
})
})