Merge branch 'fix-empty-carousel' into 'develop'

Hide carousel if no avatars

Closes #1029

See merge request soapbox-pub/soapbox-fe!1624
timeline-nomemo
Justin 2022-07-11 15:05:46 +00:00
commit 818db57f8e
2 zmienionych plików z 24 dodań i 0 usunięć

Wyświetl plik

@ -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 = {

Wyświetl plik

@ -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>