@@ -3,6 +3,7 @@ import {Heading, Popover, Button, ActionList, Badge} from 'components';
33import { mountWithApp } from 'test-utilities' ;
44
55import { MediaCard } from '../MediaCard' ;
6+ import styles from '../MediaCard.scss' ;
67
78const mockProps = {
89 children : < img alt = "" /> ,
@@ -48,6 +49,41 @@ describe('<MediaCard>', () => {
4849 expect ( videoCard ) . toContainReactComponent ( 'p' , { children : description } ) ;
4950 } ) ;
5051
52+ it ( 'does not render a wrapper around actions when primaryAction and secondaryAction are empty' , ( ) => {
53+ const videoCard = mountWithApp (
54+ < MediaCard
55+ { ...mockProps }
56+ primaryAction = { undefined }
57+ secondaryAction = { undefined }
58+ /> ,
59+ ) ;
60+
61+ expect ( videoCard ) . not . toContainReactComponent ( 'div' , {
62+ className : expect . stringContaining ( styles . ActionContainer ) ,
63+ } ) ;
64+ } ) ;
65+
66+ it ( 'renders a wrapper around actions when primaryAction and secondaryAction are provided' , ( ) => {
67+ const mockAction = { content : 'test' } ;
68+ const videoCardWithPrimaryAction = mountWithApp (
69+ < MediaCard { ...mockProps } primaryAction = { mockAction } /> ,
70+ ) ;
71+ const videoCardWithSecondaryAction = mountWithApp (
72+ < MediaCard
73+ { ...mockProps }
74+ primaryAction = { undefined }
75+ secondaryAction = { mockAction }
76+ /> ,
77+ ) ;
78+
79+ expect ( videoCardWithPrimaryAction ) . toContainReactComponent ( 'div' , {
80+ className : expect . stringContaining ( styles . ActionContainer ) ,
81+ } ) ;
82+ expect ( videoCardWithSecondaryAction ) . toContainReactComponent ( 'div' , {
83+ className : expect . stringContaining ( styles . ActionContainer ) ,
84+ } ) ;
85+ } ) ;
86+
5187 it ( 'renders a Button with the primaryAction' , ( ) => {
5288 const primaryAction = { content : 'test primary action' } ;
5389 const videoCard = mountWithApp (
0 commit comments