mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Fix/16620/button href prop (#16633)
* fix button href prop passed * improve test
This commit is contained in:
parent
086a7d0483
commit
e9508b4f7f
@ -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(
|
||||
|
@ -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);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user