1
1
import TextInput from '../TextInput' ;
2
- import { Constants } from '../../../helpers' ;
3
- import { Typography , Colors } from '../../../style' ;
4
-
2
+ import { Colors } from '../../../style' ;
5
3
6
4
describe ( 'TextInput' , ( ) => {
7
5
// beforeEach(() => {});
@@ -50,42 +48,6 @@ describe('TextInput', () => {
50
48
} ) ;
51
49
} ) ;
52
50
53
- describe ( 'getHeight' , ( ) => {
54
- it ( 'when not multiline, should setState not be called' , ( ) => {
55
- const uut = new TextInput ( { } ) ;
56
- jest . spyOn ( uut , 'setState' ) . mockImplementation ( ( ) => { } ) ;
57
- uut . getHeight ( ) ;
58
- expect ( uut . setState ) . not . toHaveBeenCalled ( ) ;
59
- } ) ;
60
-
61
- it ( 'should iOS, when only multiline, setState height with undefined' , ( ) => {
62
- const uut = new TextInput ( { multiline : true } ) ;
63
- jest . spyOn ( uut , 'setState' ) . mockImplementation ( ( ) => { } ) ;
64
- uut . getHeight ( ) ;
65
- expect ( uut . setState . height ) . toBeUndefined ( ) ;
66
- } ) ;
67
-
68
- it ( 'should iOS, when multiline and numberOfLines, setState height with typography * numberOfLines' , ( ) => {
69
- const uut = new TextInput ( { multiline : true , numberOfLines : 2 } ) ;
70
- jest . spyOn ( uut , 'setState' ) . mockImplementation ( ( ) => { } ) ;
71
- jest . spyOn ( uut , 'getTypography' ) ;
72
- uut . getTypography . mockReturnValue ( Typography . text70 ) ;
73
- const lineHeight = Typography . text70 . lineHeight ;
74
- const { numberOfLines} = uut . props ;
75
- const boxHeight = lineHeight * numberOfLines ;
76
- uut . getHeight ( ) ;
77
- expect ( uut . setState ) . toHaveBeenCalledWith ( { height : boxHeight } ) ;
78
- } ) ;
79
-
80
- it ( 'should Android, when multiline and numberOfLines, setState not be called' , ( ) => {
81
- mockAndroid ( ) ;
82
- const uut = new TextInput ( { multiline : true , numberOfLines : 2 } ) ;
83
- jest . spyOn ( uut , 'setState' ) . mockImplementation ( ( ) => { } ) ;
84
- uut . getHeight ( ) ;
85
- expect ( uut . setState ) . not . toHaveBeenCalled ( ) ;
86
- } ) ;
87
- } ) ;
88
-
89
51
describe ( 'getCharCount' , ( ) => {
90
52
it ( 'should return 5 when value is "inbal"' , ( ) => {
91
53
const uut = new TextInput ( { value : 'inbal' } ) ;
@@ -108,8 +70,3 @@ describe('TextInput', () => {
108
70
} ) ;
109
71
} ) ;
110
72
} ) ;
111
-
112
- function mockAndroid ( ) {
113
- Constants . isIOS = false ;
114
- Constants . isAndroid = true ;
115
- }
0 commit comments