File tree Expand file tree Collapse file tree 4 files changed +31
-1
lines changed Expand file tree Collapse file tree 4 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @user-interviews/ui-design-system" ,
3- "version" : " 1.43.0 " ,
3+ "version" : " 1.43.1 " ,
44 "dependencies" : {
55 "react-bootstrap" : " ^2.5.0" ,
66 "react-loading-skeleton" : " ^3.1.0" ,
Original file line number Diff line number Diff line change @@ -5687,6 +5687,7 @@ exports[`Storyshots Components/Drawer Additional Actions 1`] = `
56875687 <button
56885688 className="Button btn btn-danger"
56895689 disabled={false}
5690+ onClick={[Function]}
56905691 type="button"
56915692 >
56925693 <svg
@@ -5797,6 +5798,7 @@ exports[`Storyshots Components/Drawer Default 1`] = `
57975798 <button
57985799 className="Button btn btn-primary"
57995800 disabled={false}
5801+ onClick={[Function]}
58005802 type="button"
58015803 >
58025804 <svg
@@ -5959,6 +5961,7 @@ exports[`Storyshots Components/Drawer Expandable 1`] = `
59595961 <button
59605962 className="Button btn btn-primary"
59615963 disabled={false}
5964+ onClick={[Function]}
59625965 type="button"
59635966 >
59645967 <svg
@@ -6069,6 +6072,7 @@ exports[`Storyshots Components/Drawer Orientation 1`] = `
60696072 <button
60706073 className="Button btn btn-primary"
60716074 disabled={false}
6075+ onClick={[Function]}
60726076 type="button"
60736077 >
60746078 <svg
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ const DrawerFooter = ({
3737 leadingIcon = { primaryActionIcon }
3838 type = "button"
3939 variant = { primaryActionVariant }
40+ onClick = { onPrimaryAction }
4041 >
4142 { primaryActionText }
4243 </ Button >
Original file line number Diff line number Diff line change 1+ import { render , screen } from '@testing-library/react' ;
2+ import React from 'react' ;
3+ import userEvent from '@testing-library/user-event' ;
4+ import { DrawerFooter } from './index' ;
5+
6+ describe ( 'DrawerFooter' , ( ) => {
7+ const renderDrawerFooter = ( props ) => render (
8+ < DrawerFooter { ...props } /> ,
9+ ) ;
10+
11+ describe ( 'primary action button' , ( ) => {
12+ it ( 'calls the onPrimaryAction callback when clicked' , ( ) => {
13+ const onPrimaryActionMock = jest . fn ( ) ;
14+
15+ renderDrawerFooter ( {
16+ primaryActionText : 'Primary Action' ,
17+ onPrimaryAction : onPrimaryActionMock ,
18+ } ) ;
19+
20+ userEvent . click ( screen . getByRole ( 'button' , { name : 'Primary Action' } ) ) ;
21+
22+ expect ( onPrimaryActionMock ) . toHaveBeenCalled ( ) ;
23+ } ) ;
24+ } ) ;
25+ } ) ;
You can’t perform that action at this time.
0 commit comments