From e9508b4f7f1712e7981855eebdd54540126676e0 Mon Sep 17 00:00:00 2001 From: Garrett Bear Date: Tue, 22 Nov 2022 12:25:49 -0800 Subject: [PATCH] Fix/16620/button href prop (#16633) * fix button href prop passed * improve test --- .../component-library/button-base/button-base.js | 1 + .../component-library/button-base/button-base.test.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ui/components/component-library/button-base/button-base.js b/ui/components/component-library/button-base/button-base.js index 426b65a31..ed701d9db 100644 --- a/ui/components/component-library/button-base/button-base.js +++ b/ui/components/component-library/button-base/button-base.js @@ -35,6 +35,7 @@ export const ButtonBase = ({ return ( { 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( - , + + Button Base + , ); 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); });