@windward/core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +13 -0
- package/.eslintrc.js +11 -0
- package/.prettierrc +4 -0
- package/README.md +86 -0
- package/babel.config.js +1 -0
- package/components/Content/Blocks/Accordion.vue +133 -0
- package/components/Content/Blocks/ClickableIcons.vue +98 -0
- package/components/Content/Blocks/Feedback.vue +323 -0
- package/components/Content/Blocks/FeedbackTemplates/FeedbackQuestionLikert.vue +95 -0
- package/components/Content/Blocks/FeedbackTemplates/FeedbackQuestionOpenResponse.vue +45 -0
- package/components/Content/Blocks/FeedbackTemplates/FeedbackQuestionTrueFalse.vue +55 -0
- package/components/Content/Blocks/Image.vue +116 -0
- package/components/Content/Blocks/Math.vue +87 -0
- package/components/Content/Blocks/Tab.vue +89 -0
- package/components/Content/Blocks/Table.vue +68 -0
- package/components/Content/Blocks/UserUpload/DisplayUserFilesTable.vue +157 -0
- package/components/Content/Blocks/UserUpload/ManageDataTableUserFiles.vue +68 -0
- package/components/Content/Blocks/UserUpload.vue +240 -0
- package/components/Content/Blocks/Video.vue +245 -0
- package/components/Navigation/Items/CourseGlossaryToolNav.vue +39 -0
- package/components/Navigation/Items/GlossaryNav.vue +32 -0
- package/components/Navigation/Items/UserUploadNav.vue +35 -0
- package/components/Settings/AccordionSettings.vue +153 -0
- package/components/Settings/ClickableIconsSettings.vue +189 -0
- package/components/Settings/FeedbackSettings.vue +92 -0
- package/components/Settings/ImageSettings.vue +124 -0
- package/components/Settings/MathSettings.vue +81 -0
- package/components/Settings/TabSettings.vue +139 -0
- package/components/Settings/TextEditorSettings.vue +249 -0
- package/components/Settings/UserUploadSettings.vue +151 -0
- package/components/Settings/VideoSettings.vue +699 -0
- package/components/utils/ContentViewer.vue +69 -0
- package/components/utils/MathExpressionEditor.vue +294 -0
- package/components/utils/MathLiveWrapper.vue +86 -0
- package/components/utils/TinyMCEWrapper.vue +103 -0
- package/components/utils/glossary/CourseGlossary.vue +284 -0
- package/components/utils/glossary/CourseGlossaryForm.vue +106 -0
- package/components/utils/glossary/GlossaryToolTip.vue +87 -0
- package/config/tinymce.config.js +136 -0
- package/helpers/GlossaryHelper.ts +137 -0
- package/helpers/GlossaryTerm.ts +31 -0
- package/helpers/MathHelper.ts +236 -0
- package/helpers/tinymce/plugin.ts +83 -0
- package/i18n/en-US/components/content/blocks/feedback.ts +28 -0
- package/i18n/en-US/components/content/blocks/image.ts +5 -0
- package/i18n/en-US/components/content/blocks/index.ts +15 -0
- package/i18n/en-US/components/content/blocks/tab.ts +4 -0
- package/i18n/en-US/components/content/blocks/table.ts +4 -0
- package/i18n/en-US/components/content/blocks/user_upload.ts +12 -0
- package/i18n/en-US/components/content/blocks/video.ts +53 -0
- package/i18n/en-US/components/content/index.ts +5 -0
- package/i18n/en-US/components/index.ts +12 -0
- package/i18n/en-US/components/navigation/image.ts +4 -0
- package/i18n/en-US/components/navigation/index.ts +7 -0
- package/i18n/en-US/components/navigation/user_upload.ts +3 -0
- package/i18n/en-US/components/settings/clickable_icon.ts +9 -0
- package/i18n/en-US/components/settings/image.ts +1 -0
- package/i18n/en-US/components/settings/index.ts +13 -0
- package/i18n/en-US/components/settings/text_editor.ts +7 -0
- package/i18n/en-US/components/settings/user_upload.ts +11 -0
- package/i18n/en-US/components/settings/video.ts +13 -0
- package/i18n/en-US/components/utils/index.ts +5 -0
- package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +7 -0
- package/i18n/en-US/index.ts +16 -0
- package/i18n/en-US/modules/index.ts +5 -0
- package/i18n/en-US/pages/glossary.ts +7 -0
- package/i18n/en-US/pages/index.ts +7 -0
- package/i18n/en-US/pages/user_upload.ts +3 -0
- package/i18n/en-US/shared/content_blocks.ts +20 -0
- package/i18n/en-US/shared/index.ts +11 -0
- package/i18n/en-US/shared/menu.ts +3 -0
- package/i18n/en-US/shared/permission.ts +15 -0
- package/i18n/en-US/shared/settings.ts +15 -0
- package/index.js +15 -0
- package/jest.config.js +15 -0
- package/models/SurveyResult.ts +8 -0
- package/models/SurveyTemplate.ts +8 -0
- package/models/UserFileAsset.ts +12 -0
- package/package.json +48 -0
- package/pages/glossary.vue +31 -0
- package/pages/userUpload.vue +204 -0
- package/plugin.js +299 -0
- package/test/Components/Content/Blocks/Accordion.spec.js +21 -0
- package/test/Components/Content/Blocks/ClickableIcons.spec.js +21 -0
- package/test/Components/Content/Blocks/Feedback.spec.js +31 -0
- package/test/Components/Content/Blocks/FeedbackTemplates/FeedbackQuestionLikert.spec.js +23 -0
- package/test/Components/Content/Blocks/FeedbackTemplates/FeedbackQuestionOpenResponse.spec.js +23 -0
- package/test/Components/Content/Blocks/FeedbackTemplates/FeedbackQuestionTrueFalse.spec.js +23 -0
- package/test/Components/Content/Blocks/Image.spec.js +34 -0
- package/test/Components/Content/Blocks/Math.spec.js +34 -0
- package/test/Components/Content/Blocks/Tab.spec.js +20 -0
- package/test/Components/Content/Blocks/Table.spec.js +21 -0
- package/test/Components/Content/Blocks/UserUpload.spec.js +25 -0
- package/test/Components/Content/Blocks/Video.spec.js +112 -0
- package/test/Components/Settings/AccordionSettings.spec.js +45 -0
- package/test/Components/Settings/ClickableIconsSettings.spec.js +20 -0
- package/test/Components/Settings/FeedbackSettings.spec.js +20 -0
- package/test/Components/Settings/ImageSettings.spec.js +20 -0
- package/test/Components/Settings/MathSettings.spec.js +20 -0
- package/test/Components/Settings/TabSettings.spec.js +45 -0
- package/test/Components/Settings/UserUploadSettings.spec.js +20 -0
- package/test/__mocks__/componentsMock.js +83 -0
- package/test/__mocks__/contentBlockMock.js +119 -0
- package/test/__mocks__/contentSettingsMock.js +54 -0
- package/test/__mocks__/fileMock.js +1 -0
- package/test/__mocks__/helpersMock.js +53 -0
- package/test/__mocks__/modelMock.js +82 -0
- package/test/__mocks__/styleMock.js +1 -0
- package/test/helpers/GlossaryHelper.spec.js +227 -0
- package/test/helpers/MathHelper.spec.js +128 -0
- package/test/mocks.js +140 -0
- package/tsconfig.json +15 -0
- package/utils/index.js +18 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import Vuetify from 'vuetify'
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
|
|
5
|
+
import { defaultMocks } from '@/test/mocks'
|
|
6
|
+
|
|
7
|
+
jest.mock('@mindedge/vuetify-player', () => {
|
|
8
|
+
return jest.fn().mockImplementation(() => {})
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
import Video from '@/components/Content/Blocks/Video.vue'
|
|
12
|
+
|
|
13
|
+
Vue.use(Vuetify)
|
|
14
|
+
|
|
15
|
+
const metadata = {
|
|
16
|
+
columns: 12,
|
|
17
|
+
config: {
|
|
18
|
+
type: 'video',
|
|
19
|
+
attributes: {
|
|
20
|
+
autoplay: false,
|
|
21
|
+
autopictureinpicture: false,
|
|
22
|
+
controls: true,
|
|
23
|
+
controlslist: 'nodownload noremoteplayback',
|
|
24
|
+
crossorigin: 'anonymous',
|
|
25
|
+
disablepictureinpicture: true,
|
|
26
|
+
disableremoteplayback: true,
|
|
27
|
+
height: 'auto',
|
|
28
|
+
width: '100%',
|
|
29
|
+
rewind: true,
|
|
30
|
+
loop: false,
|
|
31
|
+
muted: false,
|
|
32
|
+
playsinline: false,
|
|
33
|
+
poster: '',
|
|
34
|
+
preload: '',
|
|
35
|
+
captionsmenu: true,
|
|
36
|
+
playlistmenu: true,
|
|
37
|
+
playlistautoadvance: true,
|
|
38
|
+
playbackrates: [0.5, 1, 1.5, 2],
|
|
39
|
+
},
|
|
40
|
+
playlist: [
|
|
41
|
+
{
|
|
42
|
+
name: 'preroll_example.mp4',
|
|
43
|
+
sources: [
|
|
44
|
+
{
|
|
45
|
+
file_asset_id: '00000000-0000-0000-0000-000000000000',
|
|
46
|
+
src: 'https://jest.test/video.mp4',
|
|
47
|
+
type: 'video/mp4',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe('Video', () => {
|
|
56
|
+
test('Video is a Vue instance', () => {
|
|
57
|
+
const wrapper = mount(Video, {
|
|
58
|
+
vuetify: new Vuetify(),
|
|
59
|
+
propsData: {
|
|
60
|
+
value: { body: 'video', metadata: { config: {} } },
|
|
61
|
+
},
|
|
62
|
+
mocks: defaultMocks,
|
|
63
|
+
})
|
|
64
|
+
expect(wrapper.vm).toBeTruthy()
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('Video applied metadata correctly', () => {
|
|
68
|
+
const wrapper = mount(Video, {
|
|
69
|
+
vuetify: new Vuetify(),
|
|
70
|
+
propsData: {
|
|
71
|
+
value: {
|
|
72
|
+
body: 'video',
|
|
73
|
+
metadata,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
mocks: defaultMocks,
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
expect(wrapper.vm).toBeTruthy()
|
|
80
|
+
expect(wrapper.vm.$data.block.metadata.config.type).toBe(
|
|
81
|
+
metadata.config.type
|
|
82
|
+
)
|
|
83
|
+
expect(wrapper.vm.$data.block.metadata.config.attributes).toStrictEqual(
|
|
84
|
+
metadata.config.attributes
|
|
85
|
+
)
|
|
86
|
+
expect(wrapper.vm.$data.block.metadata.config.playlist).toStrictEqual(
|
|
87
|
+
metadata.config.playlist
|
|
88
|
+
)
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
test('Video config edit mode', async () => {
|
|
92
|
+
const wrapper = mount(Video, {
|
|
93
|
+
vuetify: new Vuetify(),
|
|
94
|
+
propsData: {
|
|
95
|
+
value: {
|
|
96
|
+
body: 'video',
|
|
97
|
+
metadata,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
mocks: defaultMocks,
|
|
101
|
+
})
|
|
102
|
+
expect(wrapper.vm).toBeTruthy()
|
|
103
|
+
|
|
104
|
+
// Render mode enabled by default aka non-edit mode
|
|
105
|
+
expect(wrapper.vm.$data.render).toEqual(true)
|
|
106
|
+
|
|
107
|
+
// Turn on edit mode and test
|
|
108
|
+
await wrapper.vm.onActionPanelEdit()
|
|
109
|
+
|
|
110
|
+
expect(wrapper.vm.$data.render).toEqual(false)
|
|
111
|
+
})
|
|
112
|
+
})
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import Vuetify from 'vuetify'
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
|
|
5
|
+
import { defaultMocks } from '@/test/mocks'
|
|
6
|
+
import AccordionSettings from '@/components/Settings/AccordionSettings'
|
|
7
|
+
|
|
8
|
+
Vue.use(Vuetify)
|
|
9
|
+
|
|
10
|
+
describe('AccordionSettings', () => {
|
|
11
|
+
test('is a Vue instance', () => {
|
|
12
|
+
const wrapper = shallowMount(AccordionSettings, {
|
|
13
|
+
propsData: {
|
|
14
|
+
tag: 'core-accordion-settings',
|
|
15
|
+
},
|
|
16
|
+
mocks: defaultMocks,
|
|
17
|
+
})
|
|
18
|
+
expect(wrapper.vm).toBeTruthy()
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('can add an accordion', () => {
|
|
22
|
+
const wrapper = shallowMount(AccordionSettings, {
|
|
23
|
+
propsData: {
|
|
24
|
+
tag: 'core-accordion-settings',
|
|
25
|
+
},
|
|
26
|
+
mocks: defaultMocks,
|
|
27
|
+
})
|
|
28
|
+
wrapper.vm.onAddElement()
|
|
29
|
+
expect(wrapper.vm.$data.block.metadata.config.items).toEqual([
|
|
30
|
+
{ header: '', expand: false, content: '' },
|
|
31
|
+
{ header: '', expand: false, content: '' },
|
|
32
|
+
])
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
test('can remove an accordion', () => {
|
|
36
|
+
const wrapper = shallowMount(AccordionSettings, {
|
|
37
|
+
propsData: {
|
|
38
|
+
tag: 'core-accordion-settings',
|
|
39
|
+
},
|
|
40
|
+
mocks: defaultMocks,
|
|
41
|
+
})
|
|
42
|
+
wrapper.vm.onRemoveElement(0)
|
|
43
|
+
expect(wrapper.vm.$data.block.metadata.config.items).toEqual([])
|
|
44
|
+
})
|
|
45
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import Vuetify from 'vuetify'
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
|
|
5
|
+
import { defaultMocks } from '@/test/mocks'
|
|
6
|
+
import ClickableIconsSettings from '@/components/Settings/ClickableIconsSettings'
|
|
7
|
+
|
|
8
|
+
Vue.use(Vuetify)
|
|
9
|
+
|
|
10
|
+
describe('ClickableIconsSettings', () => {
|
|
11
|
+
test('is a Vue instance', () => {
|
|
12
|
+
const wrapper = shallowMount(ClickableIconsSettings, {
|
|
13
|
+
propsData: {
|
|
14
|
+
tag: 'core-clickable-icon-setting',
|
|
15
|
+
},
|
|
16
|
+
mocks: defaultMocks,
|
|
17
|
+
})
|
|
18
|
+
expect(wrapper.vm).toBeTruthy()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import Vuetify from 'vuetify'
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
|
|
5
|
+
import { defaultMocks } from '@/test/mocks'
|
|
6
|
+
import FeedbackSettings from '@/components/Settings/FeedbackSettings'
|
|
7
|
+
|
|
8
|
+
Vue.use(Vuetify)
|
|
9
|
+
|
|
10
|
+
describe('FeedbackSettings', () => {
|
|
11
|
+
test('is a Vue instance', () => {
|
|
12
|
+
const wrapper = shallowMount(FeedbackSettings, {
|
|
13
|
+
propsData: {
|
|
14
|
+
tag: 'core-feedback-settings',
|
|
15
|
+
},
|
|
16
|
+
mocks: defaultMocks,
|
|
17
|
+
})
|
|
18
|
+
expect(wrapper.vm).toBeTruthy()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import Vuetify from 'vuetify'
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
|
|
5
|
+
import { defaultMocks } from '@/test/mocks'
|
|
6
|
+
import ImageSettings from '@/components/Settings/ImageSettings'
|
|
7
|
+
|
|
8
|
+
Vue.use(Vuetify)
|
|
9
|
+
|
|
10
|
+
describe('ImageSettings', () => {
|
|
11
|
+
test('is a Vue instance', () => {
|
|
12
|
+
const wrapper = shallowMount(ImageSettings, {
|
|
13
|
+
propsData: {
|
|
14
|
+
tag: 'core-image-settings',
|
|
15
|
+
},
|
|
16
|
+
mocks: defaultMocks,
|
|
17
|
+
})
|
|
18
|
+
expect(wrapper.vm).toBeTruthy()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import Vuetify from 'vuetify'
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
|
|
5
|
+
import { defaultMocks } from '@/test/mocks'
|
|
6
|
+
import MathSettings from '@/components/Settings/MathSettings'
|
|
7
|
+
|
|
8
|
+
Vue.use(Vuetify)
|
|
9
|
+
|
|
10
|
+
describe('MathSettings', () => {
|
|
11
|
+
test('is a Vue instance', () => {
|
|
12
|
+
const wrapper = shallowMount(MathSettings, {
|
|
13
|
+
propsData: {
|
|
14
|
+
tag: 'core-math-settings',
|
|
15
|
+
},
|
|
16
|
+
mocks: defaultMocks,
|
|
17
|
+
})
|
|
18
|
+
expect(wrapper.vm).toBeTruthy()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { mount, shallowMount } from '@vue/test-utils'
|
|
2
|
+
import Vuetify from 'vuetify'
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
|
|
5
|
+
import { defaultMocks } from '@/test/mocks'
|
|
6
|
+
import TabSettings from '@/components/Settings/TabSettings'
|
|
7
|
+
|
|
8
|
+
Vue.use(Vuetify)
|
|
9
|
+
|
|
10
|
+
describe('TabSettings', () => {
|
|
11
|
+
test('is a Vue instance', () => {
|
|
12
|
+
const wrapper = shallowMount(TabSettings, {
|
|
13
|
+
propsData: {
|
|
14
|
+
tag: 'core-tab-settings',
|
|
15
|
+
},
|
|
16
|
+
mocks: defaultMocks,
|
|
17
|
+
})
|
|
18
|
+
expect(wrapper.vm).toBeTruthy()
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('can add a new tab', () => {
|
|
22
|
+
const wrapper = shallowMount(TabSettings, {
|
|
23
|
+
propsData: {
|
|
24
|
+
tag: 'core-tab-settings',
|
|
25
|
+
},
|
|
26
|
+
mocks: defaultMocks,
|
|
27
|
+
})
|
|
28
|
+
wrapper.vm.onAddElement()
|
|
29
|
+
expect(wrapper.vm.$data.block.metadata.config.items).toEqual([
|
|
30
|
+
{ tabHeader: '', expand: false, content: '' },
|
|
31
|
+
{ tabHeader: '', expand: false, content: '' },
|
|
32
|
+
])
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
test('can remove a tab', () => {
|
|
36
|
+
const wrapper = shallowMount(TabSettings, {
|
|
37
|
+
propsData: {
|
|
38
|
+
tag: 'core-tab-settings',
|
|
39
|
+
},
|
|
40
|
+
mocks: defaultMocks,
|
|
41
|
+
})
|
|
42
|
+
wrapper.vm.onRemoveElement(0)
|
|
43
|
+
expect(wrapper.vm.$data.block.metadata.config.items).toEqual([])
|
|
44
|
+
})
|
|
45
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import Vuetify from 'vuetify'
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
|
|
5
|
+
import { defaultMocks } from '@/test/mocks'
|
|
6
|
+
import UserUploadSettings from '@/components/Settings/UserUploadSettings'
|
|
7
|
+
|
|
8
|
+
Vue.use(Vuetify)
|
|
9
|
+
|
|
10
|
+
describe('UserUploadSettings', () => {
|
|
11
|
+
test('is a Vue instance', () => {
|
|
12
|
+
const wrapper = shallowMount(UserUploadSettings, {
|
|
13
|
+
propsData: {
|
|
14
|
+
tag: 'core-accordion-settings',
|
|
15
|
+
},
|
|
16
|
+
mocks: defaultMocks,
|
|
17
|
+
})
|
|
18
|
+
expect(wrapper.vm).toBeTruthy()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
jest.mock(
|
|
2
|
+
'~/components/Dialog.vue',
|
|
3
|
+
() => {
|
|
4
|
+
return {
|
|
5
|
+
props: {},
|
|
6
|
+
computed: {},
|
|
7
|
+
methods: {},
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
{ virtual: true }
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
jest.mock(
|
|
14
|
+
'~/components/Dialog',
|
|
15
|
+
() => {
|
|
16
|
+
return {
|
|
17
|
+
props: {},
|
|
18
|
+
computed: {},
|
|
19
|
+
methods: {},
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{ virtual: true }
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
jest.mock(
|
|
26
|
+
'~/components/Text/TextViewer',
|
|
27
|
+
() => {
|
|
28
|
+
return {
|
|
29
|
+
props: {},
|
|
30
|
+
computed: {},
|
|
31
|
+
methods: {},
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{ virtual: true }
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
jest.mock(
|
|
38
|
+
'~/components/Text/TextEditor',
|
|
39
|
+
() => {
|
|
40
|
+
return {
|
|
41
|
+
props: {},
|
|
42
|
+
computed: {},
|
|
43
|
+
methods: {},
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{ virtual: true }
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
jest.mock(
|
|
50
|
+
'~/components/Form',
|
|
51
|
+
() => {
|
|
52
|
+
return {
|
|
53
|
+
props: {},
|
|
54
|
+
computed: {},
|
|
55
|
+
methods: {},
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{ virtual: true }
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
jest.mock(
|
|
62
|
+
'~/components/Form.vue',
|
|
63
|
+
() => {
|
|
64
|
+
return {
|
|
65
|
+
props: {},
|
|
66
|
+
computed: {},
|
|
67
|
+
methods: {},
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{ virtual: true }
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
jest.mock(
|
|
74
|
+
'~/components/ColorPicker.vue',
|
|
75
|
+
() => {
|
|
76
|
+
return {
|
|
77
|
+
props: {},
|
|
78
|
+
computed: {},
|
|
79
|
+
methods: {},
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{ virtual: true }
|
|
83
|
+
)
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import mock_ from 'lodash'
|
|
2
|
+
|
|
3
|
+
jest.mock(
|
|
4
|
+
'~/components/Content/ActionPanel.vue',
|
|
5
|
+
() => {
|
|
6
|
+
return jest.fn().mockImplementation(() => {
|
|
7
|
+
return { test: () => {} }
|
|
8
|
+
})
|
|
9
|
+
},
|
|
10
|
+
{ virtual: true }
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
jest.mock(
|
|
14
|
+
'~/components/Content/ContentBlockAsset.vue',
|
|
15
|
+
() => {
|
|
16
|
+
return jest.fn().mockImplementation(() => {
|
|
17
|
+
return { test: () => {} }
|
|
18
|
+
})
|
|
19
|
+
},
|
|
20
|
+
{ virtual: true }
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
jest.mock(
|
|
24
|
+
'~/components/Content/Blocks/BaseContentBlock',
|
|
25
|
+
() => {
|
|
26
|
+
return {
|
|
27
|
+
props: { value: { body: '', metadata: { config: {} } } },
|
|
28
|
+
computed: {
|
|
29
|
+
body() {
|
|
30
|
+
if (mock_.isString(this.block.body)) {
|
|
31
|
+
try {
|
|
32
|
+
// try to parse in case it's a serialized json
|
|
33
|
+
return JSON.parse(this.block.body)
|
|
34
|
+
} catch (e) {
|
|
35
|
+
return this.block.body
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
return mock_.cloneDeep(this.block.body)
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
data() {
|
|
43
|
+
return {
|
|
44
|
+
block: {},
|
|
45
|
+
render: true,
|
|
46
|
+
saveState: true,
|
|
47
|
+
completed: false,
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
created() {
|
|
51
|
+
if (typeof this.value.metadata.config === 'undefined') {
|
|
52
|
+
this.value.metadata.config = {}
|
|
53
|
+
}
|
|
54
|
+
this.block = this.value
|
|
55
|
+
},
|
|
56
|
+
methods: {
|
|
57
|
+
async emitBody(body) {
|
|
58
|
+
return await new Promise((resolve) => {
|
|
59
|
+
resolve(true)
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{ virtual: true }
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
jest.mock(
|
|
69
|
+
'~/components/Text/TextViewer.vue',
|
|
70
|
+
() => {
|
|
71
|
+
return {
|
|
72
|
+
props: {},
|
|
73
|
+
computed: {
|
|
74
|
+
body() {
|
|
75
|
+
return ''
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
data() {
|
|
79
|
+
return {}
|
|
80
|
+
},
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{ virtual: true }
|
|
84
|
+
)
|
|
85
|
+
jest.mock(
|
|
86
|
+
'~/components/Text/TextEditor.vue',
|
|
87
|
+
() => {
|
|
88
|
+
return {
|
|
89
|
+
props: {},
|
|
90
|
+
computed: {
|
|
91
|
+
body() {
|
|
92
|
+
return ''
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
data() {
|
|
96
|
+
return {}
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{ virtual: true }
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
jest.mock(
|
|
104
|
+
'~/components/FileDropZone.vue',
|
|
105
|
+
() => {
|
|
106
|
+
return {
|
|
107
|
+
props: {},
|
|
108
|
+
computed: {
|
|
109
|
+
body() {
|
|
110
|
+
return ''
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
data() {
|
|
114
|
+
return {}
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{ virtual: true }
|
|
119
|
+
)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
jest.mock(
|
|
2
|
+
'~/components/Content/Tool/BaseContentSettings.js',
|
|
3
|
+
() => {
|
|
4
|
+
return {
|
|
5
|
+
props: {
|
|
6
|
+
// The stored settings for this settings panel
|
|
7
|
+
settings: { type: Object, required: false, default: null },
|
|
8
|
+
// `page` or `block` context
|
|
9
|
+
context: { type: String, required: false, default: 'block' },
|
|
10
|
+
// The settings panel tag. Eg `content-blocks-settings-general`
|
|
11
|
+
tag: { type: String, required: false, default: 'settings-tag' },
|
|
12
|
+
// The CourseContent model
|
|
13
|
+
courseContent: {
|
|
14
|
+
type: Object,
|
|
15
|
+
required: false,
|
|
16
|
+
default: () => {
|
|
17
|
+
return {}
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
// The Content model
|
|
21
|
+
content: {
|
|
22
|
+
type: Object,
|
|
23
|
+
required: false,
|
|
24
|
+
default: () => {
|
|
25
|
+
return {}
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
block: {
|
|
32
|
+
id: '00000000-0000-0000-0000-000000000000',
|
|
33
|
+
content_id: '00000000-0000-0000-0000-000000000001',
|
|
34
|
+
tag: '',
|
|
35
|
+
body: '',
|
|
36
|
+
order: 0,
|
|
37
|
+
metadata: {},
|
|
38
|
+
created_at: new Date(),
|
|
39
|
+
updated_at: new Date(),
|
|
40
|
+
deleted_at: null,
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
async emitSettings(settings) {
|
|
46
|
+
return await new Promise((resolve) => {
|
|
47
|
+
resolve(true)
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{ virtual: true }
|
|
54
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = 'test-file-stub'
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
jest.mock(
|
|
2
|
+
'~/helpers/Uuid',
|
|
3
|
+
() => {
|
|
4
|
+
return {
|
|
5
|
+
test() {
|
|
6
|
+
return true
|
|
7
|
+
},
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
{ virtual: true }
|
|
11
|
+
)
|
|
12
|
+
jest.mock(
|
|
13
|
+
'~/helpers/Download',
|
|
14
|
+
() => {
|
|
15
|
+
return jest.fn().mockImplementation(() => {
|
|
16
|
+
return { resource: () => {} }
|
|
17
|
+
})
|
|
18
|
+
},
|
|
19
|
+
{ virtual: true }
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
jest.mock(
|
|
23
|
+
'~/helpers/Crypto',
|
|
24
|
+
() => {
|
|
25
|
+
return {
|
|
26
|
+
id: () => {
|
|
27
|
+
return Math.random().toString()
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{ virtual: true }
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
jest.mock(
|
|
35
|
+
'lodash',
|
|
36
|
+
() => {
|
|
37
|
+
return {
|
|
38
|
+
cloneDeep: (v) => {
|
|
39
|
+
return JSON.parse(JSON.stringify(v))
|
|
40
|
+
},
|
|
41
|
+
isEmpty: () => {
|
|
42
|
+
return jest.fn()
|
|
43
|
+
},
|
|
44
|
+
flatten: () => {
|
|
45
|
+
return jest.fn()
|
|
46
|
+
},
|
|
47
|
+
get: () => {
|
|
48
|
+
return jest.fn()
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{ virtual: true }
|
|
53
|
+
)
|