|
8 | 8 | defaultLightTheme, |
9 | 9 | Divider, |
10 | 10 | DividerColorThemeConfig, |
| 11 | + IconInput, |
11 | 12 | Text, |
12 | 13 | themeDimensions, |
13 | 14 | ThemeProvider, |
@@ -124,6 +125,36 @@ describe('V2ThemeContext', () => { |
124 | 125 | }); |
125 | 126 |
|
126 | 127 | describe('ThemeProvider component config', () => { |
| 128 | + const iconInputWrapperTestId = 'icon-input-test-id'; |
| 129 | + |
| 130 | + describe('iconInputProps', () => { |
| 131 | + it('should adopted theme inputWrapperStyles prop', () => { |
| 132 | + const { getByTestId } = themeRender( |
| 133 | + <ThemeProvider |
| 134 | + components={{ iconInputProps: { inputWrapperStyles: { width: 100, height: 100, backgroundColor: 'red' } } }}> |
| 135 | + <IconInput testID={iconInputWrapperTestId} /> |
| 136 | + </ThemeProvider>, |
| 137 | + ); |
| 138 | + |
| 139 | + const inputWrapper = getByTestId(`${iconInputWrapperTestId}-wrapper`); |
| 140 | + const flattenStyles = StyleSheet.flatten(inputWrapper.props.style); |
| 141 | + expect(flattenStyles).toEqual(expect.objectContaining({ width: 100, height: 100, backgroundColor: 'red' })); |
| 142 | + }); |
| 143 | + |
| 144 | + it('should marge theme inputWrapperStyles prop and inputWrapperStyles component prop', () => { |
| 145 | + const { getByTestId } = themeRender( |
| 146 | + <ThemeProvider |
| 147 | + components={{ iconInputProps: { inputWrapperStyles: { width: 100, height: 100, backgroundColor: 'red' } } }}> |
| 148 | + <IconInput testID={iconInputWrapperTestId} inputWrapperStyles={{ width: 10, backgroundColor: 'green' }} /> |
| 149 | + </ThemeProvider>, |
| 150 | + ); |
| 151 | + |
| 152 | + const inputWrapper = getByTestId(`${iconInputWrapperTestId}-wrapper`); |
| 153 | + const flattenStyles = StyleSheet.flatten(inputWrapper.props.style); |
| 154 | + expect(flattenStyles).toEqual(expect.objectContaining({ width: 10, backgroundColor: 'green' })); |
| 155 | + }); |
| 156 | + }); |
| 157 | + |
127 | 158 | describe('textProps', () => { |
128 | 159 | const mockTextThemeConfig: TextVariationThemeConfig = { |
129 | 160 | body1: { fontSize: 10, fontWeight: '100' }, |
|
0 commit comments