File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @format
3+ */
4+
5+ import 'react-native' ;
6+ import React from 'react' ;
7+ import Swiper , { dataSourceType } from '../lib/Swiper' ;
8+ import renderer from 'react-test-renderer' ;
9+
10+ it ( 'Swiper' , ( ) => {
11+ const datas : dataSourceType [ ] = [
12+ {
13+ url : 'https://p1.itc.cn/images01/20210530/7a071b3cdc0643c197f143cfa4edc827.jpeg' ,
14+ onClick : ( ) => {
15+ console . log ( '你好!刘亦菲' ) ;
16+ } ,
17+ } ,
18+ {
19+ url : 'https://inews.gtimg.com/newsapp_bt/0/14745270054/641' ,
20+ onClick : ( ) => {
21+ console . log ( '你好!王楚然' ) ;
22+ } ,
23+ } ,
24+ ] ;
25+ const component = renderer . create (
26+ < Swiper width = { 200 } dataSource = { datas } height = { 150 } borderRadius = { 24 } time = { 10 } autoplay dotStyle = "dot" loading /> ,
27+ ) ;
28+ expect ( component . root . props . width ) . toBe ( 200 ) ;
29+ expect ( component . root . props . height ) . toBe ( 150 ) ;
30+ expect ( component . root . props . borderRadius ) . toBe ( 24 ) ;
31+ expect ( component . root . props . time ) . toBe ( 10 ) ;
32+ expect ( component . root . props . dotStyle ) . toBe ( 'dot' ) ;
33+ expect ( component . root . props . dataSource ) . toMatchObject ( datas ) ;
34+ expect ( component . root . props . autoplay ) . toBeTruthy ( ) ;
35+ expect ( component . root . props . loading ) . toBeTruthy ( ) ;
36+ } ) ;
You can’t perform that action at this time.
0 commit comments