@windward/core 0.2.3 → 0.4.0

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.
Files changed (173) hide show
  1. package/babel.config.js +1 -1
  2. package/components/Content/Blocks/Accordion.vue +37 -0
  3. package/components/Content/Blocks/ClickableIcons.vue +107 -20
  4. package/components/Content/Blocks/Email.vue +9 -0
  5. package/components/Content/Blocks/Image.vue +48 -20
  6. package/components/Content/Blocks/UserUpload/ManageDataTableUserFiles.vue +1 -1
  7. package/components/Content/Blocks/UserUpload.vue +1 -1
  8. package/components/Content/Blocks/Video.vue +80 -9
  9. package/components/Navigation/Items/AskTheExpert.vue +2 -1
  10. package/components/Navigation/Items/CourseGlossaryToolNav.vue +2 -1
  11. package/components/Settings/AccordionSettings.vue +64 -4
  12. package/components/Settings/BlockQuoteSettings.vue +9 -1
  13. package/components/Settings/ClickableIconsSettings.vue +104 -13
  14. package/components/Settings/EmailSettings.vue +13 -13
  15. package/components/Settings/FeedbackSettings.vue +2 -1
  16. package/components/Settings/HorizontalRuleSettings.vue +2 -1
  17. package/components/Settings/ImageSettings.vue +148 -39
  18. package/components/Settings/MathSettings.vue +6 -5
  19. package/components/Settings/OpenResponseCollateSettings.vue +5 -1
  20. package/components/Settings/OpenResponseSettings.vue +9 -4
  21. package/components/Settings/ScenarioChoiceSettings.vue +15 -4
  22. package/components/Settings/TabSettings.vue +12 -4
  23. package/components/Settings/TextEditorSettings.vue +14 -7
  24. package/components/Settings/UserUploadSettings.vue +11 -4
  25. package/components/Settings/VideoSettings.vue +121 -66
  26. package/components/utils/ContentViewer.vue +6 -1
  27. package/components/utils/MathExpressionEditor.vue +10 -5
  28. package/components/utils/TinyMCEWrapper.vue +120 -19
  29. package/components/utils/assets/tinymce/content/dark/content.scss +4 -0
  30. package/components/utils/assets/tinymce/{css/content.scss → content/global.scss} +38 -37
  31. package/components/utils/assets/tinymce/content/light/content.scss +4 -0
  32. package/components/utils/assets/tinymce/ui/dark/content.scss +803 -0
  33. package/components/utils/assets/tinymce/ui/dark/skin.scss +4727 -0
  34. package/components/utils/assets/tinymce/ui/global.scss +19 -0
  35. package/components/utils/assets/tinymce/ui/light/content.scss +822 -0
  36. package/components/utils/assets/tinymce/ui/light/skin.scss +4731 -0
  37. package/components/utils/glossary/CourseGlossary.vue +4 -3
  38. package/components/utils/glossary/CourseGlossaryForm.vue +1 -1
  39. package/config/tinymce.config.ts +22 -14
  40. package/helpers/FillInBlankHelper.ts +34 -28
  41. package/helpers/GlossaryHelper.ts +90 -73
  42. package/helpers/MathHelper.ts +49 -28
  43. package/helpers/tinymce/plugin.ts +9 -7
  44. package/i18n/en-US/components/content/blocks/image.ts +1 -1
  45. package/i18n/en-US/components/settings/clickable_icon.ts +2 -0
  46. package/i18n/en-US/components/settings/image.ts +6 -1
  47. package/i18n/en-US/shared/settings.ts +3 -0
  48. package/i18n/es-ES/components/content/blocks/image.ts +1 -1
  49. package/i18n/es-ES/components/settings/clickable_icon.ts +2 -0
  50. package/i18n/es-ES/components/settings/image.ts +8 -1
  51. package/i18n/es-ES/shared/settings.ts +3 -0
  52. package/i18n/sv-SE/components/content/blocks/image.ts +1 -1
  53. package/i18n/sv-SE/components/settings/clickable_icon.ts +2 -0
  54. package/i18n/sv-SE/components/settings/image.ts +6 -1
  55. package/i18n/sv-SE/shared/settings.ts +3 -0
  56. package/package.json +4 -3
  57. package/test/Components/Settings/AccordionSettings.spec.js +16 -2
  58. package/test/__mocks__/componentsMock.js +57 -97
  59. package/test/__mocks__/contentBlockMock.js +7 -1
  60. package/test/__mocks__/contentSettingsMock.js +8 -1
  61. package/test/__mocks__/helpersMock.js +9 -0
  62. package/test/__mocks__/modelMock.js +101 -31
  63. package/test/helpers/MathHelper.spec.js +22 -3
  64. package/tsconfig.json +1 -0
  65. package/.idea/codeStyles/Project.xml +0 -58
  66. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  67. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  68. package/.idea/modules.xml +0 -8
  69. package/.idea/php-docker-settings.xml +0 -24
  70. package/.idea/php.xml +0 -19
  71. package/.idea/vcs.xml +0 -6
  72. package/.idea/watcherTasks.xml +0 -4
  73. package/.idea/windward-ui-plugin-core.iml +0 -8
  74. package/coverage/clover.xml +0 -223
  75. package/coverage/coverage-final.json +0 -16
  76. package/coverage/lcov-report/base.css +0 -224
  77. package/coverage/lcov-report/block-navigation.js +0 -87
  78. package/coverage/lcov-report/components/Content/Blocks/Accordion.vue.html +0 -430
  79. package/coverage/lcov-report/components/Content/Blocks/Image.vue.html +0 -394
  80. package/coverage/lcov-report/components/Content/Blocks/Math.vue.html +0 -262
  81. package/coverage/lcov-report/components/Content/Blocks/RichText.vue.html +0 -295
  82. package/coverage/lcov-report/components/Content/Blocks/Tab.vue.html +0 -415
  83. package/coverage/lcov-report/components/Content/Blocks/Table.vue.html +0 -667
  84. package/coverage/lcov-report/components/Content/Blocks/Video.vue.html +0 -2275
  85. package/coverage/lcov-report/components/Content/Blocks/index.html +0 -206
  86. package/coverage/lcov-report/components/utils/ContentViewer.vue.html +0 -199
  87. package/coverage/lcov-report/components/utils/MathExpressionEditor.vue.html +0 -919
  88. package/coverage/lcov-report/components/utils/MathLiveWrapper.vue.html +0 -343
  89. package/coverage/lcov-report/components/utils/TinyMCEWrapper.vue.html +0 -271
  90. package/coverage/lcov-report/components/utils/index.html +0 -161
  91. package/coverage/lcov-report/config/index.html +0 -116
  92. package/coverage/lcov-report/config/tinymce.config.js.html +0 -493
  93. package/coverage/lcov-report/favicon.png +0 -0
  94. package/coverage/lcov-report/helpers/MathHelper.ts.html +0 -793
  95. package/coverage/lcov-report/helpers/index.html +0 -116
  96. package/coverage/lcov-report/helpers/tinymce/index.html +0 -116
  97. package/coverage/lcov-report/helpers/tinymce/plugin.ts.html +0 -334
  98. package/coverage/lcov-report/index.html +0 -191
  99. package/coverage/lcov-report/prettify.css +0 -1
  100. package/coverage/lcov-report/prettify.js +0 -2
  101. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  102. package/coverage/lcov-report/sorter.js +0 -196
  103. package/coverage/lcov-report/test/index.html +0 -116
  104. package/coverage/lcov-report/test/mocks.js.html +0 -457
  105. package/coverage/lcov.info +0 -403
  106. package/lib/helpers/GlossaryHelper.d.ts +0 -9
  107. package/lib/helpers/GlossaryHelper.js +0 -118
  108. package/lib/helpers/GlossaryTerm.d.ts +0 -10
  109. package/lib/helpers/GlossaryTerm.js +0 -22
  110. package/lib/helpers/MathHelper.d.ts +0 -99
  111. package/lib/helpers/MathHelper.js +0 -194
  112. package/lib/helpers/tinymce/plugin.d.ts +0 -2
  113. package/lib/helpers/tinymce/plugin.js +0 -86
  114. package/lib/i18n/en-US/components/content/blocks/image.d.ts +0 -6
  115. package/lib/i18n/en-US/components/content/blocks/image.js +0 -7
  116. package/lib/i18n/en-US/components/content/blocks/index.d.ts +0 -75
  117. package/lib/i18n/en-US/components/content/blocks/index.js +0 -14
  118. package/lib/i18n/en-US/components/content/blocks/tab.d.ts +0 -5
  119. package/lib/i18n/en-US/components/content/blocks/tab.js +0 -6
  120. package/lib/i18n/en-US/components/content/blocks/table.d.ts +0 -5
  121. package/lib/i18n/en-US/components/content/blocks/table.js +0 -6
  122. package/lib/i18n/en-US/components/content/blocks/user_upload.d.ts +0 -13
  123. package/lib/i18n/en-US/components/content/blocks/user_upload.js +0 -14
  124. package/lib/i18n/en-US/components/content/blocks/video.d.ts +0 -48
  125. package/lib/i18n/en-US/components/content/blocks/video.js +0 -49
  126. package/lib/i18n/en-US/components/content/index.d.ts +0 -77
  127. package/lib/i18n/en-US/components/content/index.js +0 -6
  128. package/lib/i18n/en-US/components/index.d.ts +0 -140
  129. package/lib/i18n/en-US/components/index.js +0 -12
  130. package/lib/i18n/en-US/components/navigation/image.d.ts +0 -5
  131. package/lib/i18n/en-US/components/navigation/image.js +0 -6
  132. package/lib/i18n/en-US/components/navigation/index.d.ts +0 -10
  133. package/lib/i18n/en-US/components/navigation/index.js +0 -8
  134. package/lib/i18n/en-US/components/navigation/user_upload.d.ts +0 -4
  135. package/lib/i18n/en-US/components/navigation/user_upload.js +0 -5
  136. package/lib/i18n/en-US/components/settings/clickable_icon.d.ts +0 -6
  137. package/lib/i18n/en-US/components/settings/clickable_icon.js +0 -7
  138. package/lib/i18n/en-US/components/settings/image.d.ts +0 -2
  139. package/lib/i18n/en-US/components/settings/image.js +0 -3
  140. package/lib/i18n/en-US/components/settings/index.d.ts +0 -39
  141. package/lib/i18n/en-US/components/settings/index.js +0 -14
  142. package/lib/i18n/en-US/components/settings/text_editor.d.ts +0 -8
  143. package/lib/i18n/en-US/components/settings/text_editor.js +0 -9
  144. package/lib/i18n/en-US/components/settings/user_upload.d.ts +0 -12
  145. package/lib/i18n/en-US/components/settings/user_upload.js +0 -13
  146. package/lib/i18n/en-US/components/settings/video.d.ts +0 -13
  147. package/lib/i18n/en-US/components/settings/video.js +0 -14
  148. package/lib/i18n/en-US/components/utils/index.d.ts +0 -15
  149. package/lib/i18n/en-US/components/utils/index.js +0 -6
  150. package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.d.ts +0 -13
  151. package/lib/i18n/en-US/components/utils/tiny_mce_wrapper.js +0 -14
  152. package/lib/i18n/en-US/index.d.ts +0 -197
  153. package/lib/i18n/en-US/index.js +0 -16
  154. package/lib/i18n/en-US/modules/index.d.ts +0 -2
  155. package/lib/i18n/en-US/modules/index.js +0 -6
  156. package/lib/i18n/en-US/pages/glossary.d.ts +0 -8
  157. package/lib/i18n/en-US/pages/glossary.js +0 -9
  158. package/lib/i18n/en-US/pages/index.d.ts +0 -13
  159. package/lib/i18n/en-US/pages/index.js +0 -8
  160. package/lib/i18n/en-US/pages/user_upload.d.ts +0 -4
  161. package/lib/i18n/en-US/pages/user_upload.js +0 -5
  162. package/lib/i18n/en-US/shared/content_blocks.d.ts +0 -20
  163. package/lib/i18n/en-US/shared/content_blocks.js +0 -21
  164. package/lib/i18n/en-US/shared/index.d.ts +0 -39
  165. package/lib/i18n/en-US/shared/index.js +0 -10
  166. package/lib/i18n/en-US/shared/menu.d.ts +0 -4
  167. package/lib/i18n/en-US/shared/menu.js +0 -5
  168. package/lib/i18n/en-US/shared/settings.d.ts +0 -15
  169. package/lib/i18n/en-US/shared/settings.js +0 -16
  170. package/lib/i18n/en-US.d.ts +0 -197
  171. package/lib/i18n/en-US.js +0 -15
  172. package/lib/models/UserFileAsset.d.ts +0 -5
  173. package/lib/models/UserFileAsset.js +0 -37
