mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
* 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>
56 lines
1.2 KiB
TypeScript
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)
|
|
})
|
|
})
|