@windward/core 0.7.0 → 0.9.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 (64) hide show
  1. package/.eslintrc.js +5 -1
  2. package/.prettierrc +3 -2
  3. package/components/Content/Blocks/Accordion.vue +10 -2
  4. package/components/Content/Blocks/BlockQuote.vue +6 -2
  5. package/components/Content/Blocks/ClickableIcons.vue +12 -10
  6. package/components/Content/Blocks/Email.vue +7 -7
  7. package/components/Content/Blocks/GenerateAIQuestionButton.vue +85 -18
  8. package/components/Content/Blocks/HorizontalRule.vue +2 -0
  9. package/components/Content/Blocks/Image.vue +7 -182
  10. package/components/Content/Blocks/OpenResponse.vue +25 -0
  11. package/components/Content/Blocks/OpenResponseCollate.vue +13 -12
  12. package/components/Content/Blocks/ScenarioChoice.vue +10 -2
  13. package/components/Content/Blocks/Tab.vue +27 -3
  14. package/components/Content/Blocks/UserUpload.vue +5 -3
  15. package/components/Content/Blocks/Video.vue +33 -7
  16. package/components/Navigation/Items/GlossaryNav.vue +25 -10
  17. package/components/Settings/AccordionSettings.vue +20 -34
  18. package/components/Settings/BlockQuoteSettings.vue +17 -41
  19. package/components/Settings/ClickableIconsSettings.vue +18 -40
  20. package/components/Settings/EmailSettings.vue +12 -38
  21. package/components/Settings/FileDownloadSettings.vue +10 -35
  22. package/components/Settings/ImageSettings.vue +13 -247
  23. package/components/Settings/OpenResponseCollateSettings.vue +47 -55
  24. package/components/Settings/OpenResponseSettings.vue +62 -36
  25. package/components/Settings/ScenarioChoiceSettings.vue +13 -35
  26. package/components/Settings/TabSettings.vue +25 -34
  27. package/components/Settings/UserUploadSettings.vue +6 -30
  28. package/components/Settings/VideoSettings/SourcePicker.vue +1 -0
  29. package/components/Settings/VideoSettings.vue +6 -42
  30. package/components/utils/ContentViewer.vue +0 -3
  31. package/components/utils/FillInBlank/FillInBlankInput.vue +29 -47
  32. package/components/utils/TinyMCEWrapper.vue +42 -81
  33. package/components/utils/glossary/GlossaryToolTip.vue +6 -0
  34. package/helpers/GlossaryHelper.ts +12 -2
  35. package/helpers/tinymce/WindwardPlugins.ts +166 -118
  36. package/i18n/en-US/components/content/blocks/generate_questions.ts +3 -2
  37. package/i18n/en-US/components/settings/open_response_collate.ts +1 -1
  38. package/i18n/en-US/components/settings/scenario_choice.ts +3 -2
  39. package/i18n/en-US/components/settings/video.ts +1 -1
  40. package/i18n/en-US/components/utils/FillInBlank/FillInBlankInput.ts +2 -0
  41. package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
  42. package/i18n/en-US/shared/settings.ts +1 -1
  43. package/i18n/es-ES/components/content/blocks/generate_questions.ts +2 -1
  44. package/i18n/es-ES/components/settings/open_response_collate.ts +1 -1
  45. package/i18n/es-ES/components/settings/scenario_choice.ts +3 -2
  46. package/i18n/es-ES/components/settings/video.ts +1 -1
  47. package/i18n/es-ES/components/utils/FillInBlank/FillInBlankInput.ts +2 -0
  48. package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +3 -2
  49. package/i18n/es-ES/shared/settings.ts +1 -1
  50. package/i18n/sv-SE/components/content/blocks/generate_questions.ts +2 -1
  51. package/i18n/sv-SE/components/settings/open_response_collate.ts +1 -1
  52. package/i18n/sv-SE/components/settings/scenario_choice.ts +3 -2
  53. package/i18n/sv-SE/components/settings/video.ts +1 -1
  54. package/i18n/sv-SE/components/utils/FillInBlank/FillInBlankInput.ts +2 -0
  55. package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +2 -0
  56. package/package.json +3 -2
  57. package/pages/glossary.vue +1 -1
  58. package/stylelint.config.js +14 -0
  59. package/test/Components/Content/Blocks/OpenResponseCollate.spec.js +3 -3
  60. package/test/Components/Settings/TabSettings.spec.js +2 -2
  61. package/test/__mocks__/contentBlockMock.js +20 -0
  62. package/test/__mocks__/modelMock.js +1 -1
  63. package/test/helpers/GlossaryHelper.spec.js +22 -3
  64. package/test/mocks.js +8 -0