@@ -9,10 +9,12 @@ export default {
9
9
  item_color: 'Color del artículo',
10
10
  item_text: 'Texto del elemento',
11
11
  autocolor: 'Opciones de color automático',
12
+ icon_image: 'Usar imagen como ícono',
12
13
  display: {
13
14
  show_title: 'Mostrar siempre el título',
14
15
  show_background: 'Mostrar fondo',
15
16
  round_icon: 'Iconos redondos',
16
17
  italic_icon: 'Iconos en cursiva',
18
+ large_icon: 'Iconos grandes',
17
19
  },
18
20
  }
@@ -2,11 +2,18 @@ export default {
2
2
  hide_background: 'Ocultar fondo',
3
3
  modal: 'Haga clic para abrir en modal',
4
4
  decorative: 'Imagen decorativa',
5
- toggle_description:
5
+ decorative_toggle_description:
6
6
  'Para cumplir con los estándares de accesibilidad, se requiere texto alternativo para todas las imágenes, excepto para las imágenes puramente decorativas. Esta configuración agregará el texto alternativo y el texto del lector de pantalla adecuados para los estudiantes.',
7
+ inherit_global_toggle_description:
8
+ 'Cuando está habilitado, la imagen seleccionada utilizará texto alternativo y texto del lector de pantalla almacenado en el archivo, administrado en el administrador de archivos. Cuando está deshabilitada, la imagen seleccionada tendrá su propio texto alternativo y texto de lector de pantalla que no se comparte globalmente en el archivo.',
7
9
  alt_description:
8
10
  'El texto alternativo es un texto descriptivo que transmite el significado y el contexto de un elemento visual en un entorno digital, destinado a usuarios con discapacidad visual o que no pueden identificar visualmente una imagen. Esto debe ser breve y claro.',
9
11
  screenreader: 'Texto del lector de pantalla',
10
12
  screenreader_description:
11
13
  'Se puede agregar texto al lector de pantalla para brindarle al usuario que utiliza tecnología de asistencia más información sobre los elementos de la página',
14
+ inherit: 'Heredar configuración global',
15
+ inherit_no_alt:
16
+ 'No hay texto alternativo global disponible para el archivo',
17
+ inherit_no_aria:
18
+ 'No hay texto de lector de pantalla global disponible para el archivo',
12
19
  }
