feat: whole course translations (#1330)
* feat: add language selection chore: update tests so we have less error message test: update test * test: update tests * chore: remove duplicate translation * chore: lint for console * chore: remove comments * chore: make sure the affect url frame refresh after the language selection change * chore: add whole_course_translation and language to courseware meta (#1305) * feat: Add feedback widget UI mock Add unit tests Fix snapshot Clean Sequence component logEvent calls Clean unit test Put feedback widget behind whole course translation flag Fix useFeedbackWidget test * chore: add src and dest translation * feat: first iteration of plugin translation chore: update plugin instruction * feat: Connect FeedbackWidget with backend services (#1325) Connect FeedbackWidget with backend services Move feedback widget to unit translation plugin * feat: Add authentication to WCT feedback endpoints (#1329) * chore: add fetch config and move feedback widget for the plugin chore: rewrite and test the api request chore: rebase chore: update translation feedback chore: test chore: add more tests * chore: rebase * chore: update requested change * chore: update package * chore: upgrade frontend-lib-special-exams and frontend-lib-learning-assistant * chore: update tests * chore: remove unneeded package * chore: update example config * chore: add source-map-loader * fix: feedback widget render error after submit feedback (#1335) * fix: feedback widget render error after submit feedback * fix: widget logic --------- Co-authored-by: Rodrigo Martin <rodrigom_94@hotmail.com>
This commit is contained in:
@@ -15,9 +15,11 @@ import { configureStore } from '@reduxjs/toolkit';
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
import { reducer as learningAssistantReducer } from '@edx/frontend-lib-learning-assistant';
|
||||
import { reducer as specialExamsReducer } from '@edx/frontend-lib-special-exams';
|
||||
import AppProvider from '@edx/frontend-platform/react/AppProvider';
|
||||
import { AppProvider } from '@edx/frontend-platform/react';
|
||||
import { reducer as courseHomeReducer } from './course-home/data';
|
||||
import { reducer as coursewareReducer } from './courseware/data/slice';
|
||||
import { reducer as recommendationsReducer } from './courseware/course/course-exit/data/slice';
|
||||
import { reducer as toursReducer } from './product-tours/data';
|
||||
import { reducer as modelsReducer } from './generic/model-store';
|
||||
import { UserMessagesProvider } from './generic/user-messages';
|
||||
|
||||
@@ -27,6 +29,17 @@ import { appendBrowserTimezoneToUrl, executeThunk } from './utils';
|
||||
import buildSimpleCourseAndSequenceMetadata from './courseware/data/__factories__/sequenceMetadata.factory';
|
||||
import { buildOutlineFromBlocks } from './courseware/data/__factories__/learningSequencesOutline.factory';
|
||||
|
||||
jest.mock('@openedx/frontend-plugin-framework', () => ({
|
||||
...jest.requireActual('@openedx/frontend-plugin-framework'),
|
||||
Plugin: () => 'Plugin',
|
||||
PluginSlot: () => 'PluginSlot',
|
||||
}));
|
||||
|
||||
jest.mock('@src/generic/plugin-store', () => ({
|
||||
...jest.requireActual('@src/generic/plugin-store'),
|
||||
usePluginsCallback: jest.fn((_, cb) => cb),
|
||||
}));
|
||||
|
||||
class MockLoggingService {
|
||||
// eslint-disable-next-line no-console
|
||||
logInfo = jest.fn(infoString => console.log(infoString));
|
||||
@@ -39,6 +52,15 @@ window.getComputedStyle = jest.fn(() => ({
|
||||
getPropertyValue: jest.fn(),
|
||||
}));
|
||||
|
||||
/* eslint-disable no-console */
|
||||
const supressWarningBlock = (callback) => {
|
||||
const originalConsoleWarning = console.warn;
|
||||
console.warn = jest.fn();
|
||||
callback();
|
||||
console.warn = originalConsoleWarning;
|
||||
};
|
||||
/* eslint-enable no-console */
|
||||
|
||||
// Mock Intersection Observer which is unavailable in the context of a test.
|
||||
global.IntersectionObserver = jest.fn(function mockIntersectionObserver() {
|
||||
this.observe = jest.fn();
|
||||
@@ -52,22 +74,18 @@ export const authenticatedUser = {
|
||||
administrator: false,
|
||||
};
|
||||
|
||||
export function initializeMockApp() {
|
||||
mergeConfig({
|
||||
CONTACT_URL: process.env.CONTACT_URL || null,
|
||||
DISCUSSIONS_MFE_BASE_URL: process.env.DISCUSSIONS_MFE_BASE_URL || null,
|
||||
INSIGHTS_BASE_URL: process.env.INSIGHTS_BASE_URL || null,
|
||||
STUDIO_BASE_URL: process.env.STUDIO_BASE_URL || null,
|
||||
TWITTER_URL: process.env.TWITTER_URL || null,
|
||||
authenticatedUser: {
|
||||
userId: 'abc123',
|
||||
username: 'MockUser',
|
||||
roles: [],
|
||||
administrator: false,
|
||||
},
|
||||
SUPPORT_URL_ID_VERIFICATION: 'http://example.com',
|
||||
});
|
||||
mergeConfig({
|
||||
...process.env,
|
||||
authenticatedUser: {
|
||||
userId: 'abc123',
|
||||
username: 'MockUser',
|
||||
roles: [],
|
||||
administrator: false,
|
||||
},
|
||||
SUPPORT_URL_ID_VERIFICATION: 'http://example.com',
|
||||
});
|
||||
|
||||
export function initializeMockApp() {
|
||||
const loggingService = configureLogging(MockLoggingService, {
|
||||
config: getConfig(),
|
||||
});
|
||||
@@ -77,11 +95,13 @@ export function initializeMockApp() {
|
||||
});
|
||||
|
||||
// i18n doesn't have a service class to return.
|
||||
configureI18n({
|
||||
// ignore missing/unexpect locale warnings from @edx/frontend-platform/i18n
|
||||
// it is unnecessary and not relevant to the tests
|
||||
supressWarningBlock(() => configureI18n({
|
||||
config: getConfig(),
|
||||
loggingService,
|
||||
messages,
|
||||
});
|
||||
}));
|
||||
|
||||
return { loggingService, authService };
|
||||
}
|
||||
@@ -120,6 +140,8 @@ export async function initializeTestStore(options = {}, overrideStore = true) {
|
||||
courseHome: courseHomeReducer,
|
||||
learningAssistant: learningAssistantReducer,
|
||||
specialExams: specialExamsReducer,
|
||||
recommendations: recommendationsReducer,
|
||||
tours: toursReducer,
|
||||
},
|
||||
});
|
||||
if (overrideStore) {
|
||||
|
||||
Reference in New Issue
Block a user