@@ -3,8 +3,8 @@ export default {
3
3
  description: 'Beskrivning',
4
4
  over_item_limit: 'Kan inte lägga till fler objekt',
5
5
  no_title: 'Ingen titel',
6
- item_title: 'Artikeltitel',
7
- item_text: 'Artikeltext',
6
+ item_title: 'Valtext',
7
+ item_text: 'Förklaring av detta val',
8
8
  correct_choice: 'Är rätt val',
9
9
  show_reset: 'Tillåt återförsök',
10
10
  display_style: 'Visa stil',
@@ -16,4 +16,5 @@ export default {
16
16
  letter: 'Brev',
17
17
  number: 'Nummer',
18
18
  },
19
+ add_choice: 'Lägg till val',
19
20
  }
@@ -42,7 +42,7 @@ export default {
42
42
  postroll: 'Postroll',
43
43
  },
44
44
  caption: {
45
- title: 'Captions File',
45
+ title: 'Placera en lokal bildtextfil',
46
46
  configure_blurb:
47
47
  'Ladda upp en bildtextfil (.vtt eller .xml), välj en från filhanteraren eller lägg till via den offentliga webbadressen',
48
48
  },
@@ -10,4 +10,6 @@ export default {
10
10
  input_incorrect: "'{0}' är felaktig",
11
11
  reset: 'återställ',
12
12
  try_again: 'Try Again',
13
+ user_input: 'Ditt svar: {0}',
14
+ correct_answer: 'Rätt svar: {0}',
13
15
  }
