Skip to content

fix: Carousel component test case #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions packages/devui-vue/devui/carousel/__tests__/carousel.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ref, nextTick } from 'vue'
import { mount } from '@vue/test-utils';
import Carousel from '../carousel';
import CarouselItem from '../item';
import Button from '../../button'
import { CarouselItem, Carousel } from '../index';
import { Button } from '../../button'

const wait = (ms = 100) =>
new Promise(resolve => setTimeout(() => resolve(), ms))
Expand Down Expand Up @@ -140,13 +139,13 @@ describe('d-carousel', () => {
<d-carousel-item v-for="item in items" :key="item">{{ item }} </d-carousel-item>
</d-carousel>
<div class="carousel-demo-operate">
<d-button bsStyle="common" :btnClick="onPrev">上一张</d-button>
<d-button bsStyle="primary" :btnClick="onNext">下一张</d-button>
<d-button bsStyle="common" :btnClick="onGoFirst">第一张</d-button>
<d-button bsStyle="common" :onClick="onPrev">上一张</d-button>
<d-button bsStyle="primary" :onClick="onNext">下一张</d-button>
<d-button bsStyle="common" :onClick="onGoFirst">第一张</d-button>
</div>
`,
setup() {
const items = ref<string[]>(["page 1", 'page 2', 'page 3', 'page 4'])
const items = ref<string[]>(['page 1', 'page 2', 'page 3', 'page 4'])
const activeIndex = ref(0)

const carousel = ref()
Expand Down
9 changes: 5 additions & 4 deletions packages/devui-vue/devui/carousel/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import type { App } from 'vue'
import Carousel from './src/carousel'
import CarouseItem from './src/item'
import CarouselItem from './src/item'

Carousel.install = function(app: App) {
app.component(Carousel.name, Carousel)
}

CarouseItem.install = function(app: App) {
app.component(CarouseItem.name, CarouseItem);
CarouselItem.install = function(app: App) {
app.component(CarouselItem.name, CarouselItem);
}

export { Carousel }
export { CarouselItem }

export default {
title: 'Carousel 走马灯',
category: '数据展示',
status: '80%',
install(app: App): void {
app.use(Carousel as any)
app.use(CarouseItem as any)
app.use(CarouselItem as any)
}
}