@kiva/kv-components 2.0.0 → 3.0.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 (50) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +1 -1
  2. package/CHANGELOG.md +45 -0
  3. package/__mocks__/ResizeObserver.js +13 -0
  4. package/package.json +23 -10
  5. package/{postcss.config.js → postcss.config.cjs} +2 -2
  6. package/{tailwind.config.js → tailwind.config.cjs} +3 -3
  7. package/tests/unit/jest-setup.js +5 -0
  8. package/tests/unit/specs/components/KvButton.spec.js +14 -25
  9. package/tests/unit/specs/components/KvCarousel.spec.js +11 -0
  10. package/tests/unit/specs/components/KvCheckbox.spec.js +73 -14
  11. package/tests/unit/specs/components/KvLightbox.spec.js +14 -0
  12. package/tests/unit/specs/components/KvProgressBar.spec.js +11 -0
  13. package/tests/unit/specs/components/KvRadio.spec.js +94 -5
  14. package/tests/unit/specs/components/KvSelect.spec.js +113 -0
  15. package/tests/unit/specs/components/KvSwitch.spec.js +92 -33
  16. package/tests/unit/specs/components/KvTabPanel.spec.js +11 -0
  17. package/tests/unit/specs/components/KvTabs.spec.js +99 -0
  18. package/tests/unit/specs/components/KvTextInput.spec.js +86 -9
  19. package/tests/unit/specs/components/KvTextLink.spec.js +16 -24
  20. package/tests/unit/specs/components/KvToast.spec.js +11 -0
  21. package/tests/unit/utils/addVueRouter.js +24 -0
  22. package/utils/attrs.js +62 -0
  23. package/utils/{themeUtils.js → themeUtils.cjs} +0 -0
  24. package/vue/.storybook/{main.js → main.cjs} +13 -5
  25. package/vue/.storybook/preview.js +6 -1
  26. package/vue/KvButton.vue +80 -53
  27. package/vue/KvCarousel.vue +142 -106
  28. package/vue/KvCheckbox.vue +86 -60
  29. package/vue/KvContentfulImg.vue +45 -34
  30. package/vue/KvLightbox.vue +108 -69
  31. package/vue/KvProgressBar.vue +33 -19
  32. package/vue/KvRadio.vue +72 -41
  33. package/vue/KvSelect.vue +46 -20
  34. package/vue/KvSwitch.vue +55 -33
  35. package/vue/KvTab.vue +49 -21
  36. package/vue/KvTabPanel.vue +26 -6
  37. package/vue/KvTabs.vue +70 -53
  38. package/vue/KvTextInput.vue +71 -48
  39. package/vue/KvTextLink.vue +42 -20
  40. package/vue/KvThemeProvider.vue +1 -1
  41. package/vue/KvToast.vue +53 -37
  42. package/vue/stories/KvCheckbox.stories.js +5 -5
  43. package/vue/stories/KvSwitch.stories.js +2 -2
  44. package/vue/stories/KvTabs.stories.js +8 -8
  45. package/vue/stories/KvTextInput.stories.js +1 -1
  46. package/vue/stories/KvThemeProvider.stories.js +1 -1
  47. package/vue/stories/KvToast.stories.js +3 -2
  48. package/vue/stories/StyleguidePrimitives.stories.js +9 -9
  49. package/.babelrc +0 -16
  50. package/jest.config.js +0 -36
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <div class="tw-inline-flex">
2
+ <div
3
+ class="tw-inline-flex"
4
+ :class="classes"
5
+ :style="styles"
6
+ >
3
7
  <div
4
8
  class="tw-relative tw-w-full "
5
9
  :class="{ 'tw-opacity-low': disabled }"
@@ -29,10 +33,10 @@
29
33
  }"
30
34
  :placeholder="placeholder"
31
35
  :disabled="disabled"
32
- v-bind="$attrs"
33
- :value="valueInput"
34
- @input="onInput"
36
+ v-bind="inputAttrs"
37
+ :value="modelValue"
35
38
  v-on="inputListeners"
39
+ @input="onInput"
36
40
  >
37
41
  <!-- eslint-enable max-len -->
38
42
  <kv-material-icon
@@ -47,7 +51,7 @@
47
51
  tw-pointer-events-none tw-text-danger"
48
52
  />
49
53
  <button
50
- v-if="canClear && valid && !!valueInput"
54
+ v-show="canClear && valid && !!inputText"
51
55
  type="button"
