import { markRaw, nextTick, ref } from 'vue' import { mount } from '@vue/test-utils' import { describe, expect, it, test } from 'vitest' import { Loading, Search } from '@element-plus/icons-vue' import Button from '../src/button.vue' import ButtonGroup from '../src/button-group.vue' import type { ComponentSize } from '@element-plus/constants' const AXIOM = 'Rem is the best girl' describe('Button.vue', () => { it('create', () => { const wrapper = mount(() => ), }) expect(wrapper.find('.custom-loading').exists()).toBeTruthy() }) }) describe('Button Group', () => { it('create', () => { const wrapper = mount({ setup: () => () => ( ), }) expect(wrapper.classes()).toContain('el-button-group') expect(wrapper.findAll('button').length).toBe(2) }) it('button group reactive size', async () => { const size = ref('small') const wrapper = mount({ setup: () => () => ( ), }) expect(wrapper.classes()).toContain('el-button-group') expect( wrapper.findAll('.el-button-group button.el-button--small').length ).toBe(2) size.value = 'large' await nextTick() expect( wrapper.findAll('.el-button-group button.el-button--large').length ).toBe(2) }) it('button group type', async () => { const wrapper = mount({ setup: () => () => ( ), }) expect(wrapper.classes()).toContain('el-button-group') expect( wrapper.findAll('.el-button-group button.el-button--primary').length ).toBe(1) expect( wrapper.findAll('.el-button-group button.el-button--warning').length ).toBe(1) }) it('add space in two Chinese characters', async () => { const wrapper = mount(() => ( )) expect(wrapper.find('.el-button span').text()).toBe('中文') expect(wrapper.find('.el-button span').classes()).toContain( 'el-button__text--expand' ) }) })