浏览代码

test(backtop,badge): add test (#1108)

liqiong-lab 3 年之前
父节点
当前提交
78ce3c927b

+ 0 - 3
src/packages/__VUE/backtop/__tests__/__snapshots__/backtop.spec.ts.snap

@@ -1,3 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should allow to use the elId prop 1`] = `"<div class=\\"nut-backtop\\" style=\\"right: 10px; bottom: 20px; z-index: 10;\\"><i class=\\"nutui-iconfont nut-icon nut-icon-top nut-backtop-main\\" style=\\"font-size: 19px; width: 19px; height: 19px;\\" src=\\"\\"></i></div>"`;

+ 0 - 10
src/packages/__VUE/backtop/__tests__/backtop.spec.ts

@@ -54,13 +54,3 @@ test('backtop style', () => {
   const backtop: any = wrapper.find('.nut-backtop');
   expect(backtop.element.style.zIndex).toBe('100');
 });
-
-test('should allow to use the elId prop', () => {
-  const wrapper = mount(BackTop, {
-    props: {
-      elId: () => 'elId'
-    }
-  });
-
-  expect(wrapper.html()).toMatchSnapshot();
-});

+ 0 - 33
src/packages/__VUE/badge/__test__/__snapshots__/badge.spec.ts.snap

@@ -1,33 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`should change dot position when using offset prop: -2px 1`] = `""`;
-
-exports[`should change dot position when using offset prop: 4px 1`] = `""`;
-
-exports[`should render content slot correctly 1`] = `
-"<view class=\\"nut-badge\\">
-  <view class=\\"slot-icons\\"></view>
-  <view class=\\"nut-badge__content sup\\" style=\\"top: 0px; right: 0px; z-index: 9; display: none;\\"></view>
-</view>"
-`;
-
-exports[`should render nothing when content is empty string 1`] = `
-"<view class=\\"nut-badge\\" content=\\"\\">
-  <view class=\\"slot-icons\\"></view>
-  <view class=\\"nut-badge__content sup\\" style=\\"top: 0px; right: 0px; z-index: 9; display: none;\\"></view>
-</view>"
-`;
-
-exports[`should render nothing when content is undefined 1`] = `
-"<view class=\\"nut-badge\\">
-  <view class=\\"slot-icons\\"></view>
-  <view class=\\"nut-badge__content sup\\" style=\\"top: 0px; right: 0px; z-index: 9; display: none;\\"></view>
-</view>"
-`;
-
-exports[`should render nothing when content is zero 1`] = `
-"<view class=\\"nut-badge\\" content=\\"0\\">
-  <view class=\\"slot-icons\\"></view>
-  <view class=\\"nut-badge__content sup\\" style=\\"top: 0px; right: 0px; z-index: 9; display: none;\\"></view>
-</view>"
-`;

+ 4 - 4
src/packages/__VUE/badge/__test__/badge.spec.ts

@@ -4,7 +4,7 @@ import { mount } from '@vue/test-utils';
 test('should render nothing when content is empty string', () => {
   const wrapper = mount(Badge, {
     props: {
-      content: ''
+      value: ''
     }
   });
 
@@ -14,7 +14,7 @@ test('should render nothing when content is empty string', () => {
 test('should render nothing when content is undefined', () => {
   const wrapper = mount(Badge, {
     props: {
-      content: undefined
+      value: undefined
     }
   });
 
@@ -24,7 +24,7 @@ test('should render nothing when content is undefined', () => {
 test('should render nothing when content is zero', () => {
   const wrapper = mount(Badge, {
     props: {
-      content: 0
+      value: 0
     }
   });
 
@@ -34,7 +34,7 @@ test('should render nothing when content is zero', () => {
 test('should render content slot correctly', () => {
   const wrapper = mount(Badge, {
     slots: {
-      content: () => 'Custom Content'
+      default: () => 'Custom Content'
     }
   });