Skip to content

Commit

Permalink
Merge pull request #8430 from MisRob/learn-home
Browse files Browse the repository at this point in the history
Hybrid learning home page MVP - for string freeze
  • Loading branch information
marcellamaki committed Sep 15, 2021
2 parents 88737b4 + 801a162 commit d137982
Show file tree
Hide file tree
Showing 39 changed files with 2,597 additions and 313 deletions.
20 changes: 20 additions & 0 deletions kolibri/core/assets/src/mixins/commonCoreStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ export const coreStrings = createTranslator('CommonCoreStrings', {
context:
"Gender is an option which a user can select in Kolibri when they create another user.\n\nGender can be either 'Female', 'Male' or 'Not specified'.",
},
homeLabel: {
message: 'Home',
context:
"Home page is a place for learners containing summary of their activities and suggestions for what to do next. For example, they can see a list of classess they're enrolled in, their recent lessons and quizess, and they can directly navigate to resources to continue learning from.",
},
identifierLabel: {
message: 'Identifier',
context:
Expand Down Expand Up @@ -390,6 +395,21 @@ export const coreStrings = createTranslator('CommonCoreStrings', {
watchActivity: 'Watch',
exploreActivity: 'Explore',
topicLabel: 'Topic',
readReference: {
message: 'Reference',
context:
'We display time duration for most of learning activities. However, for read activity, we display this label instead of time duration information.',
},
shortActivity: {
message: 'Short activity',
context:
'This is what we display as time estimation for some types of learning activities that take less than 30 minutes',
},
longActivity: {
message: 'Long activity',
context:
'This is what we display as time estimation for some types of learning activities that take more than 30 minutes',
},

// Notifications
changesSavedNotification: {
Expand Down
3 changes: 3 additions & 0 deletions kolibri/plugins/learn/assets/src/__mocks__/apiResources.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const LearnerClassroomResource = {
fetchCollection: jest.fn(),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* `useDeviceSettings` composable function mock.
*
* If default values are sufficient for tests,
* you only need call `jest.mock('<useDeviceSettings file path>')`
* at the top of a test file.
*
* If you need to override some default values from some tests,
* you can import a helper function `useDeviceSettingsMock` that accepts
* an object with values to be overriden and use it together
* with `mockImplementation` as follows:
*
* ```
* // eslint-disable-next-line import/named
* import useDeviceSettings, { useDeviceSettingsMock } from '<useDeviceSettings file path>';
*
* jest.mock('<useDeviceSettings file path>')
*
* it('test', () => {
* useDeviceSettings.mockImplementation(
* () => useDeviceSettingsMock({ allowGuestAccess: true })
* );
* })
* ```
*
* You can reset your mock implementation back to default values
* for other tests by calling the following in `beforeEach`:
*
* ```
* useDeviceSettings.mockImplementation(() => useDeviceSettingsMock())
* ```
*/

const MOCK_DEFAULTS = {
allowGuestAccess: false,
canAccessUnassignedContent: false,
};

export function useDeviceSettingsMock(overrides = {}) {
return {
...MOCK_DEFAULTS,
...overrides,
};
}

export default jest.fn(() => useDeviceSettingsMock());
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* `useLearnerResources` composable function mock.
*
* If default values are sufficient for tests,
* you only need call `jest.mock('<useLearnerResources file path>')`
* at the top of a test file.
*
* If you need to override some default values from some tests,
* you can import a helper function `useLearnerResourcesMock` that accepts
* an object with values to be overriden and use it together
* with `mockImplementation` as follows:
*
* ```
* // eslint-disable-next-line import/named
* import useLearnerResources, { useLearnerResourcesMock } from '<useLearnerResources file path>';
*
* jest.mock('<useLearnerResources file path>')
*
* it('test', () => {
* useLearnerResources.mockImplementation(
* () => useLearnerResourcesMock({ classes: [{ id: 'class-1' }] })
* );
* })
* ```
*
* You can reset your mock implementation back to default values
* for other tests by calling the following in `beforeEach`:
*
* ```
* useLearnerResources.mockImplementation(() => useLearnerResourcesMock())
* ```
*/

const MOCK_DEFAULTS = {
classes: [],
resumableClassesQuizzes: [],
resumableClassesResources: [],
resumableNonClassesContentNodes: [],
getClass: jest.fn(),
getResumableContentNode: jest.fn(),
getClassQuizLink: jest.fn(),
getClassResourceLink: jest.fn(),
getTopicContentNodeLink: jest.fn(),
fetchClasses: jest.fn(),
fetchResumableContentNodes: jest.fn(),
};

export function useLearnerResourcesMock(overrides = {}) {
return {
...MOCK_DEFAULTS,
...overrides,
};
}

export default jest.fn(() => useLearnerResourcesMock());
45 changes: 45 additions & 0 deletions kolibri/plugins/learn/assets/src/composables/__mocks__/useUser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* `useUser` composable function mock.
*
* If default values are sufficient for tests,
* you only need call `jest.mock('<useUser file path>')`
* at the top of a test file.
*
* If you need to override some default values from some tests,
* you can import a helper function `useUserMock` that accepts
* an object with values to be overriden and use it together
* with `mockImplementation` as follows:
*
* ```
* // eslint-disable-next-line import/named
* import useUser, { useUserMock } from '<useUser file path>';
*
* jest.mock('<useUser file path>')
*
* it('test', () => {
* useUser.mockImplementation(
* () => useUserMock({ isUserLoggedIn: true })
* );
* })
* ```
*
* You can reset your mock implementation back to default values
* for other tests by calling the following in `beforeEach`:
*
* ```
* useUser.mockImplementation(() => useUserMock())
* ```
*/

const MOCK_DEFAULTS = {
isUserLoggedIn: false,
};

export function useUserMock(overrides = {}) {
return {
...MOCK_DEFAULTS,
...overrides,
};
}

export default jest.fn(() => useUserMock());

0 comments on commit d137982

Please sign in to comment.