diff --git a/src/pages/tickets/Tickets.tsx b/src/pages/tickets/Tickets.tsx index 50e83b0c..07d57f90 100644 --- a/src/pages/tickets/Tickets.tsx +++ b/src/pages/tickets/Tickets.tsx @@ -170,6 +170,7 @@ function BodyComponent() { setCurrentItems={setCurrentItems} page={page} setPage={setPage} + languageString={languageString} /> @@ -194,7 +195,6 @@ function BodyComponent() { minHeight: '32px' }} /> - diff --git a/src/pages/tickets/org/OrgTickets.tsx b/src/pages/tickets/org/OrgTickets.tsx index 9f566de3..736a08ee 100644 --- a/src/pages/tickets/org/OrgTickets.tsx +++ b/src/pages/tickets/org/OrgTickets.tsx @@ -139,6 +139,7 @@ function OrgBodyComponent() { fromBountyPage={true} selectedWidget={selectedWidget} loading={loading} + languageString={languageString} /> @@ -194,6 +195,7 @@ function OrgBodyComponent() { selectedWidget={selectedWidget} loading={loading} org_uuid={uuid} + languageString={languageString} /> diff --git a/src/people/utils/NoResults.tsx b/src/people/utils/NoResults.tsx index 10b6c1cb..34c0d48d 100644 --- a/src/people/utils/NoResults.tsx +++ b/src/people/utils/NoResults.tsx @@ -25,11 +25,10 @@ const H = styled.div` letter-spacing: 0px; color: rgb(60, 63, 65); `; -function NoResults() { +function NoResults({ loaded = false }: { loaded?: boolean }) { const { ui } = useStores(); const { searchText } = ui || {}; - - if (searchText) { + if (searchText || loaded) { return (
({}); const closeModal = () => setShowDeleteModal(false); const showModal = () => setShowDeleteModal(true); - const { currentItems, setCurrentItems, totalBounties, page: propsPage, setPage } = props; + const { + currentItems, + setCurrentItems, + totalBounties, + page: propsPage, + setPage, + languageString + } = props; const items = currentItems ?? 0; const bountiesTotal = totalBounties ?? 0; @@ -236,14 +243,13 @@ function WidgetSwitchViewer(props: any) { ); }) ) : ( - + ); const showLoadMore = bountiesTotal > items && activeList.length >= queryLimit; return ( <> {listItems} - {showDeleteModal && ( )} diff --git a/src/people/widgetViews/__tests__/WidgetSwitchViewer.spec.tsx b/src/people/widgetViews/__tests__/WidgetSwitchViewer.spec.tsx index 72e4ef24..98b0ef99 100644 --- a/src/people/widgetViews/__tests__/WidgetSwitchViewer.spec.tsx +++ b/src/people/widgetViews/__tests__/WidgetSwitchViewer.spec.tsx @@ -1,14 +1,45 @@ -import WidgetViewer from '../WidgetSwitchViewer'; -import { uiStore } from '../../../store/ui'; -// import crypto from 'crypto'; -// import moment from 'moment'; +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import '@testing-library/jest-dom'; +import { useStores } from 'store'; +import WidgetSwitchViewer from '../WidgetSwitchViewer'; -beforeAll(() => {}); +jest.mock('hooks', () => ({ + useIsMobile: jest.fn() +})); -afterAll(() => {}); +jest.mock('store', () => ({ + useStores: jest.fn() +})); -describe('testing helpers', () => { - test('test', () => { - expect(true).toBe(true); +describe('WidgetSwitchViewer Component', () => { + beforeEach(() => { + jest.clearAllMocks(); }); + + test('should display No results when there are no active list items with filter of languages', () => { + // Mock return value for the store hook + (useStores as jest.Mock).mockReturnValue({ + main: { + peopleBounties: [], + peopleOffers: [], + peoplePosts: [] + } + }); + + // Render the component with a selected widget and empty lists + render( + + ); + + // Assert that is present in the document + expect(screen.getByText(/No results/i)).toBeInTheDocument(); + }); + + // Additional tests for different conditions can be added here });