Skip to content

Commit

Permalink
Course Calatog: Stay on selected department (#1921)
Browse files Browse the repository at this point in the history
  • Loading branch information
annagav authored Sep 26, 2023
1 parent cc10c8a commit c493295
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion frontend/public/src/containers/pages/CatalogPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ export class CatalogPage extends React.Component<Props> {
*/
changeSelectedTab = (selectTabName: string) => {
this.setState({ tabSelected: selectTabName })
this.changeSelectedDepartment(ALL_DEPARTMENTS, selectTabName)

if (selectTabName === PROGRAMS_TAB) {
const { programs, programsIsLoading } = this.props
Expand Down
8 changes: 4 additions & 4 deletions frontend/public/src/containers/pages/CatalogPage_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,14 +722,14 @@ describe("CatalogPage", function() {

// Change to the programs tab.
inner.instance().changeSelectedTab("programs")
// Confirm that the selected departement resets to "All Departments".
expect(inner.state().selectedDepartment).equals("All Departments")
// Confirm that the selected department is the same as before.
expect(inner.state().selectedDepartment).equals("History")

// Change back to the courses tab.
inner.instance().changeSelectedTab("courses")
// All of the courses should be visible.
// Confirm the courses filtered are those which have a department name matching the selected department.
expect(JSON.stringify(inner.state().filteredCourses)).equals(
JSON.stringify(courses)
JSON.stringify([course2, course3])
)
})

Expand Down

0 comments on commit c493295

Please sign in to comment.