generated from openedx/frontend-template-application
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Change students table according to new wireframe
- Loading branch information
Showing
18 changed files
with
723 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'test-file-stub'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ import axios from 'axios'; | |
import StudentsPage from 'features/Students/StudentsPage'; | ||
import { | ||
render, | ||
screen, | ||
fireEvent, | ||
waitFor, | ||
} from '@testing-library/react'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
|
@@ -21,16 +19,30 @@ const mockResponse = { | |
{ | ||
learnerName: 'Student 1', | ||
learnerEmail: '[email protected]', | ||
ccxName: 'CCX 1', | ||
courseId: '1', | ||
courseName: 'course 1', | ||
classId: '1', | ||
className: 'class 1', | ||
instructors: ['Instructor 1'], | ||
created: 'Fri, 25 Aug 2023 19:01:22 GMT', | ||
firstAccess: 'Fri, 25 Aug 2023 19:01:23 GMT', | ||
lastAccess: 'Fri, 25 Aug 2023 20:20:22 GMT', | ||
status: 'active', | ||
examReady: 'yes', | ||
}, | ||
{ | ||
learnerName: 'Student 2', | ||
learnerEmail: '[email protected]', | ||
ccxName: 'CCX 2', | ||
courseId: '2', | ||
courseName: 'course 2', | ||
classId: '2', | ||
className: 'class 2', | ||
instructors: ['Instructor 2'], | ||
created: 'Sat, 26 Aug 2023 19:01:22 GMT', | ||
firstAccess: 'Sat, 26 Aug 2023 19:01:24 GMT', | ||
lastAccess: 'Sat, 26 Aug 2023 21:22:22 GMT', | ||
status: 'pending', | ||
examReady: 'no', | ||
}, | ||
], | ||
count: 2, | ||
|
@@ -48,34 +60,14 @@ describe('StudentsPage', () => { | |
waitFor(() => { | ||
expect(component.container).toHaveTextContent('Student 1'); | ||
expect(component.container).toHaveTextContent('Student 2'); | ||
expect(component.container).toHaveTextContent('[email protected]'); | ||
expect(component.container).toHaveTextContent('[email protected]'); | ||
expect(component.container).toHaveTextContent('CCX 1'); | ||
expect(component.container).toHaveTextContent('CCX 2'); | ||
expect(component.container).toHaveTextContent('course 1'); | ||
expect(component.container).toHaveTextContent('course 2'); | ||
expect(component.container).toHaveTextContent('class 1'); | ||
expect(component.container).toHaveTextContent('class 2'); | ||
expect(component.container).toHaveTextContent('Instructor 1'); | ||
expect(component.container).toHaveTextContent('Instructor 2'); | ||
expect(component.container).toHaveTextContent('Fri, 25 Aug 2023 19:01:22 GMT'); | ||
expect(component.container).toHaveTextContent('Sat, 26 Aug 2023 19:01:22 GMT'); | ||
}); | ||
}); | ||
|
||
it('filters students data', async () => { | ||
axios.get.mockResolvedValue(mockResponse); | ||
|
||
const component = render(<StudentsPage />); | ||
|
||
fireEvent.click(screen.getByRole('button', { name: /Filters/i })); | ||
|
||
const nameInput = screen.getByPlaceholderText('Enter Student Name'); | ||
const emailInput = screen.getByPlaceholderText('Enter Student Email'); | ||
fireEvent.change(nameInput, { target: { value: 'Student 1' } }); | ||
fireEvent.change(emailInput, { target: { value: '[email protected]' } }); | ||
|
||
fireEvent.click(screen.getByText('Apply Filters')); | ||
|
||
waitFor(() => { | ||
expect(component.container).toHaveTextContent('Student 1'); | ||
expect(screen.queryByText('Student 2')).toBeNull(); | ||
expect(component.container).toHaveTextContent('active'); | ||
expect(component.container).toHaveTextContent('pending'); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.