diff --git a/src/assets/Empty.jsx b/src/assets/Empty.jsx new file mode 100644 index 00000000..f9432b8f --- /dev/null +++ b/src/assets/Empty.jsx @@ -0,0 +1,48 @@ +const Empty = () => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export default Empty; diff --git a/src/assets/empty.svg b/src/assets/empty.svg deleted file mode 100644 index 2b306748..00000000 --- a/src/assets/empty.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/components/TopicStats.jsx b/src/components/TopicStats.jsx index 7f7bb725..d356ea3e 100644 --- a/src/components/TopicStats.jsx +++ b/src/components/TopicStats.jsx @@ -27,9 +27,10 @@ const TopicStats = ({ return (
+
{intl.formatMessage(messages.discussions, { count: threadCounts?.discussion || 0, @@ -44,9 +45,10 @@ const TopicStats = ({
+
{intl.formatMessage(messages.questions, { count: threadCounts?.question || 0, @@ -62,9 +64,10 @@ const TopicStats = ({ {Boolean(canSeeReportedStats) && ( +
{Boolean(activeFlags) && ( diff --git a/src/discussions/empty-posts/EmptyPage.jsx b/src/discussions/empty-posts/EmptyPage.jsx index c44a9fd9..5bdb64a3 100644 --- a/src/discussions/empty-posts/EmptyPage.jsx +++ b/src/discussions/empty-posts/EmptyPage.jsx @@ -5,7 +5,7 @@ import classNames from 'classnames'; import { Button } from '@edx/paragon'; -import { ReactComponent as EmptyIcon } from '../../assets/empty.svg'; +import EmptyIcon from '../../assets/Empty'; const EmptyPage = ({ title, diff --git a/src/discussions/in-context-topics/TopicsView.test.jsx b/src/discussions/in-context-topics/TopicsView.test.jsx index c00b16e4..f2da48c4 100644 --- a/src/discussions/in-context-topics/TopicsView.test.jsx +++ b/src/discussions/in-context-topics/TopicsView.test.jsx @@ -123,15 +123,15 @@ describe('InContext Topics View', () => { expect(topic.nextSibling).toBe(container.querySelector('.divider')); }); - it('A non-Courseware topic should have 3 stats and should be hoverable', async () => { + it('A non-Courseware topic should have 2 stats and should be hoverable', async () => { await setupMockResponse(); renderComponent(); const topic = await container.querySelector('.discussion-topic'); const statsList = await topic.querySelectorAll('.icon-size'); - expect(statsList.length).toBe(3); - fireEvent.mouseOver(statsList[0]); + expect(statsList.length).toBe(2); + await act(async () => { fireEvent.mouseOver(statsList[0]); }); expect(screen.queryByText('1 Discussion')).toBeInTheDocument(); }); @@ -180,7 +180,7 @@ describe('InContext Topics View', () => { const subsectionObject = coursewareTopics[0].children[0]; const subSection = await container.querySelector(`[data-subsection-id=${subsectionObject.id}]`); - await act(async () => fireEvent.click(subSection)); + await act(async () => { fireEvent.click(subSection); }); await waitFor(async () => { const backButton = await screen.getByLabelText('Back to topics list'); const topicsList = await screen.getByRole('list'); @@ -199,7 +199,7 @@ describe('InContext Topics View', () => { renderComponent(); const subSection = await container.querySelector(`[data-subsection-id=${coursewareTopics[0].children[0].id}]`); - await act(async () => fireEvent.click(subSection)); + await act(async () => { fireEvent.click(subSection); }); await waitFor(async () => { const units = await container.querySelectorAll('.discussion-topic'); @@ -207,7 +207,7 @@ describe('InContext Topics View', () => { }); }); - it('A unit should have a title and stats and should be clickable', async () => { + it('A unit should have a title and should be clickable', async () => { await setupMockResponse(); renderComponent(); const subSectionObject = coursewareTopics[0].children[0]; @@ -215,16 +215,16 @@ describe('InContext Topics View', () => { const subSection = await container.querySelector(`[data-subsection-id=${subSectionObject.id}]`); - await act(async () => fireEvent.click(subSection)); + await act(async () => { fireEvent.click(subSection); }); await waitFor(async () => { const unitElement = await screen.findByText(unitObject.name); const unitContainer = await container.querySelector(`[data-topic-id=${unitObject.id}]`); const statsList = await unitContainer.querySelectorAll('.icon-size'); expect(unitElement).toBeInTheDocument(); - expect(statsList).toHaveLength(3); + expect(statsList).toHaveLength(2); - await act(async () => fireEvent.click(unitContainer)); + await act(async () => { fireEvent.click(unitContainer); }); await waitFor(async () => { expect(lastLocation.pathname.endsWith(`/topics/${unitObject.id}`)).toBeTruthy(); }); diff --git a/src/discussions/in-context-topics/topic/Topic.jsx b/src/discussions/in-context-topics/topic/Topic.jsx index b8c163b2..21f308e1 100644 --- a/src/discussions/in-context-topics/topic/Topic.jsx +++ b/src/discussions/in-context-topics/topic/Topic.jsx @@ -54,11 +54,7 @@ const Topic = ({ {topic?.name || topic?.displayName || intl.formatMessage(messages.unnamedTopicSubCategories)}
- +
diff --git a/src/discussions/learners/LearnerPostsView.test.jsx b/src/discussions/learners/LearnerPostsView.test.jsx index aa0f6db1..07c3224a 100644 --- a/src/discussions/learners/LearnerPostsView.test.jsx +++ b/src/discussions/learners/LearnerPostsView.test.jsx @@ -116,7 +116,7 @@ describe('Learner Posts View', () => { const backButton = screen.getByLabelText('Back'); - await act(() => { + await act(async () => { fireEvent.click(backButton); }); await waitFor(() => { diff --git a/src/discussions/topics/topic-group/topic/Topic.jsx b/src/discussions/topics/topic-group/topic/Topic.jsx index af5ee705..5e350c04 100644 --- a/src/discussions/topics/topic-group/topic/Topic.jsx +++ b/src/discussions/topics/topic-group/topic/Topic.jsx @@ -57,8 +57,9 @@ const Topic = ({ topicId, showDivider, index }) => {
+
{intl.formatMessage(messages.discussions, { count: threadCounts?.discussion || 0, @@ -74,8 +75,9 @@ const Topic = ({ topicId, showDivider, index }) => { +
{intl.formatMessage(messages.questions, { count: threadCounts?.question || 0, @@ -91,9 +93,10 @@ const Topic = ({ topicId, showDivider, index }) => { {Boolean(canSeeReportedStats) && ( +
{Boolean(activeFlags) && (