Skip to content

Commit

Permalink
feat(dialog): test config
Browse files Browse the repository at this point in the history
  • Loading branch information
richard1015 committed Feb 25, 2022
1 parent bb65b3f commit 852480c
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/packages/__VUE/button/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ app.use(Button);
| disabled | 是否禁用按钮 | Boolean | `false` |
| block | 是否为块级元素 | Boolean | `false` |
| icon | 按钮图标,同 Icon 组件 name 属性 | String | - |
| icon-font-class-name | 自定义 icon 字体基础类名 | String | `nutui-iconfont` |
| icon-class-prefix | 自定义 icon 类名前缀,用于使用自定义图标 | String | `nut-icon` |
| icon-font-class-name`v3.1.17` | 自定义 icon 字体基础类名 | String | `nutui-iconfont` |
| icon-class-prefix `v3.1.17` | 自定义 icon 类名前缀,用于使用自定义图标 | String | `nut-icon` |
| loading | 按钮 loading 状态 | Boolean | `false` |

### Events
Expand Down
4 changes: 2 additions & 2 deletions src/packages/__VUE/cell/__tests__/cell.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { config, mount } from '@vue/test-utils';
import Cell from '../index.vue';
import NutIcon from '../../icon/index.vue';
import Icon from '../../icon/index.vue';
import { nextTick } from 'vue';

beforeAll(() => {
config.global.components = {
NutIcon
[Icon.name]: Icon
};
});

Expand Down
52 changes: 52 additions & 0 deletions src/packages/__VUE/dialog/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { config, mount } from '@vue/test-utils';
import DialogTemplate from '../index.vue';
import { Dialog } from '../index';
import Icon from '../../icon/index.vue';
import Popup from '../../popup/index.vue';
import Button from '../../button/index.vue';
import OverLay from '../../overLay/index.vue';
import { nextTick } from 'vue';

beforeAll(() => {
config.global.components = {
[Icon.name]: Icon,
[Popup.name]: Popup,
[Button.name]: Button,
[OverLay.name]: OverLay
};
});

beforeEach(() => {
// create teleport target
const el = document.createElement('div');
el.id = 'app';
document.body.appendChild(el);
});

afterEach(() => {
// clean up
document.body.outerHTML = '';
});

test('should render dialog template', async () => {
const wrapper = mount(DialogTemplate, {
props: {
title: 't1',
content: 'c1'
}
});

const overLay = wrapper.getComponent(OverLay);
expect(await overLay.find('.nut-dialog__content'));
});

test('should render dialog methods', async () => {
// Dialog({
// title: '基础弹框',
// content: '支持函数调用和组件调用两种方式。',
// onCancel,
// onOk
// });
// const overLay = wrapper.getComponent(OverLay);
// expect(await overLay.find('.nut-dialog__content'))
});

0 comments on commit 852480c

Please sign in to comment.