@@ -1,5 +1,7 @@
1
1
  export default {
2
2
  accessibility: 'Tillgänglighet',
3
+ aria_text:
4
+ 'Tryck på ALT + F10 eller fn + alternativ + F10 för att komma till verktygsfältet.',
3
5
  glossary: 'Ordlista',
4
6
  term: 'Ordlista Term',
5
7
  alternate_forms: 'Alternativa formulär',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windward/core",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Windward UI Core Plugins",
5
5
  "main": "plugin.js",
6
6
  "scripts": {
@@ -36,7 +36,9 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@babel/preset-env": "^7.16.11",
39
+ "@mindedge/vue-api-query": "^1.14.0",
39
40
  "@nuxtjs/axios": "^5.13.6",
41
+ "@nuxtjs/eslint-config-typescript": "^12.1.0",
40
42
  "@types/lodash": "^4.14.180",
41
43
  "@vue/cli-plugin-babel": "^5.0.4",
42
44
  "@vue/cli-plugin-typescript": "^5.0.4",
@@ -52,7 +54,6 @@
52
54
  "ts-jest": "^26.5.6",
53
55
  "typescript": "^4.6.3",
54
56
  "vue": "^2.6.14",
55
- "vue-api-query": "^1.11.0",
56
57
  "vue-jest": "^3.0.7",
57
58
  "vuetify": "^2.6.4"
58
59
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <v-row justify="center" align="center">
3
- <v-col cols="10">
3
+ <v-col cols="12">
4
4
  <div class="d-flex mb-5">
5
5
  <h2 class="mr-auto flex-grow-1">
6
6
  {{ $t('windward.core.pages.glossary.title') }}
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
3
+ // add your custom config here
4
+ // https://stylelint.io/user-guide/configure
5
+ rules: {
6
+ 'at-rule-no-unknown': null,
7
+ 'selector-pseudo-element-no-unknown': [
8
+ true,
9
+ {
10
+ ignorePseudoElements: ['v-deep'],
11
+ },
12
+ ],
13
+ },
14
+ }
@@ -2,13 +2,13 @@ import { shallowMount } from '@vue/test-utils'
2
2
  import Vue from 'vue'
3
3
  import Vuetify from 'vuetify'
4
4
  import { defaultMocks } from '@/test/mocks'
5
- import Image from '@/components/Content/Blocks/Image.vue'
5
+ import OpenResponseCollate from '@/components/Content/Blocks/OpenResponseCollate.vue'
6
6
 
7
7
  Vue.use(Vuetify)
8
8
 
9
- describe('Image content block component', () => {
9
+ describe('OpenResponseCollate content block component', () => {
10
10
  test('is a Vue instance', () => {
11
- const wrapper = shallowMount(Image, {
11
+ const wrapper = shallowMount(OpenResponseCollate, {
12
12
  vuetify: new Vuetify(),
13
13
  mocks: defaultMocks,
14
14
  propsData: {
@@ -27,8 +27,8 @@ describe('TabSettings', () => {
27
27
  })
28
28
  wrapper.vm.onAddElement()
29
29
  expect(wrapper.vm.$data.block.metadata.config.items).toEqual([
30
- { tabHeader: '', expand: false, content: '' },
31
- { tabHeader: '', expand: false, content: '' },
30
+ { tabHeader: '', expand: false, content: '', imageAsset: null },
31
+ { tabHeader: '', expand: false, content: '', imageAsset: null },
32
32
  ])
33
33
  })
34
34
 
@@ -20,6 +20,26 @@ jest.mock(
20
20
  { virtual: true }
21
21
  )
22
22
 
23
+ jest.mock(
24
+ '~/components/Content/ImageAssetViewer.vue',
25
+ () => {
26
+ return jest.fn().mockImplementation(() => {
27
+ return { test: () => {} }
28
+ })
29
+ },
30
+ { virtual: true }
31
+ )
32
+
33
+ jest.mock(
34
+ '~/components/Content/Settings/ImageAssetSettings.vue',
35
+ () => {
36
+ return jest.fn().mockImplementation(() => {
37
+ return { test: () => {} }
38
+ })
39
+ },
40
+ { virtual: true }
41
+ )
42
+
23
43
  jest.mock(
24
44
  '~/components/Content/Blocks/BaseContentBlock',
25
45
  () => {
@@ -1,4 +1,4 @@
1
- import { Model as mockModel } from 'vue-api-query'
1
+ import { Model as mockModel } from '@mindedge/vue-api-query'
2
2
 
3
3
  import axios from 'axios'
4
4
  jest.mock('axios')
@@ -16,6 +16,10 @@ const unVerifiedGlossaryWordWithSpace =
16
16
  '<span class="glossary-word" aria-label="Glossary Term"> Climate </span>'
17
17
  const glossaryWord3 =
18
18
  '<span class="glossary-word" aria-label="Glossary Term">Crisis change</span>'
19
+ const glossaryWord4 =
20
+ '<span class="glossary-word" aria-label="Glossary Term">architect</span>'
21
+ const glossaryWord5 =
22
+ '<span class="glossary-word" aria-label="Glossary Term">universe</span>'
19
23
  const glossaryWordSpaceBefore =
20
24
  '<span class="glossary-word" aria-label="Glossary Term"> Crisis change</span>'
21
25
  const glossaryWordSpaceAfter =
@@ -32,7 +36,7 @@ const glossary = [
32
36
  {
33
37
  term: 'Architecto',
34
38
  definition: 'Architecto is a word that means architect of the universe',
35
- alternate_forms: null,
39
+ alternate_forms: ['Architect', 'universe'],
36
40
  related_term: 'a,b,c,d',
37
41
  },
38
42
  {
@@ -47,7 +51,7 @@ const glossary = [
47
51
  {
48
52
  term: 'crisis change',
49
53
  definition: 'n/a',
50
- alternate_forms: null,
54
+ alternate_forms: ['crisis', 'change'],
51
55
  related_term: null,
52
56
  },
53
57
  ]
@@ -135,7 +139,14 @@ describe('GlossaryHelper ', () => {
135
139
  )
136
140
  ).toEqual([term])
137
141
  })
138
-
142
+ test('can retrieve verified glossary terms from alternate form ', () => {
143
+ expect(
144
+ GlossaryHelper.getContentVerifiedGlossaryTerms(
145
+ glossaryWord4 + contentHtml + glossaryWord5,
146
+ glossary
147
+ )
148
+ ).toEqual([term])
149
+ })
139
150
  test('can retrieve un-verified glossary terms', () => {
140
151
  expect(
141
152
  GlossaryHelper.getContentUnVerifiedGlossaryTerms(
@@ -144,6 +155,14 @@ describe('GlossaryHelper ', () => {
144
155
  )
145
156
  ).toEqual([new GlossaryTerm({ term: 'unverified', definition: 'n/a' })])
146
157
  })
158
+ test('does not mistake alternate forms for un-verified glossary terms', () => {
159
+ expect(
160
+ GlossaryHelper.getContentUnVerifiedGlossaryTerms(
161
+ glossaryWord2 + contentHtml + glossaryWord4,
162
+ glossary
163
+ )
164
+ ).toEqual([new GlossaryTerm({ term: 'unverified', definition: 'n/a' })])
165
+ })
147
166
 
148
167
  test('can retrieve un-verified glossary terms with space', () => {
149
168
  expect(
package/test/mocks.js CHANGED
@@ -55,6 +55,14 @@ const mocks = {
55
55
  window: {},
56
56
  app: {},
57
57
  $router: [],
58
+ $Validation: {
59
+ getRule() {},
60
+ getLimit() {},
61
+ addLimit() {},
62
+ addRule() {},
63
+ addLimits() {},
64
+ addRules() {},
65
+ },
58
66
  $PluginService: { mounted: () => {} },
59
67
  $PermissionService: { userHasAccessTo: () => {} },
60
68
  $Grading: {