@@ -24,4 +24,7 @@ export default {
24
24
  instructions: 'Instrucciones',
25
25
  placeholder: 'Ingrese texto aquí',
26
26
  },
27
+ upload_file: 'Subir Archivo',
28
+ alt_image: 'Texto alternativo para imagen',
29
+ aria_described: 'Aria descrita por',
27
30
  }
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  title: 'Välj en bild',
3
3
  description: 'Välj en bild att visa',
4
- no_image_url: 'Ingen bild har valts ',
4
+ no_image_url: 'Ingen bilduppsättning ',
5
5
  }
@@ -9,10 +9,12 @@ export default {
9
9
  item_color: 'Artikelfärg',
10
10
  item_text: 'Artikeltext',
11
11
  autocolor: 'Auto-färgalternativ',
12
+ icon_image: 'Använd bild för ikon',
12
13
  display: {
13
14
  show_title: 'Visa alltid titel',
14
15
  show_background: 'Visa bakgrund',
15
16
  round_icon: 'Runda ikoner',
16
17
  italic_icon: 'Kursiva ikoner',
18
+ large_icon: 'Stora ikoner',
17
19
  },
18
20
  }
@@ -2,11 +2,16 @@ export default {
2
2
  hide_background: 'Dölj bakgrund',
3
3
  modal: 'Klicka för att öppna i modal',
4
4
  decorative: 'Dekorativ bild',
5
- toggle_description:
5
+ decorative_toggle_description:
6
6
  'För att uppfylla tillgänglighetsstandarder krävs alt-text för alla bilder utom för rent dekorativa bilder. Den här inställningen kommer att lägga till rätt alt-text och skärmläsartext för eleverna.',
7
+ inherit_global_toggle_description:
8
+ 'När den är aktiverad kommer den valda bilden att använda alt-text och skärmläsartext lagrad i filen, hanterad i filhanteraren. När den är inaktiverad kommer den valda bilden att ha sin egen unika alt-text och skärmläsartext som inte delas globalt på filen.',
7
9
  alt_description:
8
10
  'Alternativ text är beskrivande text som förmedlar innebörden och sammanhanget av ett visuellt föremål i en digital miljö, avsedd för användare som är synskadade eller på annat sätt oförmögna att visuellt identifiera en bild. Detta ska vara kort och tydligt.',
9
11
  screenreader: 'Skärmläsartext',
10
12
  screenreader_description:
11
13
  'Skärmläsartext kan läggas till för att ge en användare som använder hjälpmedel mer information om elementen på sidan',
14
+ inherit: 'Ärva globala inställningar',
15
+ inherit_no_alt: 'Ingen global alt-text tillgänglig för filen',
16
+ inherit_no_aria: 'Ingen global skärmläsartext tillgänglig för filen',
12
17
  }
