From 954f9e510f1cccec00ad4d5add7f2f71139a931d Mon Sep 17 00:00:00 2001 From: Eiinu Date: Mon, 20 Nov 2023 22:50:07 +0800 Subject: [PATCH] test: update --- .../swiper/__tests__/{index.spec.ts => index.spec.tsx} | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) rename src/packages/__VUE/swiper/__tests__/{index.spec.ts => index.spec.tsx} (97%) diff --git a/src/packages/__VUE/swiper/__tests__/index.spec.ts b/src/packages/__VUE/swiper/__tests__/index.spec.tsx similarity index 97% rename from src/packages/__VUE/swiper/__tests__/index.spec.ts rename to src/packages/__VUE/swiper/__tests__/index.spec.tsx index 0419a7d46c..45f4b62b6a 100644 --- a/src/packages/__VUE/swiper/__tests__/index.spec.ts +++ b/src/packages/__VUE/swiper/__tests__/index.spec.tsx @@ -12,7 +12,7 @@ test('should render width and height', async () => { 'nut-swiper-item': SwiperItem }, template: ` - + @@ -21,7 +21,8 @@ test('should render width and height', async () => { setup() { const state = reactive({ page: 1, - height: '500', + width: 300, + height: 500, list: [ 'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg', 'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg', @@ -40,7 +41,7 @@ test('should render width and height', async () => { const swiperItem = wrapper.findAll('.nut-swiper-inner')[0].element as HTMLElement; expect(swiperItem.style.height).toEqual(`${wrapper.vm.height}px`); - expect(swiperItem.style.width).toEqual(`${window.innerWidth * (wrapper.vm.list as any).length}px`); + expect(swiperItem.style.width).toEqual(`${wrapper.vm.width * (wrapper.vm.list as any).length}px`); }); test('should render initpage', async () => {