sforkowany z mirror/soapbox
Merge branch 'fix-empty-carousel' into 'develop'
Hide carousel if no avatars Closes #1029 See merge request soapbox-pub/soapbox-fe!1624timeline-nomemo
commit
818db57f8e
|
@ -56,11 +56,31 @@ describe('<FeedCarousel />', () => {
|
|||
});
|
||||
|
||||
it('should render the Carousel', () => {
|
||||
store.carousels = {
|
||||
avatars: [
|
||||
{ account_id: '1', acct: 'a', account_avatar: 'https://example.com/some.jpg' },
|
||||
],
|
||||
};
|
||||
|
||||
render(<FeedCarousel />, undefined, store);
|
||||
|
||||
expect(screen.queryAllByTestId('feed-carousel')).toHaveLength(1);
|
||||
});
|
||||
|
||||
describe('with 0 avatars', () => {
|
||||
beforeEach(() => {
|
||||
store.carousels = {
|
||||
avatars: [],
|
||||
};
|
||||
});
|
||||
|
||||
it('renders the error message', () => {
|
||||
render(<FeedCarousel />, undefined, store);
|
||||
|
||||
expect(screen.queryAllByTestId('feed-carousel-error')).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('with a failed request to the API', () => {
|
||||
beforeEach(() => {
|
||||
store.carousels = {
|
||||
|
|
|
@ -93,6 +93,10 @@ const FeedCarousel = () => {
|
|||
);
|
||||
}
|
||||
|
||||
if (avatars.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Card variant='rounded' size='lg' ref={cardRef} className='relative' data-testid='feed-carousel'>
|
||||
<div>
|
||||
|
|
Ładowanie…
Reference in New Issue