import { mount } from '@vue/test-utils' import WdIndexAnchor from '@/uni_modules/wot-design-uni/components/wd-index-anchor/wd-index-anchor.vue' import { describe, test, expect, vi } from 'vitest' describe('WdIndexAnchor', () => { // 测试基本渲染 test('基本渲染', () => { const wrapper = mount(WdIndexAnchor, { props: { index: 'A' } }) expect(wrapper.html()).toContain('wd-index-anchor') expect(wrapper.text()).toBe('A') }) // 测试自定义索引 test('显示自定义索引', () => { const index = 'B' const wrapper = mount(WdIndexAnchor, { props: { index } }) expect(wrapper.text()).toBe(index) }) // 测试数字索引 test('显示数字索引', () => { const index = 1 const wrapper = mount(WdIndexAnchor, { props: { index } }) expect(wrapper.text()).toBe('1') }) // 测试插槽内容 test('渲染插槽内容', () => { const wrapper = mount(WdIndexAnchor, { props: { index: 'A' }, slots: { default: '