52
56
  class="tw-absolute tw-top-1.5 tw-right-1.5"
53
57
  @click="clearInput"
@@ -70,9 +74,18 @@
70
74
  </template>
71
75
 
72
76
  <script>
77
+ import {
78
+ ref,
79
+ toRefs,
80
+ } from 'vue-demi';
73
81
  import { mdiAlertCircleOutline, mdiClose } from '@mdi/js';
74
82
  import KvMaterialIcon from './KvMaterialIcon.vue';
83
+ import { useAttrs } from '../utils/attrs';
75
84
 
85
+ const emits = [
86
+ 'input',
87
+ 'update:modelValue',
88
+ ];
76
89
  /* eslint-disable max-len */
77
90
 
78
91
  /**
@@ -98,8 +111,8 @@ export default {
98
111
  inheritAttrs: false,
99
112
  // v-model will update when a different value is input
100
113
  model: {
101
- prop: 'value',
102
- event: 'input',
114
+ prop: 'modelValue',
115
+ event: 'update:modelValue',
103
116
  },
104
117
  props: {
105
118
  /**
@@ -115,9 +128,9 @@ export default {
115
128
  * <kv-text-input :value="streetAddress" @input="(val) => streetAddress = val" />
116
129
  * ```
117
130
  * */
118
- value: {
131
+ modelValue: {
119
132
  type: [String, Number, Boolean],
120
- default: null,
133
+ default: '',
121
134
  },
122
135
  /**
123
136
  * Text that appears in the form control when it has no value set
@@ -173,51 +186,61 @@ export default {
173
186
  default: false,
174
187
  },
175
188
  },
176
- data() {
177
- return {
178
- mdiAlertCircleOutline,
179
- mdiClose,
180
- valueInput: this.value,
181
- };
182
- },
183
- computed: {
184
- inputListeners() {
185
- return {
186
- // Pass through any listeners from the parent to the input element, like blur, focus, etc.
187
- // https://vuejs.org/v2/guide/components-custom-events.html#Binding-Native-Events-to-Components
188
- ...this.$listeners,
189
- // ...except for the listener to the 'input' event which is emitted by this component
190
- input: () => {},
191
- };
192
- },
189
+ emits,
190
+ setup(props, context) {
191
+ const { emit } = context;
192
+ const {
193
+ modelValue,
194
+ } = toRefs(props);
193
195
 
194
- },
195
- watch: {
196
- value() {
197
- this.valueInput = this.value;
198
- },
199
- },
200
- methods: {
201
- onInput(event) {
196
+ const textInputRef = ref(null);
197
+ const inputText = ref(modelValue.value);
198
+
199
+ const {
200
+ classes,
201
+ styles,
202
+ inputAttrs,
203
+ inputListeners,
204
+ } = useAttrs(context, emits);
205
+
206
+ const onInput = (event) => {
202
207
  /**
203
208
  * The value that is currently in the input
204
209
  * @event input
205
210
  * @type {Event}
206
211
  */
207
- this.valueInput = event.target.value;
208
- this.$emit('input', event.target.value);
209
- },
210
- focus() {
211
- this.$refs.textInputRef.focus();
212
- },
213
- blur() {
214
- this.$refs.textInputRef.blur();
215
- },
216
- clearInput() {
217
- this.valueInput = '';
218
- this.$emit('input', '');
219
- this.focus();
220
- },
212
+ inputText.value = event.target.value;
213
+ emit('input', event.target.value);
214
+ emit('update:modelValue', event.target.value);
215
+ };
216
+
217
+ const focus = () => {
218
+ textInputRef.value.focus();
219
+ };
220
+
221
+ const blur = () => {
222
+ textInputRef.value.blur();
223
+ };
224
+
225
+ const clearInput = () => {
226
+ inputText.value = '';
227
+ emit('input', '');
228
+ emit('update:modelValue', '');
229
+ };
230
+
231
+ return {
232
+ mdiAlertCircleOutline,
233
+ mdiClose,
234
+ onInput,
235
+ focus,
236
+ blur,
237
+ clearInput,
238
+ inputText,
239
+ classes,
240
+ styles,
241
+ inputAttrs,
242
+ inputListeners,
243
+ };
221
244
  },
222
245
  };
223
246
  </script>
@@ -25,6 +25,13 @@
25
25
  </template>
26
26
 
27
27
  <script>
