浏览代码

feat(dialog): test config

richard1015 3 年之前
父节点
当前提交
852480c838

+ 2 - 2
src/packages/__VUE/button/doc.md

@@ -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

+ 2 - 2
src/packages/__VUE/cell/__tests__/cell.spec.ts

@@ -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
   };
 });
 

+ 52 - 0
src/packages/__VUE/dialog/__tests__/index.spec.ts

@@ -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'))
+});