File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ import Ellipsis from '../lib/Ellipsis' ;
2+ import renderer from 'react-test-renderer' ;
3+
4+ it ( 'Ellipsis' , ( ) => {
5+ const component = renderer . create (
6+ < Ellipsis maxLen = { 5 } placeholder = '...' > 用于文本过长,超出长度显示</ Ellipsis >
7+ ) ;
8+ expect ( component . root . props . maxLen ) . toBe ( 5 ) ;
9+ expect ( component . root . props . placeholder ) . toBe ( '...' ) ;
10+ expect ( component . root . props . children ) . toBe ( '用于文本过长,超出长度显示' ) ;
11+ } ) ;
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 ExpandableSection from '../lib/ExpandableSection' ;
8+ import { View , Text } from 'react-native' ;
9+ import renderer from 'react-test-renderer' ;
10+
11+ it ( 'ExpandableSection' , ( ) => {
12+ const component = renderer . create (
13+ < ExpandableSection sectionHeader = { < h5 > 我是标题</ h5 > } expanded = { true } top = { true } >
14+ < View >
15+ < Text style = { { color : 'red' } } > 展开的内容</ Text >
16+ </ View >
17+ </ ExpandableSection > ,
18+ ) ;
19+
20+ expect ( component . root . props . top ) . toBeTruthy ( ) ;
21+ expect ( component . root . props . expanded ) . toBeTruthy ( ) ;
22+ expect ( component . root . props . sectionHeader ) . toStrictEqual ( < h5 > 我是标题</ h5 > ) ;
23+ expect ( component . root . props . children ) . toStrictEqual (
24+ < View >
25+ < Text style = { { color : 'red' } } > 展开的内容</ Text >
26+ </ View >
27+ ) ;
28+ } ) ;
You can’t perform that action at this time.
0 commit comments