28
+ import {
29
+ computed,
30
+ onMounted,
31
+ ref,
32
+ toRefs,
33
+ watch,
34
+ } from 'vue-demi';
28
35
  import KvMaterialIcon from './KvMaterialIcon.vue';
29
36
 
30
37
  /**
@@ -73,26 +80,31 @@ export default {
73
80
  },
74
81
  },
75
82
  },
76
- computed: {
77
- tag() {
78
- if (this.to) {
83
+ emits: [
84
+ 'click',
85
+ ],
86
+ setup(props, { emit }) {
87
+ const {
88
+ to,
89
+ href,
90
+ } = toRefs(props);
91
+
92
+ const buttonRef = ref(null);
93
+
94
+ const tag = computed(() => {
95
+ if (to.value) {
79
96
  return 'router-link';
80
97
  }
81
- if (this.href) {
98
+ if (href.value) {
82
99
  return 'a';
83
100
  }
84
101
  return 'button';
85
- },
86
- },
87
- watch: { href() { this.setHref(); } },
88
- mounted() {
89
- this.setHref();
90
- },
91
- methods: {
92
- onClick(event) {
102
+ });
103
+
104
+ const onClick = (event) => {
93
105
  // emit a vue event and prevent native event
94
106
  // so we don't have to write @click.native in our templates
95
- if (this.tag === 'button') {
107
+ if (tag.value === 'button') {
96
108
  event.preventDefault();
97
109
  /**
98
110
  * Fired when the button is clicked
@@ -100,17 +112,27 @@ export default {
100
112
  * @event click
101
113
  * @param {Event}
102
114
  */
103
- this.$emit('click', event);
115
+ emit('click', event);
104
116
  }
105
- },
106
- setHref() {
117
+ };
118
+
119
+ const setHref = () => {
107
120
  // if the component is a router-link, router-link will set the href
108
121
  // if the href is passed as a prop, use that instead
109
- if (this.href) {
110
- const { buttonRef } = this.$refs;
111
- buttonRef.href = this.href;
122
+ if (href.value) {
123
+ buttonRef.value.href = href.value;
112
124
  }
113
- },
125
+ };
126
+
127
+ watch(href, () => setHref());
128
+ onMounted(() => setHref());
129
+
130
+ return {
131
+ tag,
132
+ onClick,
133
+ buttonRef,
134
+ setHref,
135
+ };
114
136
  },
115
137
  };
116
138
  </script>
@@ -21,7 +21,7 @@
21
21
  * darkGreenTheme,
22
22
  * mintTheme,
23
23
  * defaultTheme
24
- * } from '@kiva/kv-tokens/configs/kivaColors';
24
+ * } from '@kiva/kv-tokens/configs/kivaColors.cjs';
25
25
  * ...
26
26
  * data() { return { darkTheme }; }
27
27
  * ...
package/vue/KvToast.vue CHANGED
@@ -86,7 +86,10 @@
86
86
  </template>
87
87
 
88
88
  <script>
89
-
89
+ import {
90
+ ref,
91
+ computed,
92
+ } from 'vue-demi';
90
93
  import {
91
94
  mdiClose, mdiAlertCircle, mdiAlert, mdiCheckCircle,
92
95
  } from '@mdi/js';
@@ -116,62 +119,75 @@ export default {
116
119
  KvMaterialIcon,
117
120
  KvPageContainer,
118
121
  },
