diff --git a/react-native/components/createButtonComponent/unit.tsx b/react-native/components/createButtonComponent/unit.tsx index 9090811f..9b6c14b4 100644 --- a/react-native/components/createButtonComponent/unit.tsx +++ b/react-native/components/createButtonComponent/unit.tsx @@ -3884,3 +3884,142 @@ test(`renders with a right icon when the left icon is undefined`, () => { ); expect(onPress).not.toHaveBeenCalled(); }); + +test(`renders with a font weight`, () => { + const Component = createButtonComponent({ + fontFamily: `Example Font Family`, + fontWeight: `700`, + fontSize: 16, + horizontalPadding: 10, + verticalPadding: 2, + iconSpacing: 7, + default: { + backgroundColor: `yellow`, + color: `blue`, + radius: 25, + border: { + width: 5, + color: `aquamarine`, + }, + }, + disabled: { + backgroundColor: `orange`, + color: `purple`, + radius: 7, + border: { + width: 2, + color: `aquamarine`, + }, + }, + }); + const onPress = jest.fn(); + + const rendered = ( + null} + rightIcon={() => null} + onPress={onPress} + disabled={false} + > + Example Content + + ); + + expect(unwrapRenderedFunctionComponent(rendered)).toEqual( + + + Example Content + + + ); + expect(onPress).not.toHaveBeenCalled(); +}); + +test(`renders with a font weight of undefined`, () => { + const Component = createButtonComponent({ + fontFamily: `Example Font Family`, + fontWeight: undefined, + fontSize: 16, + horizontalPadding: 10, + verticalPadding: 2, + iconSpacing: 7, + default: { + backgroundColor: `yellow`, + color: `blue`, + radius: 25, + border: { + width: 5, + color: `aquamarine`, + }, + }, + disabled: { + backgroundColor: `orange`, + color: `purple`, + radius: 7, + border: { + width: 2, + color: `aquamarine`, + }, + }, + }); + const onPress = jest.fn(); + + const rendered = ( + null} + rightIcon={() => null} + onPress={onPress} + disabled={false} + > + Example Content + + ); + + expect(unwrapRenderedFunctionComponent(rendered)).toEqual( + + + Example Content + + + ); + expect(onPress).not.toHaveBeenCalled(); +}); diff --git a/react-native/types/ButtonStyle/index.tsx b/react-native/types/ButtonStyle/index.tsx index 38d658ac..2b19302f 100644 --- a/react-native/types/ButtonStyle/index.tsx +++ b/react-native/types/ButtonStyle/index.tsx @@ -17,7 +17,19 @@ export type ButtonStyle = { /** * The weight of the text on the button. */ - readonly fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | undefined; + readonly fontWeight?: + | `normal` + | `bold` + | `100` + | `200` + | `300` + | `400` + | `500` + | `600` + | `700` + | `800` + | `900` + | undefined; /** * The amount of horizontal padding inside the button.