Browse Source

test(noticebar): add props

Drjnigfubo 3 years ago
parent
commit
7667cc28b5
1 changed files with 21 additions and 1 deletions
  1. 21 1
      src/packages/__VUE/noticebar/__tests__/noticebar.spec.ts

+ 21 - 1
src/packages/__VUE/noticebar/__tests__/noticebar.spec.ts

@@ -28,12 +28,32 @@ test('close event', async () => {
     props: {
       text: '华为畅享9新品即将上市,活动期间0元预约可参与抽奖,赢HUAWEI WATCH等好礼,更多产品信息请持续关注!',
       direction: 'across',
-      closeMode: true
+      closeMode: true,
+      color: 'red',
+      background: 'green',
+      delay: 1
     }
   });
   const closeDom = wrapper.find('.right-icon');
   closeDom.trigger('click');
   expect(wrapper.emitted('close')).toBeTruthy();
+  wrapper.setProps({
+    text: '123'
+  });
+  await nextTick();
+  const content = wrapper.find('.content');
+  expect(content.html()).toContain('123');
+});
+
+test('slot event', async () => {
+  const wrapper = mount(NoticeBar, {
+    slots: {
+      default: () => 'Custom Content'
+    }
+  });
+  await nextTick();
+  const content = wrapper.find('.content');
+  expect(content.html()).toContain('Custom Content');
 });
 
 test('icon custom', async () => {