@@ -300,164 +300,6 @@ const textTests = (Component: any, componentName: string) => {
300300 expect ( caughtError ?. message ) . toContain ( 'maxLength props must be used with string' ) ;
301301 } ) ;
302302
303- it ( 'should apply the gutterBottomSpace property from theme provider' , ( ) => {
304- const { getByTestId } = testingRenderer (
305- < ThemeProvider components = { { textProps : { gutterBottomSpace : 20 } } } >
306- < Component testID = { mockTestId } gutterBottom >
307- Mock label
308- </ Component >
309- </ ThemeProvider > ,
310- ) ;
311- const text = getByTestId ( mockTestId ) ;
312- expect ( text . props . style ) . toEqual ( expect . objectContaining ( { marginBottom : 20 } ) ) ;
313- } ) ;
314-
315- it ( 'should override the root gutterBottomSpace property' , ( ) => {
316- const { getByTestId } = testingRenderer (
317- < ThemeProvider components = { { textProps : { gutterBottomSpace : 20 } } } >
318- < Component testID = { mockTestId } gutterBottom overrideRootGutterBottomConfig gutterBottomSpace = { 10 } >
319- Mock label
320- </ Component >
321- </ ThemeProvider > ,
322- ) ;
323- const text = getByTestId ( mockTestId ) ;
324- expect ( text . props . style ) . toEqual ( expect . objectContaining ( { marginBottom : 10 } ) ) ;
325- } ) ;
326-
327- it ( 'should apply the maxLength property from theme provider' , ( ) => {
328- const { getByText } = testingRenderer (
329- < ThemeProvider components = { { textProps : { maxLength : 10 } } } >
330- < Component > Sample Text</ Component >
331- </ ThemeProvider > ,
332- ) ;
333- expect ( getByText ( 'Sample Tex...' ) ) . toBeTruthy ( ) ;
334- } ) ;
335-
336- it ( 'should override the root maxLength property' , ( ) => {
337- const { getByText } = testingRenderer (
338- < ThemeProvider components = { { textProps : { maxLength : 10 } } } >
339- < Component maxLength = { 5 } > Sample Text</ Component >
340- </ ThemeProvider > ,
341- ) ;
342- expect ( getByText ( 'Sampl...' ) ) . toBeTruthy ( ) ;
343- } ) ;
344-
345- it ( 'should apply the root errorColor property' , ( ) => {
346- const { getByTestId } = testingRenderer (
347- < ThemeProvider components = { { textProps : { errorColor : 'green' } } } >
348- < Component testID = { mockTestId } error >
349- Sample Text
350- </ Component >
351- </ ThemeProvider > ,
352- ) ;
353-
354- const text = getByTestId ( mockTestId ) ;
355- expect ( text . props . style ) . toEqual ( expect . objectContaining ( { color : 'green' } ) ) ;
356- } ) ;
357-
358- it ( 'should override the root errorColor property' , ( ) => {
359- const { getByTestId } = testingRenderer (
360- < ThemeProvider components = { { textProps : { errorColor : 'green' } } } >
361- < Component testID = { mockTestId } error errorColor = { 'red' } >
362- Sample Text
363- </ Component >
364- </ ThemeProvider > ,
365- ) ;
366-
367- const text = getByTestId ( mockTestId ) ;
368- expect ( text . props . style ) . toEqual ( expect . objectContaining ( { color : 'red' } ) ) ;
369- } ) ;
370-
371- it ( 'should apply the root activeColor property' , ( ) => {
372- const { getByTestId } = testingRenderer (
373- < ThemeProvider components = { { textProps : { activeColor : 'green' } } } >
374- < Component testID = { mockTestId } isActive >
375- Sample Text
376- </ Component >
377- </ ThemeProvider > ,
378- ) ;
379-
380- const text = getByTestId ( mockTestId ) ;
381- expect ( text . props . style ) . toEqual ( expect . objectContaining ( { color : 'green' } ) ) ;
382- } ) ;
383-
384- it ( 'should override the root activeColor property' , ( ) => {
385- const { getByTestId } = testingRenderer (
386- < ThemeProvider components = { { textProps : { activeColor : 'green' } } } >
387- < Component testID = { mockTestId } isActive activeColor = { 'red' } >
388- Sample Text
389- </ Component >
390- </ ThemeProvider > ,
391- ) ;
392-
393- const text = getByTestId ( mockTestId ) ;
394- expect ( text . props . style ) . toEqual ( expect . objectContaining ( { color : 'red' } ) ) ;
395- } ) ;
396-
397- it ( 'should override the root color property' , ( ) => {
398- const { getByTestId } = testingRenderer (
399- < ThemeProvider components = { { textProps : { color : 'green' } } } >
400- < Component testID = { mockTestId } color = { 'red' } >
401- Sample Text
402- </ Component >
403- </ ThemeProvider > ,
404- ) ;
405-
406- const text = getByTestId ( mockTestId ) ;
407- expect ( text . props . style ) . toEqual ( expect . objectContaining ( { color : 'red' } ) ) ;
408- } ) ;
409-
410- it ( 'should apply the root styles' , ( ) => {
411- const { getByTestId } = testingRenderer (
412- < ThemeProvider
413- components = { {
414- textProps : {
415- style : {
416- fontSize : 20 ,
417- fontWeight : 'bold' ,
418- } ,
419- } ,
420- } } >
421- < Component testID = { mockTestId } > Sample text</ Component >
422- </ ThemeProvider > ,
423- ) ;
424-
425- const text = getByTestId ( mockTestId ) ;
426- expect ( text . props . style ) . toEqual (
427- expect . objectContaining ( {
428- fontSize : 20 ,
429- fontWeight : 'bold' ,
430- } ) ,
431- ) ;
432- } ) ;
433-
434- it ( 'should merge the root styles and component styles' , ( ) => {
435- const { getByTestId } = testingRenderer (
436- < ThemeProvider
437- components = { {
438- textProps : {
439- style : {
440- fontSize : 20 ,
441- fontWeight : 'bold' ,
442- } ,
443- } ,
444- } } >
445- < Component testID = { mockTestId } style = { { color : 'green' } } >
446- Sample text
447- </ Component >
448- </ ThemeProvider > ,
449- ) ;
450-
451- const text = getByTestId ( mockTestId ) ;
452- expect ( text . props . style ) . toEqual (
453- expect . objectContaining ( {
454- fontSize : 20 ,
455- fontWeight : 'bold' ,
456- color : 'green' ,
457- } ) ,
458- ) ;
459- } ) ;
460-
461303 Object . entries ( themeVariants ) . forEach ( ( [ variant , expectedStyle ] ) => {
462304 it ( `should apply the '${ variant } ' text theme variant` , ( ) => {
463305 const { getByTestId } = render (
0 commit comments