@@ -22,4 +22,7 @@ export default {
22
22
  instructions: 'Instruktioner',
23
23
  placeholder: 'Skriv in text här',
24
24
  },
25
+ upload_file: 'Ladda upp fil',
26
+ alt_image: 'Alternativ text till bild',
27
+ aria_described: 'Aria beskrivs av',
25
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windward/core",
3
- "version": "0.2.3",
3
+ "version": "0.4.0",
4
4
  "description": "Windward UI Core Plugins",
5
5
  "main": "plugin.js",
6
6
  "scripts": {
@@ -27,9 +27,10 @@
27
27
  "he": "^1.2.0",
28
28
  "lodash": "^4.17.21",
29
29
  "mathlive": "^0.75.0",
30
- "mathml-to-latex": "^1.3.0",
30
+ "mathml-to-latex": "^1.4.0",
31
31
  "prettier": "^2.6.0",
32
- "raw-loader": "^4.0.2"
32
+ "raw-loader": "^4.0.2",
33
+ "tinymce": "^7.1.0"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@babel/preset-env": "^7.16.11",
@@ -27,8 +27,22 @@ describe('AccordionSettings', () => {
27
27
  })
28
28
  wrapper.vm.onAddElement()
29
29
  expect(wrapper.vm.$data.block.metadata.config.items).toEqual([
30
- { header: '', expand: false, content: '' },
31
- { header: '', expand: false, content: '' },
30
+ {
31
+ header: '',
32
+ expand: false,
33
+ content: '',
34
+ file: null,
35
+ altText: '',
36
+ ariaDescribedBy: '',
37
+ },
38
+ {
39
+ header: '',
40
+ expand: false,
41
+ content: '',
42
+ file: null,
43
+ altText: '',
44
+ ariaDescribedBy: '',
45
+ },
32
46
  ])
33
47
  })
