Skip to content

Commit

Permalink
test: update
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu committed Nov 20, 2023
1 parent c8d81cd commit 954f9e5
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('should render width and height', async () => {
'nut-swiper-item': SwiperItem
},
template: `
<nut-swiper :init-page="page" :pagination-visible="true" pagination-color="#426543" auto-play="2000" :height="height">
<nut-swiper :init-page="page" :pagination-visible="true" pagination-color="#426543" auto-play="2000" :height="height" :width="width">
<nut-swiper-item v-for="item in list" :key="item">
<img :src="item" alt="" />
</nut-swiper-item>
Expand All @@ -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',
Expand All @@ -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 () => {
Expand Down

0 comments on commit 954f9e5

Please sign in to comment.