Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ export type AcceleratedCheckoutButtonsProps = (CartProps | VariantProps) &
* />
*/

const defaultStyles = {flex: 1};

export const AcceleratedCheckoutButtons: React.FC<
AcceleratedCheckoutButtonsProps
> = ({
Expand Down Expand Up @@ -306,7 +304,7 @@ export const AcceleratedCheckoutButtons: React.FC<
testID="accelerated-checkout-buttons"
applePayLabel={applePayLabel}
applePayStyle={applePayStyle}
style={{...defaultStyles, height: dynamicHeight}}
style={dynamicHeight ? {height: dynamicHeight} : undefined}
checkoutIdentifier={checkoutIdentifier}
cornerRadius={cornerRadius}
wallets={wallets}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,19 +290,18 @@ describe('AcceleratedCheckoutButtons', () => {
expect(onClickLink).not.toHaveBeenCalled();
});

it('applies dynamic height when onSizeChange is emitted', async () => {
it('applies only the dynamic height when onSizeChange is emitted', async () => {
const {getByTestId} = render(
<AcceleratedCheckoutButtons cartId="gid://shopify/Cart/123" />,
);
let nativeComponent = getByTestId('accelerated-checkout-buttons');
expect(nativeComponent.props.style).toBeUndefined();

await act(async () => {
nativeComponent.props.onSizeChange({nativeEvent: {height: 42}});
});
nativeComponent = getByTestId('accelerated-checkout-buttons');
expect(nativeComponent.props.style).toEqual({
flex: 1,
height: 42,
});
expect(nativeComponent.props.style).toEqual({height: 42});
});

it('warns and returns null when missing identifiers in production', () => {
Expand Down
Loading