34
48
 
@@ -1,101 +1,61 @@
1
- jest.mock(
2
- '~/components/TextIconPicker.vue',
3
- () => {
4
- return {
5
- props: {},
6
- computed: {},
7
- methods: {},
8
- }
9
- },
10
- { virtual: true }
11
- )
1
+ const shallowMocks = [
2
+ { path: '~/components/Core/AuditLogList' },
3
+ { path: '~/components/Core/AvatarUpload' },
4
+ { path: '~/components/Core/Breadcrumbs' },
5
+ { path: '~/components/Core/ColorPicker' },
6
+ { path: '~/components/Core/ContextMenu' },
7
+ { path: '~/components/Core/DialogBox' },
8
+ { path: '~/components/Core/DragDirection' },
9
+ { path: '~/components/Core/FileDropZone' },
10
+ { path: '~/components/Core/FormButtons' },
11
+ { path: '~/components/Core/Form', data: { validation: {} } },
12
+ { path: '~/components/Core/PageTopActionArea' },
13
+ { path: '~/components/Core/PluginRef' },
14
+ { path: '~/components/Core/SearchField' },
15
+ { path: '~/components/Core/SortableExpansionPanel' },
16
+ { path: '~/components/Core/SpeedDial' },
17
+ { path: '~/components/Core/TextIconPicker' },
18
+ { path: '~/components/Core/UserAvatar' },
19
+ { path: '~/components/Text/TextViewer' },
20
+ { path: '~/components/Text/TextEditor' },
21
+ ]
12
22
 
13
- jest.mock(
14
- '~/components/SortableExpansionPanel.vue',
15
- () => {
16
- return {
17
- props: {},
18
- computed: {},
19
- methods: {},
20
- }
21
- },
22
- { virtual: true }
23
- )
23
+ for (const index in shallowMocks) {
24
+ const mockData = shallowMocks[index].data || {}
25
+ const mockProps = shallowMocks[index].props || {}
26
+ const mockComputed = shallowMocks[index].computed || {}
27
+ const mockMethods = shallowMocks[index].methods || {}
24
28
 
25
- jest.mock(
26
- '~/components/DialogBox.vue',
27
- () => {
28
- return {
29
- props: {},
30
- computed: {},
31
- methods: {},
32
- }
33
- },
34
- { virtual: true }
35
- )
29
+ jest.mock(
30
+ shallowMocks[index].path,
31
+ () => {
32
+ return {
33
+ data() {
34
+ return { ...mockData }
35
+ },
36
+ props: mockProps,
37
+ computed: mockComputed,
38
+ methods: mockMethods,
39
+ }
40
+ },
41
+ { virtual: true }
42
+ )
36
43
 
37
- jest.mock(
38
- '~/components/Text/TextViewer',
39
- () => {
40
- return {
41
- props: {},
42
- computed: {},
43
- methods: {},
44
- }
45
- },
46
- { virtual: true }
47
- )
48
-
49
- jest.mock(
50
- '~/components/Text/TextEditor',
51
- () => {
52
- return {
53
- props: {},
54
- computed: {},
55
- methods: {},
56
- }
57
- },
58
- { virtual: true }
59
- )
60
-
61
- jest.mock(
62
- '~/components/Form',
63
- () => {
64
- return {
65
- props: {},
66
- computed: {},
67
- methods: {},
68
- data() {
69
- return { validation: {} }
44
+ // If the path does not include .vue then stub that out too
45
+ if (!shallowMocks[index].path.includes('.vue')) {
46
+ jest.mock(
47
+ shallowMocks[index].path + '.vue',
48
+ () => {
49
+ return {
50
+ data() {
51
+ return { ...mockData }
52
+ },
53
+ props: mockProps,
54
+ computed: mockComputed,
55
+ methods: mockMethods,
56
+ }
70
57
  },
71
- }
72
- },
73
- { virtual: true }
74
- )
75
-
76
- jest.mock(
77
- '~/components/Form.vue',
78
- () => {
79
- return {
80
- props: {},
81
- computed: {},
82
- methods: {},
83
- data() {
84
- return { validation: {} }
85
- },
86
- }
87
- },
88
- { virtual: true }
89
- )
90
-
91
- jest.mock(
92
- '~/components/ColorPicker.vue',
93
- () => {
94
- return {
95
- props: {},
96
- computed: {},
97
- methods: {},
98
- }
99
- },
100
- { virtual: true }
101
- )
58
+ { virtual: true }
59
+ )
60
+ }
61
+ }
@@ -59,6 +59,12 @@ jest.mock(
59
59
  resolve(true)
60
60
  })
