Compare commits
5 Commits
release/te
...
open-relea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1999f406fe | ||
|
|
36c9763587 | ||
|
|
641a5e27e2 | ||
|
|
5a9078499e | ||
|
|
7ec442bc04 |
11
package-lock.json
generated
11
package-lock.json
generated
@@ -57,7 +57,7 @@
|
||||
"whatwg-fetch": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@edx/browserslist-config": "^1.2.0",
|
||||
"@edx/browserslist-config": "^1.3.0",
|
||||
"@edx/react-unit-test-utils": "3.0.0",
|
||||
"@edx/reactifex": "^2.1.1",
|
||||
"@openedx/frontend-build": "14.0.3",
|
||||
@@ -2048,10 +2048,11 @@
|
||||
"integrity": "sha512-Dn9CtpC8fovh++Xi4NF5NJoeR9yU2yXZnV9IujxIyGd/dn0Phq5t6dzJVfupwq09mpDnzJv7egA8Znz/3ljO+w=="
|
||||
},
|
||||
"node_modules/@edx/browserslist-config": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@edx/browserslist-config/-/browserslist-config-1.2.0.tgz",
|
||||
"integrity": "sha512-T1+6P52Yx7SMkmoIr4O0Q3m/DyRdrLTJbv1xVijdRLFEq1hqdafEs+Ln1423U5LSkTePb9AOkEtL1G0RZLFl1w==",
|
||||
"dev": true
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@edx/browserslist-config/-/browserslist-config-1.3.0.tgz",
|
||||
"integrity": "sha512-qf4BHyjdsx/bVMQmfj1y/MwTZwI5+9DAOul+PJnyO+YhWSwdxtdvXqkOw1wLxqmDtqOPc5bYgDQf8zZfe+aDFA==",
|
||||
"dev": true,
|
||||
"license": "AGPL-3.0"
|
||||
},
|
||||
"node_modules/@edx/eslint-config": {
|
||||
"version": "4.0.0",
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/edx/frontend-app-ora-grading.git"
|
||||
},
|
||||
"browserslist": [
|
||||
"extends @edx/browserslist-config"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "fedx-scripts webpack",
|
||||
"i18n_extract": "fedx-scripts formatjs extract",
|
||||
@@ -72,7 +75,7 @@
|
||||
"whatwg-fetch": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@edx/browserslist-config": "^1.2.0",
|
||||
"@edx/browserslist-config": "^1.3.0",
|
||||
"@edx/react-unit-test-utils": "3.0.0",
|
||||
"@edx/reactifex": "^2.1.1",
|
||||
"@openedx/frontend-build": "14.0.3",
|
||||
|
||||
@@ -1,10 +1,30 @@
|
||||
import React from 'react';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { getConfig } from '@edx/frontend-platform';
|
||||
|
||||
import { NotificationsBanner } from '.';
|
||||
|
||||
jest.mock('@edx/frontend-platform', () => ({
|
||||
getConfig: jest.fn(),
|
||||
}));
|
||||
|
||||
describe('NotificationsBanner component', () => {
|
||||
test('snapshots', () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
test('snapshots with empty ACCOUNT_SETTINGS_URL', () => {
|
||||
getConfig.mockReturnValue({
|
||||
ACCOUNT_SETTINGS_URL: '',
|
||||
});
|
||||
const el = shallow(<NotificationsBanner hide />);
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('snapshots with ACCOUNT_SETTINGS_URL', () => {
|
||||
getConfig.mockReturnValue({
|
||||
ACCOUNT_SETTINGS_URL: 'http://localhost:1997',
|
||||
});
|
||||
const el = shallow(<NotificationsBanner hide />);
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`NotificationsBanner component snapshots 1`] = `
|
||||
exports[`NotificationsBanner component snapshots with ACCOUNT_SETTINGS_URL 1`] = `
|
||||
<PageBanner
|
||||
variant="accentB"
|
||||
>
|
||||
@@ -27,3 +27,22 @@ exports[`NotificationsBanner component snapshots 1`] = `
|
||||
</span>
|
||||
</PageBanner>
|
||||
`;
|
||||
|
||||
exports[`NotificationsBanner component snapshots with empty ACCOUNT_SETTINGS_URL 1`] = `
|
||||
<PageBanner
|
||||
variant="accentB"
|
||||
>
|
||||
<span>
|
||||
<FormattedMessage
|
||||
defaultMessage="You can now enable notifications for ORA assignments that require staff grading, from the "
|
||||
description="user info message that user can enable notifications for ORA assignments"
|
||||
id="ora-grading.NotificationsBanner.Message"
|
||||
/>
|
||||
<FormattedMessage
|
||||
defaultMessage="preferences center."
|
||||
description="placeholder for the preferences center link"
|
||||
id="ora-grading.NotificationsBanner.linkMessage"
|
||||
/>
|
||||
</span>
|
||||
</PageBanner>
|
||||
`;
|
||||
|
||||
@@ -10,16 +10,26 @@ export const NotificationsBanner = () => (
|
||||
<PageBanner variant="accentB">
|
||||
<span>
|
||||
<FormattedMessage {...messages.infoMessage} />
|
||||
<Hyperlink
|
||||
isInline
|
||||
variant="muted"
|
||||
destination={`${getConfig().ACCOUNT_SETTINGS_URL}/notifications`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
showLaunchIcon={false}
|
||||
>
|
||||
<FormattedMessage {...messages.notificationsBannerLinkMessage} />
|
||||
</Hyperlink>
|
||||
{
|
||||
(
|
||||
getConfig().ACCOUNT_SETTINGS_URL === null
|
||||
|| getConfig().ACCOUNT_SETTINGS_URL === undefined
|
||||
|| getConfig().ACCOUNT_SETTINGS_URL.trim().length === 0
|
||||
) ? (
|
||||
<FormattedMessage {...messages.notificationsBannerPreferencesCenterMessage} />
|
||||
) : (
|
||||
<Hyperlink
|
||||
isInline
|
||||
variant="muted"
|
||||
destination={`${getConfig().ACCOUNT_SETTINGS_URL}/notifications`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
showLaunchIcon={false}
|
||||
>
|
||||
<FormattedMessage {...messages.notificationsBannerPreferencesCenterMessage} />
|
||||
</Hyperlink>
|
||||
)
|
||||
}
|
||||
</span>
|
||||
</PageBanner>
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@ const messages = defineMessages({
|
||||
defaultMessage: 'You can now enable notifications for ORA assignments that require staff grading, from the ',
|
||||
description: 'user info message that user can enable notifications for ORA assignments',
|
||||
},
|
||||
notificationsBannerLinkMessage: {
|
||||
notificationsBannerPreferencesCenterMessage: {
|
||||
id: 'ora-grading.NotificationsBanner.linkMessage',
|
||||
defaultMessage: 'preferences center.',
|
||||
description: 'placeholder for the preferences center link',
|
||||
|
||||
@@ -16,7 +16,7 @@ import ReviewError from './ReviewError';
|
||||
*/
|
||||
export class LockErrors extends React.Component {
|
||||
get errorProp() {
|
||||
if (this.props.errorStatus === ErrorStatuses.forbidden) {
|
||||
if (this.props.errorStatus === ErrorStatuses.conflict) {
|
||||
return {
|
||||
heading: messages.errorLockContestedHeading,
|
||||
message: messages.errorLockContested,
|
||||
|
||||
@@ -41,7 +41,7 @@ describe('LockErrors component', () => {
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('snapshot: error with conflicted lock', () => {
|
||||
el = shallow(<LockErrors {...props} errorStatus={ErrorStatuses.forbidden} />);
|
||||
el = shallow(<LockErrors {...props} errorStatus={ErrorStatuses.conflict} />);
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,9 +6,9 @@ import { RequestKeys } from 'data/constants/requests';
|
||||
import api from 'data/services/lms/api';
|
||||
import * as download from './download';
|
||||
|
||||
const mockBlobWriter = jest.fn().mockName('BlobWriter');
|
||||
const mockTextReader = jest.fn().mockName('TextReader');
|
||||
const mockBlobReader = jest.fn().mockName('BlobReader');
|
||||
const mockBlobWriter = jest.fn();
|
||||
const mockTextReader = jest.fn();
|
||||
const mockBlobReader = jest.fn();
|
||||
|
||||
const mockZipAdd = jest.fn();
|
||||
const mockZipClose = jest.fn();
|
||||
@@ -21,9 +21,9 @@ jest.mock('@zip.js/zip.js', () => {
|
||||
close: mockZipClose.mockImplementation(() => Promise.resolve(files)),
|
||||
files,
|
||||
})),
|
||||
BlobWriter: () => mockBlobWriter,
|
||||
TextReader: () => mockTextReader,
|
||||
BlobReader: () => mockBlobReader,
|
||||
BlobWriter: function _() { return mockBlobWriter; },
|
||||
TextReader: function _() { return mockTextReader; },
|
||||
BlobReader: function _() { return mockBlobReader; },
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user