diff --git a/src/back-top/__test__/index.test.jsx b/src/back-top/__test__/index.test.jsx index 6b01bb88e..602945dff 100644 --- a/src/back-top/__test__/index.test.jsx +++ b/src/back-top/__test__/index.test.jsx @@ -1,7 +1,8 @@ +import { ref } from 'vue'; import { describe, it, expect, vi } from 'vitest'; -import BackTop from '../back-top.vue'; import { mount } from '@vue/test-utils'; -import { AppIcon as TIconApp } from 'tdesign-icons-vue-next'; +import { BacktopIcon as TIconBackTop, AppIcon as TIconApp } from 'tdesign-icons-vue-next'; +import BackTop from '../back-top.vue'; describe('BackTop', () => { describe('props', () => { @@ -56,6 +57,13 @@ describe('BackTop', () => { await wrapper.find('.t-back-top').trigger('click'); expect(window.document.documentElement.scrollTop).toEqual(10); }); + + it(': icon', () => { + const icon = ref(false); + const wrapper = mount(); + icon.value = true; + expect(wrapper.findComponent(TIconBackTop)).toBeTruthy(); + }); }); describe('slots', () => {