Skip to content

Commit

Permalink
test(backtop): add test cases (#810)
Browse files Browse the repository at this point in the history
* test(backtop): add test cases

* test(backtop): update test cases

* test(backtop): update test cases
  • Loading branch information
palmcivet committed Jun 6, 2023
1 parent c87bba9 commit 1785af2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/back-top/__test__/index.test.jsx
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down Expand Up @@ -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(<BackTop icon={icon.value} />);
icon.value = true;
expect(wrapper.findComponent(TIconBackTop)).toBeTruthy();
});
});

describe('slots', () => {
Expand Down

0 comments on commit 1785af2

Please sign in to comment.