119
- data() {
120
- return {
121
- isVisible: false,
122
- message: '',
123
- messageType: 'confirmation', // 'error', 'info', 'confirmation'
124
- persist: false,
125
- timeout: null,
126
- mdiClose,
127
- };
128
- },
129
- computed: {
130
- icon() {
131
- if (this.messageType === 'warning') {
122
+ emits: [
123
+ 'close',
124
+ ],
125
+ setup(props, { emit }) {
126
+ const isVisible = ref(false);
127
+ const message = ref('');
128
+ const messageType = ref('confirmation'); // 'error', 'info', 'confirmation'
129
+ const persist = ref(false);
130
+ const timeout = ref(null);
131
+
132
+ const icon = computed(() => {
133
+ if (messageType.value === 'warning') {
132
134
  return mdiAlert;
133
135
  }
134
- if (this.messageType === 'error') {
136
+ if (messageType.value === 'error') {
135
137
  return mdiAlertCircle;
136
138
  }
137
139
  return mdiCheckCircle;
138
- },
139
- msToDisplayToast() {
140
+ });
141
+
142
+ const msToDisplayToast = computed(() => {
140
143
  const MINIMUM_MS = 5000;
141
144
  const MS_PER_CHARACTER = 100;
142
145
 
143
146
  // create an empty span to get the character count without HTML
144
147
  const span = document.createElement('span');
145
- span.innerHTML = this.message;
148
+ span.innerHTML = message.value;
146
149
  const characterCount = span.innerText.length;
147
150
 
148
151
  const characterMs = MS_PER_CHARACTER * characterCount;
149
152
  return Math.max(characterMs, MINIMUM_MS);
150
- },
151
- },
152
- methods: {
153
- show(message, type, persist) {
154
- this.isVisible = true;
155
- this.message = typeof message === 'string' ? message : '';
156
- this.messageType = typeof type === 'string' ? type : '';
157
- this.persist = Boolean(persist);
153
+ });
158
154
 
159
- if (!this.persist) {
160
- this.timeout = setTimeout(() => {
161
- this.close();
162
- }, this.msToDisplayToast);
163
- }
164
- },
165
- close() {
166
- this.isVisible = false;
167
- clearTimeout(this.timeout);
155
+ const close = () => {
156
+ isVisible.value = false;
157
+ clearTimeout(timeout.value);
168
158
 
169
159
  /**
170
160
  * Indicates the toast has closed by a user or after timeout
171
161
  * @event close
172
162
  */
173
- this.$emit('close');
174
- },
163
+ emit('close');
164
+ };
165
+
166
+ const show = (messageInput, type, persistInput) => {
167
+ isVisible.value = true;
168
+ message.value = typeof messageInput === 'string' ? messageInput : '';
169
+ messageType.value = typeof type === 'string' ? type : '';
170
+ persist.value = Boolean(persistInput);
171
+
172
+ if (!persist.value) {
173
+ timeout.value = setTimeout(() => {
174
+ close();
175
+ }, msToDisplayToast.value);
176
+ }
177
+ };
178
+
179
+ return {
180
+ mdiClose,
181
+ isVisible,
182
+ message,
183
+ messageType,
184
+ persist,
185
+ timeout,
186
+ icon,
187
+ msToDisplayToast,
188
+ close,
189
+ show,
190
+ };
175
191
  },
176
192
  };
177
193
  </script>
@@ -67,7 +67,7 @@ export const WithoutVModel = (args, {
67
67
  template: `
68
68
  <div>
69
69
  <kv-checkbox
70
- :checked="checkboxExampleModel"
70
+ :modelValue="checkboxExampleModel"
71
71
  @change="(val) => checkboxExampleModel = val"
72
72
  :disabled="disabled"
73
73
  >
@@ -92,26 +92,26 @@ export const Multiple = (args, {
92
92
  template: `
93
93
  <div class="tw-flex tw-flex-col tw-gap-2">
94
94
  <kv-checkbox
95
- :checked="checkboxExampleModel1"
95
+ :modelValue="checkboxExampleModel1"
96
96
  @change="(val) => checkboxExampleModel1 = val"
97
97
  >
98
98
  One is checked: {{checkboxExampleModel1}}
99
99
  </kv-checkbox>
100
100
  <kv-checkbox
101
- :checked="checkboxExampleModel2"
101
+ :modelValue="checkboxExampleModel2"
102
102
  @change="(val) => checkboxExampleModel2 = val"
103
103
  :disabled="true"
104
104
  >
105
105
  Two is checked: {{checkboxExampleModel2}}
106
106
  </kv-checkbox>
107
107
  <kv-checkbox
108
- :checked="checkboxExampleModel3"
108
+ :modelValue="checkboxExampleModel3"
109
109
  @change="(val) => checkboxExampleModel3 = val"
110
110
  >
111
111
  Three is checked: {{checkboxExampleModel3}}
112
112
  </kv-checkbox>
113
113
  <kv-checkbox
114
- :checked="checkboxExampleModel4"
114
+ :modelValue="checkboxExampleModel4"
115
115
  @change="(val) => checkboxExampleModel4 = val"
116
116
  >
117
117
  Four is long lorem ipsum nulla duis velit occaecat consectetur pariatur enim eu nostrud. <a href="https://placeholder.com">Irure et cupidatat</a> veniam sit enim proident exercitation ut Lorem do. Commodo ad veniam commodo est amet pariatur: {{checkboxExampleModel4}}
@@ -56,8 +56,8 @@ export const WithoutVModel = (args, {
56
56
  template: `
57
57
  <div>
58
58
  <kv-switch
59
- :checked="switchExampleModel"
60
- @change="(val) => switchExampleModel = val"
59
+ :modelValue="switchExampleModel"
60
+ @update:modelValue="(val) => switchExampleModel = val"
61
61
  :disabled="disabled"
62
62
  >
63
63
  Switch is switched: {{switchExampleModel}}
@@ -12,10 +12,10 @@ export const DefaultTemplate = () => ({
12
12
  template: `
13
13
  <kv-tabs @tab-changed="handleTabChanged">
14
14
  <template #tabNav>
15
- <kv-tab for="demo-1-first">First</kv-tab>
16
- <kv-tab for="demo-1-second">Second</kv-tab>
17
- <kv-tab for="demo-1-third">Third</kv-tab>
18
- <kv-tab for="demo-1-forth">Forth is longer</kv-tab>
15
+ <kv-tab forPanel="demo-1-first">First</kv-tab>
16
+ <kv-tab forPanel="demo-1-second">Second</kv-tab>
17
+ <kv-tab forPanel="demo-1-third">Third</kv-tab>
18
+ <kv-tab forPanel="demo-1-forth">Forth is longer</kv-tab>
19
19
  </template>
20
20
  <template #tabPanels>
21
21
  <kv-tab-panel id="demo-1-first"><p>First Panel</p></kv-tab-panel>
@@ -37,10 +37,10 @@ export const InitialTabSelection = () => ({
37
37
  template: `
38
38
  <kv-tabs @tab-changed="handleTabChanged">
39
39
  <template #tabNav>
40
- <kv-tab for="demo-2-first">First tab name</kv-tab>
41
- <kv-tab for="demo-2-second" :selected="true">Second is initially selected</kv-tab>
42
- <kv-tab for="demo-2-third">Third tab name</kv-tab>
43
- <kv-tab for="demo-2-forth">Forth tab name is quite long</kv-tab>
40
+ <kv-tab forPanel="demo-2-first">First tab name</kv-tab>
41
+ <kv-tab forPanel="demo-2-second" :selected="true">Second is initially selected</kv-tab>
42
+ <kv-tab forPanel="demo-2-third">Third tab name</kv-tab>
43
+ <kv-tab forPanel="demo-2-forth">Forth tab name is quite long</kv-tab>
44
44
  </template>
45
45
  <template #tabPanels>
46
46
  <kv-tab-panel id="demo-2-first"><p>First Panel</p></kv-tab-panel>
@@ -68,7 +68,7 @@ export const WithoutVModelTemplate = (args, {
68
68
  <kv-text-input
69
69
  id="without-v-model-id"
70
70
  @input="(val) => textInputModel = val"
71
- :value="textInputModel"
71
+ :modelValue="textInputModel"
72
72
  style="width: 25rem;"
73
73
  />
74
74
  </div>`,
@@ -1,7 +1,7 @@
1
1
  import primitives from '@kiva/kv-tokens/primitives.json';
2
2
  import {
3
3
  defaultTheme, darkTheme, darkGreenTheme, mintTheme,
4
- } from '@kiva/kv-tokens/configs/kivaColors';
4
+ } from '@kiva/kv-tokens/configs/kivaColors.cjs';
5
5
  import KvButton from '../KvButton.vue';
6
6
  import KvGrid from '../KvGrid.vue';
7
7
  import KvPageContainer from '../KvPageContainer.vue';
@@ -49,8 +49,9 @@ const Template = (args, {
49
49
  </div>
50
50
  </div>`,
51
51
  methods: {
52
- showToast(message, type, persist) {
53
- this.$refs.toastRef.show(message, type, persist);
52
+ showToast(messageInput, type, persistInput) {
53
+ console.log(this.$refs.toastRef);
54
+ this.$refs.toastRef.show(messageInput, type, persistInput);
54
55
  },
55
56
  onClose() {
56
57
  console.log('toast closed');
@@ -1,6 +1,6 @@
1
1
  import resolveConfig from 'tailwindcss/resolveConfig'; // eslint-disable-line import/no-extraneous-dependencies
2
- import tailwindConfig from '@kiva/kv-tokens/configs/tailwind.config';
3
- import { textStyles } from '@kiva/kv-tokens/configs/kivaTypography';
2
+ import tailwindConfig from '@kiva/kv-tokens/configs/tailwind.config.cjs';
3
+ import { textStyles } from '@kiva/kv-tokens/configs/kivaTypography.cjs';
4
4
  import KvGrid from '../KvGrid.vue';
5
5
  import KvPageContainer from '../KvPageContainer.vue';
6
6
  import KvTab from '../KvTab.vue';
@@ -8,7 +8,7 @@ import KvTabs from '../KvTabs.vue';
8
8
  import KvTabPanel from '../KvTabPanel.vue';
9
9
  import KvToast from '../KvToast.vue';
10
10
 
11
- const { headerNumberCase, kebabCase, removeObjectProperty } = require('../../utils/themeUtils');
11
+ const { headerNumberCase, kebabCase, removeObjectProperty } = require('../../utils/themeUtils.cjs');
12
12
 
13
13
  const config = resolveConfig(tailwindConfig);
14
14
  const { theme } = config;
@@ -50,8 +50,8 @@ export const Primitives = (args, { argTypes }) => ({
50
50
  <h2 class="tw-mb-4">Background Colors</h2>
51
51
  <kv-tabs>
52
52
  <template #tabNav>
53
- <kv-tab for="bg_themable">Themable</kv-tab>
54
- <kv-tab for="bg_static">Static</kv-tab>
53
+ <kv-tab for-panel="bg_themable">Themable</kv-tab>
54
+ <kv-tab for-panel="bg_static">Static</kv-tab>
55
55
  </template>
56
56
  <template #tabPanels>
57
57
  <kv-tab-panel id="bg_themable">
@@ -118,8 +118,8 @@ export const Primitives = (args, { argTypes }) => ({
118
118
  <h2 class="tw-mb-4">Text Colors</h2>
119
119
  <kv-tabs>
120
120
  <template #tabNav>
121
- <kv-tab for="text_themable">Themable</kv-tab>
122
- <kv-tab for="text_static">Static</kv-tab>
121
+ <kv-tab for-panel="text_themable">Themable</kv-tab>
122
+ <kv-tab for-panel="text_static">Static</kv-tab>
123
123
  </template>
124
124
  <template #tabPanels>
125
125
  <kv-tab-panel id="text_themable">
@@ -174,8 +174,8 @@ export const Primitives = (args, { argTypes }) => ({
174
174
  <h2 class="tw-mb-4">Border/Ring Colors</h2>
175
175
  <kv-tabs>
176
176
  <template #tabNav>
177
- <kv-tab for="border_themable">Themable</kv-tab>
178
- <kv-tab for="border_static">Static</kv-tab>
177
+ <kv-tab for-panel="border_themable">Themable</kv-tab>
178
+ <kv-tab for-panel="border_static">Static</kv-tab>
179
179
  </template>
180
180
  <template #tabPanels>
181
181
  <kv-tab-panel id="border_themable">
package/.babelrc DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "env": {
3
- "test": {
4
- "presets": [
5
- [
6
- "@babel/preset-env",
7
- {
8
- "targets": {
9
- "node": "current"
10
- }
11
- }
12
- ]
13
- ]
14
- }
15
- }
16
- }
package/jest.config.js DELETED
@@ -1,36 +0,0 @@
1
- /*
2
- * For a detailed explanation regarding each configuration property, visit:
3
- * https://jestjs.io/docs/configuration
4
- */
5
-
6
- module.exports = {
7
- testMatch: ['**/unit/specs/**/*.spec.js'],
8
-
9
- // Automatically clear mock calls and instances between every test
10
- clearMocks: true,
11
-
12
- // Indicates whether the coverage information should be collected while executing the test
13
- collectCoverage: false,
14
-
15
- // The directory where Jest should output its coverage files
16
- // coverageDirectory: 'coverage',
17
-
18
- // Indicates which provider should be used to instrument code for coverage
19
- // coverageProvider: 'v8',
20
-
21
- // An array of file extensions your modules use
22
- moduleFileExtensions: [
23
- 'js',
24
- 'json',
25
- 'vue',
26
- ],
27
-
28
- // The test environment that will be used for testing
29
- testEnvironment: 'jsdom',
30
-
31
- // A map from regular expressions to paths to transformers
32
- transform: {
33
- '^.+\\.vue$': 'vue-jest',
34
- '^.+\\.js$': 'babel-jest',
35
- },
36
- };