Skip to content

Commit 7eab93c

Browse files
authored
fix: 日历组件调整 (#1090)
1 parent 916d42a commit 7eab93c

File tree

7 files changed

+915
-61
lines changed

7 files changed

+915
-61
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`should change icon class prefix when using icon-class-prefix prop 1`] = `
4+
"<view class=\\"nut-button nut-button--default nut-button--normal nut-button--round\\">
5+
<view class=\\"nut-button__warp\\">
6+
<!--v-if--><i class=\\"nutui-iconfont nut-icon my-icon-star-fill\\" src=\\"\\"></i>
7+
<!--v-if-->
8+
</view>
9+
</view>"
10+
`;

src/packages/__VUE/button/__tests__/button.spec.ts

+38-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { mount } from '@vue/test-utils';
22
import Button from '../index.vue';
3-
3+
import { nextTick } from 'vue';
44
test('emit click event', () => {
55
const wrapper = mount(Button);
66

@@ -16,3 +16,40 @@ test('slot test', async () => {
1616
});
1717
expect(wrapper.html()).toContain('按钮测试');
1818
});
19+
test('should emit click event', () => {
20+
const wrapper = mount(Button);
21+
22+
wrapper.trigger('click');
23+
expect(wrapper.emitted('click')).toHaveLength(1);
24+
});
25+
26+
test('should not allow click when set disabled props', async () => {
27+
const wrapper = mount(Button, {
28+
props: {
29+
disabled: true
30+
}
31+
});
32+
wrapper.trigger('click');
33+
await nextTick();
34+
expect(wrapper.emitted('click')).toBeFalsy();
35+
});
36+
test('should not emit click event when loading', () => {
37+
const wrapper = mount(Button, {
38+
props: {
39+
loading: true
40+
}
41+
});
42+
43+
wrapper.trigger('click');
44+
expect(wrapper.emitted('click')).toBeFalsy();
45+
});
46+
test('should change icon class prefix when using icon-class-prefix prop', () => {
47+
const wrapper = mount(Button, {
48+
props: {
49+
icon: 'star-fill',
50+
iconClassPrefix: 'my-icon'
51+
}
52+
});
53+
54+
expect(wrapper.html()).toMatchSnapshot();
55+
});

0 commit comments

Comments
 (0)