61
61
  },
62
+ getAssetByFileAssetId(fileAssetId) {
63
+ return null
64
+ },
65
+ resolveAsset(file) {
66
+ return file
67
+ },
62
68
  },
63
69
  }
64
70
  },
@@ -101,7 +107,7 @@ jest.mock(
101
107
  )
102
108
 
103
109
  jest.mock(
104
- '~/components/FileDropZone.vue',
110
+ '~/components/Core/FileDropZone.vue',
105
111
  () => {
106
112
  return {
107
113
  props: {},
@@ -1,5 +1,6 @@
1
+ // Mock the base settings
1
2
  jest.mock(
2
- '~/components/Content/Tool/BaseContentSettings.js',
3
+ '~/components/Content/Settings/BaseContentSettings.js',
3
4
  () => {
4
5
  return {
5
6
  props: {
@@ -47,6 +48,12 @@ jest.mock(
47
48
  resolve(true)
48
49
  })
49
50
  },
51
+ getAssetByFileAssetId(fileAssetId) {
52
+ return null
53
+ },
54
+ resolveAsset(file) {
55
+ return file
56
+ },
50
57
  },
51
58
  }
52
59
  },
@@ -1,3 +1,11 @@
1
+ jest.mock(
2
+ '!raw-loader!sass-loader!./assets/tinymce/css/content.scss',
3
+ () => {
4
+ return ''
5
+ },
6
+ { virtual: true }
7
+ )
8
+
1
9
  jest.mock(
2
10
  '~/helpers/Uuid',
3
11
  () => {
@@ -9,6 +17,7 @@ jest.mock(
9
17
  },
10
18
  { virtual: true }
11
19
  )
20
+
12
21
  jest.mock(
13
22
  '~/helpers/Download',
14
23
  () => {
@@ -8,15 +8,50 @@ jest.mock('axios')
8
8
 
9
9
  // Define any new model mocks here. The imports / mocks will be auto-generated below
10
10
  const mockVirtualModels = [
11
+ { path: '~/models/AskTheExpert', resource: 'user-tools/ask-the-expert' },
12
+ { path: '~/models/AssessmentQuestion', resource: 'questions' },
11
13
  {
12
- path: '~/models/UserContentBlockState',
13
- resource: 'user-content-block-state',
14
+ path: '~/models/AssessmentQuestionType',
15
+ resource: 'assessments/questions/types',
14
16
  },
15
- { path: '~/models/Enrollment', resource: 'enrollments' },
17
+ { path: '~/models/AssessmentResult', resource: 'assessment-results' },
18
+ { path: '~/models/Assessment', resource: 'assessments' },
19
+ { path: '~/models/ContactSupport', resource: 'user-tools/contact-support' },
16
20
  { path: '~/models/ContentBlock', resource: 'blocks' },
17
- { path: '~/models/FileAsset', resource: 'file-assets' },
18
- { path: '~/models/UserFileAsset', resource: 'user-files' },
21
+ { path: '~/models/Content', resource: 'content' },
22
+ { path: '~/models/CourseSection', resource: 'sections' },
19
23
  { path: '~/models/Course', resource: 'courses' },
24
+ { path: '~/models/CourseUserTrack', resource: 'track' },
25
+ { path: '~/models/Enrollment', resource: 'enrollments' },
26
+ { path: '~/models/FileAssetNamespace', resource: 'file-namespaces' },
27
+ { path: '~/models/FileAsset', resource: 'files' },
28
+ { path: '~/models/GradeMap', resource: 'maps' },
29
+ { path: '~/models/Grade', resource: 'grades' },
30
+ { path: '~/models/GradeType', resource: 'grades/types' },
31
+ { path: '~/models/Locale', resource: 'locales' },
32
+ { path: '~/models/Note', resource: 'notes' },
33
+ { path: '~/models/NotificationEvent', resource: 'notifications/events' },
34
+ { path: '~/models/NotificationTemplate', resource: 'notifications' },
35
+ { path: '~/models/NotificationType', resource: 'notifications/types' },
36
+ {
37
+ path: '~/models/OrganizationNotification',
38
+ resource: 'organization-notifications',
39
+ },
40
+ { path: '~/models/Organization', resource: 'organizations' },
41
+ { path: '~/models/Permission', resource: 'permissions' },
42
+ { path: '~/models/PermissionType', resource: 'permissions/types' },
43
+ { path: '~/models/Plugin', resource: 'plugins' },
44
+ { path: '~/models/repositories/AuthUserRepository', resource: 'users' },
45
+ { path: '~/models/Role', resource: 'roles' },
46
+ { path: '~/models/Rubric', resource: 'rubrics' },
47
+ { path: '~/models/ServiceStatus', resource: 'status' },
48
+ { path: '~/models/Tenant', resource: 'tenant' },
49
+ {
50
+ path: '~/models/UserContentBlockState',
51
+ resource: 'user-content-block-state',
52
+ },
53
+ { path: '~/models/UserGrade', resource: 'user-grades' },
54
+ { path: '~/models/UserNotification', resource: 'notifications' },
20
55
  ]
21
56
 
22
57
  const mockModels = [
@@ -24,12 +59,7 @@ const mockModels = [
24
59
  ]
25
60
 
26
61
  // DO NOT ALTER THE BELOW CODE
27
- jest.mock('', () => {
28
- return {
29
- __esModule: true,
30
- default: class Model {},
31
- }
32
- })
62
+
33
63
  class mockBaseModel extends mockModel {
34
64
  baseURL() {
35
65
  return 'http://windwardapi.local'
@@ -39,6 +69,34 @@ class mockBaseModel extends mockModel {
39
69
  resolve({ data: {} })
40
70
  })
41
71
  }
72
+
73
+ integrations() {
74
+ return this
75
+ }
76
+
77
+ where() {
78
+ return this
79
+ }
80
+
81
+ include() {
82
+ return this
83
+ }
84
+
85
+ with() {
86
+ return this
87
+ }
88
+
89
+ for() {
90
+ return this
91
+ }
92
+
93
+ get() {
94
+ return []
95
+ }
96
+
97
+ first() {
98
+ return {}
99
+ }
42
100
  }
43
101
 
44
102
  jest.mock(
@@ -52,35 +110,47 @@ jest.mock(
52
110
  { virtual: true }
53
111
  )
54
112
 
55
- for (let mockI = 0; mockI < mockVirtualModels.length; mockI++) {
56
- jest.mock(
57
- mockVirtualModels[mockI].path,
58
- () => {
113
+ const registerVirtualModels = function (mockVirtualModelsParam) {
114
+ for (let mockI = 0; mockI < mockVirtualModelsParam.length; mockI++) {
115
+ jest.mock(
116
+ mockVirtualModelsParam[mockI].path,
117
+ () => {
118
+ return {
119
+ __esModule: true,
120
+ default: class Model extends mockBaseModel {
121
+ resource() {
122
+ return (
123
+ mockVirtualModelsParam[mockI].resource ||
124
+ this.constructor.name
125
+ )
126
+ }
127
+ },
128
+ }
129
+ },
130
+ { virtual: true }
131
+ )
132
+ }
133
+ }
134
+
135
+ const registerModels = function (mockModelsParam) {
136
+ for (let mockJ = 0; mockJ < mockModelsParam.length; mockJ++) {
137
+ jest.mock(mockModelsParam[mockJ].path, () => {
59
138
  return {
60
139
  __esModule: true,
61
140
  default: class Model extends mockBaseModel {
62
141
  resource() {
63
142
  return (
64
- mockVirtualModels[mockI].resource ||
143
+ mockModelsParam[mockJ].resource ||
65
144
  this.constructor.name
66
145
  )
67
146
  }
68
147
  },
69
148
  }
70
- },
71
- { virtual: true }
72
- )
149
+ })
150
+ }
73
151
  }
74
152
 
75
- for (let mockJ = 0; mockJ < mockModels.length; mockJ++) {
76
- jest.mock(mockModels[mockJ].path, () => {
77
- return {
78
- __esModule: true,
79
- default: class Model extends mockBaseModel {
80
- resource() {
81
- return mockModels[mockJ].resource || this.constructor.name
82
- }
83
- },
84
- }
85
- })
86
- }
153
+ registerVirtualModels(mockVirtualModels)
154
+ registerModels(mockModels)
155
+
156
+ export { registerVirtualModels, registerModels }
@@ -98,7 +98,7 @@ describe('MahtHelper ', () => {
98
98
  test('detects content wrapped for tinymce', () => {
99
99
  expect(
100
100
  MathHelper.checkMathContentWrappedForTMCE(
101
- `<span class ='windward-math-content'>` +
101
+ `<span class='windward-math-content'>` +
102
102
  srEnhancedlatex +
103
103
  `</span>` +
104
104
  text +
@@ -111,7 +111,7 @@ describe('MahtHelper ', () => {
111
111
  expect(MathHelper.wrapMathContentForTinyMCE(srEnhancedlatex)).toEqual(
112
112
  `<span class ='windward-math-content'>` +
113
113
  srEnhancedlatex +
114
- `</span>`
114
+ `</span> &nbsp;`
115
115
  )
116
116
  })
117
117
  test('can wrap latexContent in math span for tinymce', () => {
@@ -122,7 +122,26 @@ describe('MahtHelper ', () => {
122
122
  '$$' +
123
123
  latexContent +
124
124
  '$$' +
125
- `</span>`
125
+ `</span> &nbsp;`
126
+ )
127
+ })
128
+
129
+ test('can wrap latexContent in math span for tinymce only once', () => {
130
+ expect(
131
+ MathHelper.wrapMathContentForTinyMCE(
132
+ '$$' + latexContent + '$$' + '$$' + latexContent + '$$'
133
+ )
134
+ ).toEqual(
135
+ `<span class ='windward-math-content'>` +
136
+ '$$' +
137
+ latexContent +
138
+ '$$' +
139
+ `</span> &nbsp;` +
140
+ `<span class ='windward-math-content'>` +
141
+ '$$' +
142
+ latexContent +
143
+ '$$' +
144
+ `</span> &nbsp;`
126
145
  )
127
146
  })
128
147
  })
package/tsconfig.json CHANGED
@@ -6,6 +6,7 @@
6
6
  "noImplicitAny": false,
7
7
  "outDir": "./lib",
8
8
  "strict": true,
9
+ "lib": ["ES2021.String"],
9
10
  "paths": {
10
11
  "~/*": ["./*"],
11
12
  "@/*": ["./*"]
@@ -1,58 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <code_scheme name="Project" version="173">
3
- <HTMLCodeStyleSettings>
4
- <option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
5
- <option name="HTML_ENFORCE_QUOTES" value="true" />
6
- </HTMLCodeStyleSettings>
7
- <JSCodeStyleSettings version="0">
8
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
9
- <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
10
- <option name="FORCE_QUOTE_STYlE" value="true" />
11
- <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
12
- <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
13
- <option name="SPACES_WITHIN_IMPORTS" value="true" />
14
- </JSCodeStyleSettings>
15
- <TypeScriptCodeStyleSettings version="0">
16
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
17
- <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
18
- <option name="FORCE_QUOTE_STYlE" value="true" />
19
- <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
20
- <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
21
- <option name="SPACES_WITHIN_IMPORTS" value="true" />
22
- </TypeScriptCodeStyleSettings>
23
- <VueCodeStyleSettings>
24
- <option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
25
- <option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
26
- </VueCodeStyleSettings>
27
- <codeStyleSettings language="HTML">
28
- <option name="SOFT_MARGINS" value="80" />
29
- <indentOptions>
30
- <option name="INDENT_SIZE" value="2" />
31
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
32
- <option name="TAB_SIZE" value="2" />
33
- </indentOptions>
34
- </codeStyleSettings>
35
- <codeStyleSettings language="JavaScript">
36
- <option name="SOFT_MARGINS" value="80" />
37
- <indentOptions>
38
- <option name="INDENT_SIZE" value="2" />
39
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
40
- <option name="TAB_SIZE" value="2" />
41
- </indentOptions>
42
- </codeStyleSettings>
43
- <codeStyleSettings language="TypeScript">
44
- <option name="SOFT_MARGINS" value="80" />
45
- <indentOptions>
46
- <option name="INDENT_SIZE" value="2" />
47
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
48
- <option name="TAB_SIZE" value="2" />
49
- </indentOptions>
50
- </codeStyleSettings>
51
- <codeStyleSettings language="Vue">
52
- <option name="SOFT_MARGINS" value="80" />
53
- <indentOptions>
54
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
55
- </indentOptions>
56
- </codeStyleSettings>
57
- </code_scheme>
58
- </component>
@@ -1,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
- </state>
5
- </component>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>