@@ -3884,3 +3884,142 @@ test(`renders with a right icon when the left icon is undefined`, () => {
3884
3884
) ;
3885
3885
expect ( onPress ) . not . toHaveBeenCalled ( ) ;
3886
3886
} ) ;
3887
+
3888
+ test ( `renders with a font weight` , ( ) => {
3889
+ const Component = createButtonComponent ( {
3890
+ fontFamily : `Example Font Family` ,
3891
+ fontWeight : `700` ,
3892
+ fontSize : 16 ,
3893
+ horizontalPadding : 10 ,
3894
+ verticalPadding : 2 ,
3895
+ iconSpacing : 7 ,
3896
+ default : {
3897
+ backgroundColor : `yellow` ,
3898
+ color : `blue` ,
3899
+ radius : 25 ,
3900
+ border : {
3901
+ width : 5 ,
3902
+ color : `aquamarine` ,
3903
+ } ,
3904
+ } ,
3905
+ disabled : {
3906
+ backgroundColor : `orange` ,
3907
+ color : `purple` ,
3908
+ radius : 7 ,
3909
+ border : {
3910
+ width : 2 ,
3911
+ color : `aquamarine` ,
3912
+ } ,
3913
+ } ,
3914
+ } ) ;
3915
+ const onPress = jest . fn ( ) ;
3916
+
3917
+ const rendered = (
3918
+ < Component
3919
+ leftIcon = { ( ) => null }
3920
+ rightIcon = { ( ) => null }
3921
+ onPress = { onPress }
3922
+ disabled = { false }
3923
+ >
3924
+ Example Content
3925
+ </ Component >
3926
+ ) ;
3927
+
3928
+ expect ( unwrapRenderedFunctionComponent ( rendered ) ) . toEqual (
3929
+ < Hitbox
3930
+ disabled = { false }
3931
+ onPress = { onPress }
3932
+ style = { {
3933
+ backgroundColor : `yellow` ,
3934
+ borderRadius : 25 ,
3935
+ paddingHorizontal : 10 ,
3936
+ paddingVertical : 2 ,
3937
+ borderWidth : 5 ,
3938
+ borderColor : `aquamarine` ,
3939
+ alignItems : `center` ,
3940
+ } }
3941
+ >
3942
+ < Text
3943
+ style = { {
3944
+ color : `blue` ,
3945
+ fontFamily : `Example Font Family` ,
3946
+ fontSize : 16 ,
3947
+ lineHeight : 22.4 ,
3948
+ fontWeight : `700` ,
3949
+ } }
3950
+ >
3951
+ Example Content
3952
+ </ Text >
3953
+ </ Hitbox >
3954
+ ) ;
3955
+ expect ( onPress ) . not . toHaveBeenCalled ( ) ;
3956
+ } ) ;
3957
+
3958
+ test ( `renders with a font weight of undefined` , ( ) => {
3959
+ const Component = createButtonComponent ( {
3960
+ fontFamily : `Example Font Family` ,
3961
+ fontWeight : undefined ,
3962
+ fontSize : 16 ,
3963
+ horizontalPadding : 10 ,
3964
+ verticalPadding : 2 ,
3965
+ iconSpacing : 7 ,
3966
+ default : {
3967
+ backgroundColor : `yellow` ,
3968
+ color : `blue` ,
3969
+ radius : 25 ,
3970
+ border : {
3971
+ width : 5 ,
3972
+ color : `aquamarine` ,
3973
+ } ,
3974
+ } ,
3975
+ disabled : {
3976
+ backgroundColor : `orange` ,
3977
+ color : `purple` ,
3978
+ radius : 7 ,
3979
+ border : {
3980
+ width : 2 ,
3981
+ color : `aquamarine` ,
3982
+ } ,
3983
+ } ,
3984
+ } ) ;
3985
+ const onPress = jest . fn ( ) ;
3986
+
3987
+ const rendered = (
3988
+ < Component
3989
+ leftIcon = { ( ) => null }
3990
+ rightIcon = { ( ) => null }
3991
+ onPress = { onPress }
3992
+ disabled = { false }
3993
+ >
3994
+ Example Content
3995
+ </ Component >
3996
+ ) ;
3997
+
3998
+ expect ( unwrapRenderedFunctionComponent ( rendered ) ) . toEqual (
3999
+ < Hitbox
4000
+ disabled = { false }
4001
+ onPress = { onPress }
4002
+ style = { {
4003
+ backgroundColor : `yellow` ,
4004
+ borderRadius : 25 ,
4005
+ paddingHorizontal : 10 ,
4006
+ paddingVertical : 2 ,
4007
+ borderWidth : 5 ,
4008
+ borderColor : `aquamarine` ,
4009
+ alignItems : `center` ,
4010
+ } }
4011
+ >
4012
+ < Text
4013
+ style = { {
4014
+ color : `blue` ,
4015
+ fontFamily : `Example Font Family` ,
4016
+ fontSize : 16 ,
4017
+ lineHeight : 22.4 ,
4018
+ } }
4019
+ >
4020
+ Example Content
4021
+ </ Text >
4022
+ </ Hitbox >
4023
+ ) ;
4024
+ expect ( onPress ) . not . toHaveBeenCalled ( ) ;
4025
+ } ) ;
0 commit comments