Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/components/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import React, {

import { Icon, SearchField } from '@openedx/paragon';
import { Search as SearchIcon } from '@openedx/paragon/icons';
import camelCase from 'lodash/camelCase';
import { useDispatch, useSelector } from 'react-redux';

import { useIntl } from '@edx/frontend-platform/i18n';
Expand Down Expand Up @@ -79,7 +78,7 @@ const Search = () => {
<SearchField.Label />
<SearchField.Input
style={{ paddingRight: '1rem' }}
placeholder={intl.formatMessage(postsMessages.search, { page: camelCase(page) })}
placeholder={intl.formatMessage(postsMessages.searchAllPosts)}
/>
<span className="py-auto px-2.5 pointer-cursor-hover">
<Icon
Expand Down
24 changes: 12 additions & 12 deletions src/discussions/learners/LearnersView.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('LearnersView', () => {
await executeThunk(fetchLearners(courseId, { usernameSearch: searchText }), store.dispatch, store.getState);
}

async function assignPrivilages(hasModerationPrivileges = false) {
async function assignPrivileges(hasModerationPrivileges = false) {
axiosMock.onGet(getDiscussionsConfigUrl(courseId)).reply(200, {
user_is_privileged: true,
hasModerationPrivileges,
Expand All @@ -113,7 +113,7 @@ describe('LearnersView', () => {

test('Learners tab is enabled', async () => {
await setUpLearnerMockResponse();
await assignPrivilages();
await assignPrivileges();
await waitFor(() => {
renderComponent();
});
Expand Down Expand Up @@ -144,7 +144,7 @@ describe('LearnersView', () => {
{ searchBy: 'sort-reported', result: 3 },
])('successfully display learners by %s.', async ({ searchBy, result }) => {
await setUpLearnerMockResponse();
await assignPrivilages(true);
await assignPrivileges(true);
await renderComponent();

const filterBar = container.querySelector('.collapsible-trigger');
Expand All @@ -168,7 +168,7 @@ describe('LearnersView', () => {

it('should display a learner\'s list.', async () => {
await setUpLearnerMockResponse();
await assignPrivilages();
await assignPrivileges();
await waitFor(() => {
renderComponent();
});
Expand Down Expand Up @@ -205,10 +205,10 @@ describe('LearnersView', () => {
searchText, output, learnersCount, username,
}) => {
await setUpLearnerMockResponse();
await assignPrivilages();
await assignPrivileges();
await renderComponent();

const searchField = within(container).getByPlaceholderText('Search learners');
const searchField = within(container).getByPlaceholderText('Search all posts');
const searchButton = within(container).getByTestId('search-icon');

await fireEvent.change(searchField, { target: { value: searchText } });
Expand All @@ -220,21 +220,21 @@ describe('LearnersView', () => {
await waitFor(() => {
const clearButton = within(container).queryByText('Clear results');
const searchMessage = within(container).queryByText(`${output} "${searchText}"`);
const leaners = container.querySelectorAll('.discussion-post') ?? [];
const learners = container.querySelectorAll('.discussion-post') ?? [];

expect(searchMessage).toBeInTheDocument();
expect(clearButton).toBeInTheDocument();
expect(leaners).toHaveLength(learnersCount);
expect(learners).toHaveLength(learnersCount);
});
},
);

test('When click on the clear button it should move to a list of all learners.', async () => {
await setUpLearnerMockResponse();
await assignPrivilages(true);
await assignPrivileges(true);
await renderComponent();

const searchField = within(container).getByPlaceholderText('Search learners');
const searchField = within(container).getByPlaceholderText('Search all posts');
const searchButton = within(container).getByTestId('search-icon');
let clearButton;

Expand All @@ -261,7 +261,7 @@ describe('LearnersView', () => {
'should display reported and previously reported message by passing activeFlags or inactiveFlags',
async () => {
await setUpLearnerMockResponse(2, 2, 1, ['learner-1', 'learner-2'], '', 1, 1);
await assignPrivilages(true);
await assignPrivileges(true);
await renderComponent();
await waitFor(() => container.querySelector('.text-danger'));

Expand All @@ -280,7 +280,7 @@ describe('LearnersView', () => {

it('should display load more button and display more learners by clicking on button.', async () => {
await setUpLearnerMockResponse();
await assignPrivilages(true);
await assignPrivileges(true);
await renderComponent();

await waitFor(() => container.querySelector('[data-testid="load-more-learners"]'));
Expand Down