Skip to content

Commit

Permalink
Merge pull request #8504 from MisRob/home-page
Browse files Browse the repository at this point in the history
The hybrid learning home page
  • Loading branch information
rtibbles authored Oct 28, 2021
2 parents 0f7965c + f07d662 commit f642bee
Show file tree
Hide file tree
Showing 28 changed files with 1,223 additions and 235 deletions.
4 changes: 2 additions & 2 deletions kolibri/core/assets/src/api-resources/contentNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ export default new Resource({
fetchRecommendationsFor(id, getParams) {
return this.fetchDetailCollection('recommendations_for', id, getParams);
},
fetchResume(getParams) {
return this.fetchDetailCollection('resume', Store.getters.currentUserId, getParams);
fetchResume(getParams, force) {
return this.fetchDetailCollection('resume', Store.getters.currentUserId, getParams, force);
},
fetchPopular(getParams) {
return this.fetchListCollection('popular', getParams);
Expand Down
12 changes: 10 additions & 2 deletions kolibri/core/assets/src/views/TextTruncatorCss.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@
of what truncating technique is used. Otherwise adding padding directly
would break when using technique (B) since text that should be truncated
would show in padding area.
Attributes are inherited by the inner `div` to emulate the same behavior
like if only one element would wrap the text to allow attributes be applied
as close as possible to the text element.
-->
<div>
<div :class="$computedClass(truncate)">
<div
v-bind="$attrs"
:class="$computedClass(truncate)"
>
{{ text }}
</div>
</div>
Expand All @@ -28,6 +35,7 @@
*/
export default {
name: 'TextTruncatorCss',
inheritAttrs: false,
props: {
text: {
type: String,
Expand Down Expand Up @@ -114,7 +122,7 @@
position: 'absolute',
right: 0,
width: ellipsisWidth,
height: '50%',
height: '100%',
background: 'white',
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* `useChannels` composable function mock.
*
* If default values are sufficient for tests,
* you only need call `jest.mock('<useChannels 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 `useChannelsMock` that accepts
* an object with values to be overriden and use it together
* with `mockImplementation` as follows:
*
* ```
* // eslint-disable-next-line import/named
* import useChannels, { useChannelsMock } from '<useChannels file path>';
*
* jest.mock('<useChannels file path>')
*
* it('test', () => {
* useChannels.mockImplementation(
* () => useChannelsMock({ channels: [{ id: 'channel-1' }] })
* );
* })
* ```
*
* You can reset your mock implementation back to default values
* for other tests by calling the following in `beforeEach`:
*
* ```
* useChannels.mockImplementation(() => useChannelsMock())
* ```
*/

const MOCK_DEFAULTS = {
channels: [],
fetchChannels: jest.fn(),
};

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

export default jest.fn(() => useChannelsMock());
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@

const MOCK_DEFAULTS = {
classes: [],
activeClassesLessons: [],
activeClassesQuizzes: [],
resumableClassesQuizzes: [],
resumableClassesResources: [],
resumableNonClassesContentNodes: [],
learnerFinishedAllClasses: false,
getClass: jest.fn(),
getClassActiveLessons: jest.fn(),
getClassActiveQuizzes: jest.fn(),
getResumableContentNode: jest.fn(),
getResumableContentNodeProgress: jest.fn(),
getClassLessonLink: jest.fn(),
getClassQuizLink: jest.fn(),
getClassResourceLink: jest.fn(),
getTopicContentNodeLink: jest.fn(),
fetchClass: jest.fn(),
fetchClasses: jest.fn(),
fetchResumableContentNodes: jest.fn(),
};
Expand Down
Loading

0 comments on commit f642bee

Please sign in to comment.