1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Fix/16620/button href prop (#16633)

* fix button href prop passed

* improve test
This commit is contained in:
Garrett Bear 2022-11-22 12:25:49 -08:00 committed by GitHub
parent 086a7d0483
commit e9508b4f7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -35,6 +35,7 @@ export const ButtonBase = ({
return (
<Box
as={Tag}
href={href}
paddingLeft={size === BUTTON_BASE_SIZES.AUTO ? 0 : 4}
paddingRight={size === BUTTON_BASE_SIZES.AUTO ? 0 : 4}
className={classnames(

View File

@ -24,11 +24,17 @@ describe('ButtonBase', () => {
expect(anchor).toBe(1);
});
it('should render anchor element correctly by href only being passed', () => {
it('should render anchor element correctly by href only being passed and href exists', () => {
const { getByTestId, container } = render(
<ButtonBase href="#" data-testid="button-base" />,
<ButtonBase href="https://www.test.com/" data-testid="button-base">
Button Base
</ButtonBase>,
);
expect(getByTestId('button-base')).toHaveClass('mm-button');
expect(getByTestId('button-base')).toHaveAttribute(
'href',
'https://www.test.com/',
);
const anchor = container.getElementsByTagName('a').length;
expect(anchor).toBe(1);
});