-
Notifications
You must be signed in to change notification settings - Fork 189
feat: add programs dashboard #751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MaxFrank13
wants to merge
14
commits into
openedx:master
Choose a base branch
from
edx:mfrank/add-program-list-page
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
745210b
feat: add program dashboard directory (#1)
MaxFrank13 91b6925
feat: add program dashboard directory (#1)
MaxFrank13 17ae415
feat: add program list page
MaxFrank13 51c4db5
feat: add program list view
MaxFrank13 5f0999f
fix: deps
MaxFrank13 6b99660
fix: tests
MaxFrank13 0d9be86
Merge branch 'program-dashboard-feature' into mfrank/add-program-list…
MaxFrank13 2b77225
fix: removed comment
MaxFrank13 1a901f5
feat: add program list page
MaxFrank13 de68d2d
feat: program dashboard
MaxFrank13 6f6d16b
Merge branch 'master' into mfrank/add-program-list-page
MaxFrank13 3b83401
fix: test coverage
MaxFrank13 fd3ff70
fix: code cov
MaxFrank13 0bb1231
fix: requested changes
MaxFrank13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
64 changes: 64 additions & 0 deletions
64
src/containers/ProgramDashboard/ProgramsList/ExploreProgramsCTA.test.tsx
This file contains hidden or 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,64 @@ | ||
| import { render, screen } from '@testing-library/react'; | ||
| import { getConfig } from '@edx/frontend-platform'; | ||
| import { IntlProvider } from '@edx/frontend-platform/i18n'; | ||
|
|
||
| import ExploreProgramsCTA from './ExploreProgramsCTA'; | ||
| import messages from './messages'; | ||
|
|
||
| jest.mock('@edx/frontend-platform', () => ({ | ||
| getConfig: jest.fn(() => ({ | ||
| LMS_BASE_URL: 'https://courses.example.com', | ||
| EXPLORE_PROGRAMS_URL: null, | ||
| })), | ||
| })); | ||
|
|
||
| describe('ExploreProgramsCTA', () => { | ||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| const renderComponent = (props = {}) => render( | ||
| <IntlProvider locale="en"> | ||
| <ExploreProgramsCTA {...props} /> | ||
| </IntlProvider>, | ||
| ); | ||
|
|
||
| it('renders the expected CTA text when there are enrollments', () => { | ||
| renderComponent(); | ||
|
|
||
| expect(screen.getByText(messages.exploreProgramsCTAText.defaultMessage)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('renders the expected CTA when there are no enrollments', () => { | ||
| renderComponent({ hasEnrollments: false }); | ||
|
|
||
| expect(screen.getByText(messages.hasNoEnrollmentsText.defaultMessage)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('renders the button with the expected text', () => { | ||
| renderComponent(); | ||
|
|
||
| expect(screen.getByRole('link', { name: messages.exploreProgramsCTAButtonText.defaultMessage })).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('uses EXPLORE_PROGRAMS_URL when it is defined', () => { | ||
| const customUrl = 'https://custom.explore.url/programs'; | ||
| getConfig.mockReturnValueOnce({ | ||
| LMS_BASE_URL: 'https://courses.example.com', | ||
| EXPLORE_PROGRAMS_URL: customUrl, | ||
| }); | ||
|
|
||
| renderComponent(); | ||
|
|
||
| const button = screen.getByRole('link', { name: messages.exploreProgramsCTAButtonText.defaultMessage }); | ||
| expect(button).toHaveAttribute('href', customUrl); | ||
| }); | ||
|
|
||
| it('falls back to LMS_BASE_URL/courses when EXPLORE_PROGRAMS_URL is not defined', () => { | ||
| renderComponent(); | ||
|
|
||
| const button = screen.getByRole('link', { name: messages.exploreProgramsCTAButtonText.defaultMessage }); | ||
| const expectedFallbackUrl = `${getConfig().LMS_BASE_URL}/courses`; | ||
| expect(button).toHaveAttribute('href', expectedFallbackUrl); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.