Skip to content

Commit

Permalink
feat: Add partner column, show first partner only, for now (#567)
Browse files Browse the repository at this point in the history
* feat: Add partner column, show first partner only, for now

ENT-4608

* feat: partner name is next to course now.

for better UX

* feat: Test fix

test fix
  • Loading branch information
binodpant authored Jun 2, 2021
1 parent 21de664 commit 54c5590
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/components/BulkEnrollmentPage/CourseSearchResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const ENROLL_TEXT = 'Enroll learners';
export const TABLE_HEADERS = {
courseName: 'Course name',
courseStartDate: 'Course start date',
partnerName: 'Partner',
enroll: '',
};

Expand Down Expand Up @@ -90,6 +91,10 @@ export const BaseCourseSearchResults = (props) => {
// eslint-disable-next-line react/prop-types
Cell: ({ value, row }) => <CourseNameCell value={value} row={row} enterpriseSlug={enterpriseSlug} />,
},
{
Header: TABLE_HEADERS.partnerName,
accessor: 'partners[0].name',
},
{
Header: TABLE_HEADERS.courseStartDate,
accessor: 'advertised_course_run.start',
Expand Down
15 changes: 9 additions & 6 deletions src/components/BulkEnrollmentPage/CourseSearchResults.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const searchResults = {
start: testStartDate,
},
key: 'foo',
partners: [{ name: 'edX' }, { name: 'another_unused' }],
},
],
page: 3,
Expand Down Expand Up @@ -108,17 +109,19 @@ describe('<CourseSearchResults />', () => {

// Four header columns, one for sorting, one for Course Name, one for Course Run, one for the enroll column
const tableHeaderCells = wrapper.find('TableHeaderCell');
expect(tableHeaderCells.length).toBe(4);
expect(tableHeaderCells.length).toBe(5);
expect(tableHeaderCells.at(1).prop('Header')).toBe(TABLE_HEADERS.courseName);
expect(tableHeaderCells.at(2).prop('Header')).toBe(TABLE_HEADERS.courseStartDate);
expect(tableHeaderCells.at(3).prop('Header')).toBe('');
expect(tableHeaderCells.at(2).prop('Header')).toBe(TABLE_HEADERS.partnerName);
expect(tableHeaderCells.at(3).prop('Header')).toBe(TABLE_HEADERS.courseStartDate);
expect(tableHeaderCells.at(4).prop('Header')).toBe('');

// Three table cells, one for sorting, one title, one course run
const tableCells = wrapper.find('TableCell');
expect(tableCells.length).toBe(4);
expect(tableCells.length).toBe(5);
expect(tableCells.at(1).text()).toBe(testCourseName);
expect(tableCells.at(2).text()).toBe('Sep 10, 2020');
expect(tableCells.at(3).find(EnrollButton)).toHaveLength(1);
expect(tableCells.at(2).text()).toBe('edX');
expect(tableCells.at(3).text()).toBe('Sep 10, 2020');
expect(tableCells.at(4).find(EnrollButton)).toHaveLength(1);
});
it('displays search pagination', () => {
const wrapper = mount(<CourseSearchWrapper />);
Expand Down

0 comments on commit 54c5590

Please sign in to comment.