@@ -6,11 +6,18 @@ import { render, screen } from '../../../../test-utils/testing-library';
66describe ( 'features/content-explorer/item-list/ItemListIcon' , ( ) => {
77 const renderComponent = props => render ( < ItemListIcon { ...props } /> ) ;
88
9+ const expectIconWithDefaultSize = icon => {
10+ expect ( icon ) . toBeVisible ( ) ;
11+ expect ( icon ) . toHaveAttribute ( 'width' , '32' ) ;
12+ expect ( icon ) . toHaveAttribute ( 'height' , '32' ) ;
13+ } ;
14+
915 describe ( 'render()' , ( ) => {
1016 test ( 'should render default file icon' , ( ) => {
1117 renderComponent ( { } ) ;
1218
13- expect ( screen . getByLabelText ( 'File' ) ) . toBeInTheDocument ( ) ;
19+ const fileIcon = screen . getByLabelText ( 'File' ) ;
20+ expectIconWithDefaultSize ( fileIcon ) ;
1421 } ) ;
1522
1623 test ( 'should render archive icon' , ( ) => {
@@ -22,7 +29,8 @@ describe('features/content-explorer/item-list/ItemListIcon', () => {
2229 } ;
2330 renderComponent ( rowData ) ;
2431
25- expect ( screen . getByLabelText ( 'Archive' ) ) . toBeVisible ( ) ;
32+ const archiveIcon = screen . getByLabelText ( 'Archive' ) ;
33+ expectIconWithDefaultSize ( archiveIcon ) ;
2634 } ) ;
2735
2836 test ( 'should render archived folder icon' , ( ) => {
@@ -34,7 +42,8 @@ describe('features/content-explorer/item-list/ItemListIcon', () => {
3442 } ;
3543 renderComponent ( rowData ) ;
3644
37- expect ( screen . getByLabelText ( 'Archived Folder' ) ) . toBeVisible ( ) ;
45+ const archivedFolderIcon = screen . getByLabelText ( 'Archived Folder' ) ;
46+ expectIconWithDefaultSize ( archivedFolderIcon ) ;
3847 } ) ;
3948
4049 test . each ( [
@@ -68,22 +77,25 @@ describe('features/content-explorer/item-list/ItemListIcon', () => {
6877 ] ) ( 'should render $label folder icon' , ( { rowData, label } ) => {
6978 renderComponent ( rowData ) ;
7079
71- expect ( screen . getByLabelText ( label ) ) . toBeInTheDocument ( ) ;
80+ const folderIcon = screen . getByLabelText ( label ) ;
81+ expectIconWithDefaultSize ( folderIcon ) ;
7282 } ) ;
7383
7484 test ( 'should render correct file icon' , ( ) => {
7585 const extension = 'boxnote' ;
7686 const rowData = { type : 'file' , extension } ;
7787 renderComponent ( rowData ) ;
7888
79- expect ( screen . getByLabelText ( 'BOXNOTE File' ) ) . toBeInTheDocument ( ) ;
89+ const fileIcon = screen . getByLabelText ( 'BOXNOTE File' ) ;
90+ expectIconWithDefaultSize ( fileIcon ) ;
8091 } ) ;
8192
8293 test ( 'should render correct bookmark icon' , ( ) => {
8394 const rowData = { type : 'web_link' } ;
8495 renderComponent ( rowData ) ;
8596
86- expect ( screen . getByLabelText ( 'Bookmark' ) ) . toBeInTheDocument ( ) ;
97+ const bookmarkIcon = screen . getByLabelText ( 'Bookmark' ) ;
98+ expectIconWithDefaultSize ( bookmarkIcon ) ;
8799 } ) ;
88100 } ) ;
89101} ) ;
0 commit comments