mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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 (
|
return (
|
||||||
<Box
|
<Box
|
||||||
as={Tag}
|
as={Tag}
|
||||||
|
href={href}
|
||||||
paddingLeft={size === BUTTON_BASE_SIZES.AUTO ? 0 : 4}
|
paddingLeft={size === BUTTON_BASE_SIZES.AUTO ? 0 : 4}
|
||||||
paddingRight={size === BUTTON_BASE_SIZES.AUTO ? 0 : 4}
|
paddingRight={size === BUTTON_BASE_SIZES.AUTO ? 0 : 4}
|
||||||
className={classnames(
|
className={classnames(
|
||||||
|
@ -24,11 +24,17 @@ describe('ButtonBase', () => {
|
|||||||
expect(anchor).toBe(1);
|
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(
|
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')).toHaveClass('mm-button');
|
||||||
|
expect(getByTestId('button-base')).toHaveAttribute(
|
||||||
|
'href',
|
||||||
|
'https://www.test.com/',
|
||||||
|
);
|
||||||
const anchor = container.getElementsByTagName('a').length;
|
const anchor = container.getElementsByTagName('a').length;
|
||||||
expect(anchor).toBe(1);
|
expect(anchor).toBe(1);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user