-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'openedx:master' into jci/issue#1509
- Loading branch information
Showing
8 changed files
with
119 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ import * as hooks from './hooks'; | |
* Changes to it should be vetted by them ([email protected]). | ||
*/ | ||
export const IFRAME_FEATURE_POLICY = ( | ||
'microphone *; camera *; midi *; geolocation *; encrypted-media *, clipboard-write *' | ||
'microphone *; camera *; midi *; geolocation *; encrypted-media *; clipboard-write *' | ||
); | ||
|
||
export const testIDs = StrictDict({ | ||
|
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,49 @@ | ||
import { getConfig } from '@edx/frontend-platform'; | ||
import { Hyperlink } from '@openedx/paragon'; | ||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
import { logError } from '@edx/frontend-platform/logging'; | ||
import { sendTrackEvent } from '@edx/frontend-platform/analytics'; | ||
import FooterSlot from '@openedx/frontend-slot-footer'; | ||
|
||
import HeaderSlot from '../plugin-slots/HeaderSlot'; | ||
import messages from './messages'; | ||
|
||
const PageNotFound = () => { | ||
const { formatMessage } = useIntl(); | ||
const location = window.location.href; | ||
|
||
logError('Page failed to load, probably an invalid URL.', location); | ||
sendTrackEvent('edx.ui.lms.page_not_found', { location }); | ||
|
||
return ( | ||
<> | ||
<HeaderSlot /> | ||
<main | ||
id="main-content" | ||
className="main-content d-flex justify-content-center align-items-center flex-column" | ||
style={{ | ||
height: '50vh', | ||
}} | ||
> | ||
<h1 className="h3"> | ||
{formatMessage(messages.pageNotFoundHeader)} | ||
</h1> | ||
<p> | ||
{formatMessage( | ||
messages.pageNotFoundBody, | ||
{ | ||
homepageLink: ( | ||
<Hyperlink destination={getConfig().LMS_BASE_URL}> | ||
{formatMessage(messages.homepageLink)} | ||
</Hyperlink> | ||
), | ||
}, | ||
)} | ||
</p> | ||
</main> | ||
<FooterSlot /> | ||
</> | ||
); | ||
}; | ||
|
||
export default PageNotFound; |
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,41 @@ | ||
import { getConfig, history } from '@edx/frontend-platform'; | ||
import { Routes, Route } from 'react-router-dom'; | ||
import { sendTrackEvent } from '@edx/frontend-platform/analytics'; | ||
|
||
import { | ||
initializeTestStore, | ||
render, | ||
screen, | ||
} from '../setupTest'; | ||
import PageNotFound from './PageNotFound'; | ||
import messages from './messages'; | ||
|
||
jest.mock('@edx/frontend-platform/analytics'); | ||
|
||
describe('PageNotFound', () => { | ||
beforeEach(async () => { | ||
await initializeTestStore(); | ||
const invalidUrl = '/new/course'; | ||
history.push(invalidUrl); | ||
render( | ||
<Routes> | ||
<Route path="*" element={<PageNotFound />} /> | ||
</Routes>, | ||
{ wrapWithRouter: true }, | ||
); | ||
}); | ||
|
||
it('displays page not found header', () => { | ||
expect(screen.getByText(messages.pageNotFoundHeader.defaultMessage)).toBeVisible(); | ||
}); | ||
|
||
it('displays link back to learner dashboard', () => { | ||
const expected = getConfig().LMS_BASE_URL; | ||
const homepageLink = screen.getByRole('link', { name: messages.homepageLink.defaultMessage }); | ||
expect(homepageLink).toHaveAttribute('href', expected); | ||
}); | ||
|
||
it('calls tracking events', () => { | ||
expect(sendTrackEvent).toHaveBeenCalled(); | ||
}); | ||
}); |
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