@@ -150,10 +150,10 @@ describe(__filename, () => {
150150 expect ( screen . getAllByRole ( 'alert' ) ) . toHaveLength (
151151 DEFAULT_API_PAGE_SIZE * 4 ,
152152 ) ;
153- // By default we do not want "theme" placeholders.
154- const imgs = screen . getAllByRole ( 'img' ) ;
153+ // We can't use `getAllByRole('img')` because the `img` doesnt' have an
154+ // `alt` text in `SearchResult` when rendered as a placeholder.
155+ const imgs = screen . getAllByClassName ( 'SearchResult-icon--loading' ) ;
155156 expect ( imgs ) . toHaveLength ( DEFAULT_API_PAGE_SIZE ) ;
156- expect ( imgs [ 0 ] ) . toHaveClass ( 'SearchResult-icon--loading' ) ;
157157 } ) ;
158158
159159 it ( 'handles an empty set of addons' , ( ) => {
@@ -162,15 +162,18 @@ describe(__filename, () => {
162162 expect ( screen . queryByRole ( 'img' ) ) . not . toBeInTheDocument ( ) ;
163163 } ) ;
164164
165- it ( 'allows you configure the number of placeholders' , ( ) => {
165+ it ( 'allows you to configure the number of placeholders' , ( ) => {
166166 const placeholderCount = 2 ;
167167 render ( {
168168 addons : null ,
169169 loading : true ,
170170 placeholderCount,
171171 } ) ;
172-
173- expect ( screen . getAllByRole ( 'img' ) ) . toHaveLength ( placeholderCount ) ;
172+ // We can't use `getAllByRole('img')` because the `img` doesnt' have an
173+ // `alt` text in `SearchResult` when rendered as a placeholder.
174+ expect ( screen . getAllByClassName ( 'SearchResult-result' ) ) . toHaveLength (
175+ placeholderCount ,
176+ ) ;
174177 } ) ;
175178
176179 it ( 'renders addons even when loading' , ( ) => {
0 commit comments