@mozaic-ds/vue 1.0.0-beta.3 → 1.0.0-beta.4

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 (179) hide show
  1. package/LICENSE +51 -0
  2. package/README.md +218 -84
  3. package/dist/mozaic-vue.css +1 -1
  4. package/dist/mozaic-vue.d.ts +920 -0
  5. package/dist/mozaic-vue.js +877 -0
  6. package/dist/mozaic-vue.js.map +1 -0
  7. package/dist/mozaic-vue.umd.cjs +2 -0
  8. package/dist/mozaic-vue.umd.cjs.map +1 -0
  9. package/env.d.ts +1 -0
  10. package/package.json +80 -50
  11. package/src/components/Contributing.mdx +118 -0
  12. package/src/components/GettingStarted.mdx +39 -0
  13. package/src/components/Introduction.mdx +54 -0
  14. package/src/components/Support.mdx +18 -0
  15. package/src/components/badge/MBadge.spec.ts +16 -0
  16. package/src/components/badge/MBadge.stories.ts +50 -0
  17. package/src/components/badge/MBadge.vue +36 -34
  18. package/src/components/button/MButton.spec.ts +191 -0
  19. package/src/components/button/MButton.stories.ts +66 -0
  20. package/src/components/button/MButton.vue +98 -154
  21. package/src/components/checkbox/MCheckbox.spec.ts +104 -0
  22. package/src/components/checkbox/MCheckbox.stories.ts +83 -0
  23. package/src/components/checkbox/MCheckbox.vue +60 -101
  24. package/src/components/checkboxgroup/MCheckboxGroup.spec.ts +78 -0
  25. package/src/components/checkboxgroup/MCheckboxGroup.stories.ts +61 -0
  26. package/src/components/checkboxgroup/MCheckboxGroup.vue +97 -0
  27. package/src/components/field/MField.spec.ts +166 -0
  28. package/src/components/field/MField.stories.ts +376 -0
  29. package/src/components/field/MField.vue +78 -61
  30. package/src/components/fieldgroup/MFieldGroup.spec.ts +165 -0
  31. package/src/components/fieldgroup/MFieldGroup.stories.ts +274 -0
  32. package/src/components/fieldgroup/MFieldGroup.vue +79 -0
  33. package/src/components/iconbutton/MIconButton.spec.ts +108 -0
  34. package/src/components/iconbutton/MIconButton.stories.ts +66 -0
  35. package/src/components/iconbutton/MIconButton.vue +73 -0
  36. package/src/components/link/MLink.spec.ts +154 -0
  37. package/src/components/link/MLink.stories.ts +98 -0
  38. package/src/components/link/MLink.vue +86 -109
  39. package/src/components/loader/MLoader.spec.ts +104 -0
  40. package/src/components/loader/MLoader.stories.ts +45 -0
  41. package/src/components/loader/MLoader.vue +65 -55
  42. package/src/components/overlay/MOverlay.spec.ts +51 -0
  43. package/src/components/overlay/MOverlay.stories.ts +40 -0
  44. package/src/components/overlay/MOverlay.vue +27 -19
  45. package/src/components/quantityselector/MQuantitySelector.spec.ts +262 -0
  46. package/src/components/quantityselector/MQuantitySelector.stories.ts +89 -0
  47. package/src/components/quantityselector/MQuantitySelector.vue +160 -136
  48. package/src/components/radio/MRadio.spec.ts +104 -0
  49. package/src/components/radio/MRadio.stories.ts +68 -0
  50. package/src/components/radio/MRadio.vue +56 -39
  51. package/src/components/radiogroup/MRadioGroup.spec.ts +54 -0
  52. package/src/components/radiogroup/MRadioGroup.stories.ts +61 -0
  53. package/src/components/radiogroup/MRadioGroup.vue +79 -0
  54. package/src/components/select/MSelect.spec.ts +114 -0
  55. package/src/components/select/MSelect.stories.ts +101 -0
  56. package/src/components/select/MSelect.vue +77 -119
  57. package/src/components/statusbadge/MStatusBadge.stories.ts +45 -0
  58. package/src/components/statusbadge/MStatusBadge.vue +40 -0
  59. package/src/components/statusbadge/MStatusDot.vue +32 -0
  60. package/src/components/statusbadge/MstatusBadge.spec.ts +16 -0
  61. package/src/components/textarea/MTextArea.spec.ts +112 -0
  62. package/src/components/textarea/MTextArea.stories.ts +67 -0
  63. package/src/components/textarea/MTextArea.vue +81 -42
  64. package/src/components/textinput/MTextInput.spec.ts +121 -0
  65. package/src/components/textinput/MTextInput.stories.ts +114 -0
  66. package/src/components/textinput/MTextInput.vue +127 -47
  67. package/src/components/toggle/MToggle.spec.ts +99 -0
  68. package/src/components/toggle/MToggle.stories.ts +68 -0
  69. package/src/components/toggle/MToggle.vue +63 -103
  70. package/src/components/usingIcons.mdx +43 -0
  71. package/src/components/usingPresets.mdx +125 -0
  72. package/src/main.ts +39 -0
  73. package/dist/demo.html +0 -1
  74. package/dist/mozaic-vue.adeo.css +0 -45
  75. package/dist/mozaic-vue.adeo.umd.js +0 -41775
  76. package/dist/mozaic-vue.common.js +0 -41765
  77. package/dist/mozaic-vue.common.js.map +0 -1
  78. package/dist/mozaic-vue.umd.js +0 -41776
  79. package/dist/mozaic-vue.umd.js.map +0 -1
  80. package/dist/mozaic-vue.umd.min.js +0 -4
  81. package/dist/mozaic-vue.umd.min.js.map +0 -1
  82. package/postinstall.js +0 -3
  83. package/src/components/accordion/MAccordion.vue +0 -128
  84. package/src/components/accordion/index.js +0 -7
  85. package/src/components/autocomplete/MAutocomplete.vue +0 -198
  86. package/src/components/autocomplete/index.js +0 -7
  87. package/src/components/badge/index.js +0 -7
  88. package/src/components/breadcrumb/MBreadcrumb.vue +0 -73
  89. package/src/components/breadcrumb/index.js +0 -7
  90. package/src/components/button/index.js +0 -7
  91. package/src/components/card/MCard.vue +0 -78
  92. package/src/components/card/index.js +0 -7
  93. package/src/components/checkbox/MCheckboxGroup.vue +0 -155
  94. package/src/components/checkbox/index.js +0 -12
  95. package/src/components/container/MContainer.vue +0 -33
  96. package/src/components/container/index.js +0 -7
  97. package/src/components/datatable/MDataTable.vue +0 -651
  98. package/src/components/datatable/MDataTableHeader.vue +0 -55
  99. package/src/components/datatable/MDataTableTop.vue +0 -35
  100. package/src/components/datatable/helpers.js +0 -132
  101. package/src/components/datatable/index.js +0 -12
  102. package/src/components/field/index.js +0 -7
  103. package/src/components/fileuploader/MFileResult.vue +0 -149
  104. package/src/components/fileuploader/MFileUploader.vue +0 -142
  105. package/src/components/fileuploader/index.js +0 -7
  106. package/src/components/flag/MFlag.vue +0 -46
  107. package/src/components/flag/index.js +0 -7
  108. package/src/components/heading/MHeading.vue +0 -75
  109. package/src/components/heading/index.js +0 -7
  110. package/src/components/hero/MHero.vue +0 -93
  111. package/src/components/hero/index.js +0 -7
  112. package/src/components/icon/MIcon.vue +0 -120
  113. package/src/components/icon/index.js +0 -7
  114. package/src/components/index.js +0 -43
  115. package/src/components/layer/MLayer.vue +0 -208
  116. package/src/components/layer/index.js +0 -7
  117. package/src/components/link/index.js +0 -7
  118. package/src/components/listbox/MListBox.vue +0 -106
  119. package/src/components/listbox/index.js +0 -7
  120. package/src/components/loader/index.js +0 -7
  121. package/src/components/modal/MModal.vue +0 -179
  122. package/src/components/modal/index.js +0 -7
  123. package/src/components/notification/MNotification.vue +0 -110
  124. package/src/components/notification/index.js +0 -7
  125. package/src/components/optionbutton/MOptionButton.vue +0 -67
  126. package/src/components/optionbutton/index.js +0 -7
  127. package/src/components/optioncard/MOptionCard.vue +0 -132
  128. package/src/components/optioncard/index.js +0 -7
  129. package/src/components/optiongroup/MOptionGroup.vue +0 -18
  130. package/src/components/optiongroup/index.js +0 -7
  131. package/src/components/overlay/MOverlayLoader.vue +0 -43
  132. package/src/components/overlay/index.js +0 -12
  133. package/src/components/pagination/MPagination.vue +0 -162
  134. package/src/components/pagination/index.js +0 -7
  135. package/src/components/passwordinput/MPasswordInput.vue +0 -96
  136. package/src/components/passwordinput/index.js +0 -7
  137. package/src/components/phonenumber/MPhoneNumber.vue +0 -390
  138. package/src/components/phonenumber/index.js +0 -7
  139. package/src/components/progressbar/MProgress.vue +0 -102
  140. package/src/components/progressbar/index.js +0 -7
  141. package/src/components/quantityselector/index.js +0 -7
  142. package/src/components/radio/MRadioGroup.vue +0 -111
  143. package/src/components/radio/index.js +0 -12
  144. package/src/components/ratingstars/MStarsInput.vue +0 -118
  145. package/src/components/ratingstars/MStarsResult.vue +0 -89
  146. package/src/components/ratingstars/index.js +0 -12
  147. package/src/components/select/index.js +0 -7
  148. package/src/components/stepper/MStepper.vue +0 -70
  149. package/src/components/stepper/index.js +0 -7
  150. package/src/components/tabs/MTab.vue +0 -184
  151. package/src/components/tabs/index.js +0 -7
  152. package/src/components/tags/MTag.vue +0 -173
  153. package/src/components/tags/index.js +0 -7
  154. package/src/components/textarea/index.js +0 -7
  155. package/src/components/textinput/MTextInputField.vue +0 -105
  156. package/src/components/textinput/MTextInputIcon.vue +0 -42
  157. package/src/components/textinput/index.js +0 -7
  158. package/src/components/toggle/index.js +0 -7
  159. package/src/components/tooltip/MTooltip.vue +0 -42
  160. package/src/components/tooltip/index.js +0 -7
  161. package/src/index.js +0 -62
  162. package/src/shims-tsx.d.ts +0 -13
  163. package/src/shims.vue.d.ts +0 -4
  164. package/src/tokens/adeo/android/colors.xml +0 -391
  165. package/src/tokens/adeo/android/font_dimens.xml +0 -18
  166. package/src/tokens/adeo/css/_variables.scss +0 -385
  167. package/src/tokens/adeo/css/root.scss +0 -387
  168. package/src/tokens/adeo/ios/StyleDictionaryColor.h +0 -399
  169. package/src/tokens/adeo/ios/StyleDictionaryColor.m +0 -411
  170. package/src/tokens/adeo/ios/StyleDictionaryColor.swift +0 -394
  171. package/src/tokens/adeo/ios/StyleDictionarySize.h +0 -69
  172. package/src/tokens/adeo/ios/StyleDictionarySize.m +0 -70
  173. package/src/tokens/adeo/ios/StyleDictionarySize.swift +0 -71
  174. package/src/tokens/adeo/js/tokens.js +0 -483
  175. package/src/tokens/adeo/js/tokensObject.js +0 -10354
  176. package/src/tokens/adeo/scss/_tokens.scss +0 -1300
  177. package/src/utils/mozaicClasses.js +0 -16
  178. package/src/utils/theme.validator.js +0 -19
  179. package/types/index.d.ts +0 -100
@@ -0,0 +1,78 @@
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, it, expect } from 'vitest';
3
+ import MCheckboxGroup from './MCheckboxGroup.vue';
4
+ import MCheckbox from '@/components/checkbox/MCheckbox.vue';
5
+
6
+ describe('MCheckboxGroup.vue', () => {
7
+ it('renders checkboxes based on options', async () => {
8
+ const options = [
9
+ { id: '1', label: 'Option 1', value: 'option1' },
10
+ { id: '2', label: 'Option 2', value: 'option2' },
11
+ ];
12
+
13
+ const wrapper = mount(MCheckboxGroup, {
14
+ props: {
15
+ name: 'test-name',
16
+ options,
17
+ },
18
+ });
19
+
20
+ const checkboxes = wrapper.findAllComponents(MCheckbox);
21
+ expect(checkboxes.length).toBe(2);
22
+
23
+ expect(checkboxes[0].props('label')).toBe('Option 1');
24
+ expect(checkboxes[1].props('label')).toBe('Option 2');
25
+ });
26
+
27
+ it('updates modelValue when a checkbox is checked', async () => {
28
+ const options = [
29
+ { id: '1', label: 'Option 1', value: 'option1' },
30
+ { id: '2', label: 'Option 2', value: 'option2' },
31
+ ];
32
+
33
+ const wrapper = mount(MCheckboxGroup, {
34
+ props: {
35
+ name: 'test-name',
36
+ options,
37
+ modelValue: [],
38
+ },
39
+ });
40
+
41
+ const checkbox1 = wrapper.findAllComponents(MCheckbox)[0].find('input');
42
+ await checkbox1.setChecked(true);
43
+
44
+ expect(wrapper.emitted('update:modelValue')).toBeTruthy();
45
+ expect(wrapper.emitted('update:modelValue')[0]).toEqual([['option1']]);
46
+
47
+ const checkbox2 = wrapper.findAllComponents(MCheckbox)[1].find('input');
48
+ await checkbox2.setChecked(true);
49
+
50
+ expect(wrapper.emitted('update:modelValue')[1]).toEqual([
51
+ ['option1', 'option2'],
52
+ ]);
53
+ });
54
+
55
+ it('syncs with the v-model when initial value is passed', async () => {
56
+ const options = [
57
+ { id: '1', label: 'Option 1', value: 'option1' },
58
+ { id: '2', label: 'Option 2', value: 'option2' },
59
+ ];
60
+
61
+ const wrapper = mount(MCheckboxGroup, {
62
+ props: {
63
+ name: 'test-name',
64
+ options,
65
+ modelValue: ['option1'],
66
+ },
67
+ });
68
+
69
+ const checkboxes = wrapper.findAllComponents(MCheckbox);
70
+ expect(checkboxes[0].props('modelValue')).toBe(true);
71
+ expect(checkboxes[1].props('modelValue')).toBe(false);
72
+
73
+ await wrapper.setProps({ modelValue: ['option2'] });
74
+
75
+ expect(checkboxes[0].props('modelValue')).toBe(false);
76
+ expect(checkboxes[1].props('modelValue')).toBe(true);
77
+ });
78
+ });
@@ -0,0 +1,61 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3';
2
+ import { action } from '@storybook/addon-actions';
3
+
4
+ import MCheckboxGroup from './MCheckboxGroup.vue';
5
+
6
+ const meta: Meta<typeof MCheckboxGroup> = {
7
+ title: 'Form Elements/Checkbox Group',
8
+ component: MCheckboxGroup,
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component:
13
+ 'Checkboxes are used to select one or multiple options in a list. They usually find their place in forms and are also used to accept some mentions.<br><br> To put a label, requierement text, help text or to apply a valid or invalid message, the examples are available in the [Field Group section](/docs/form-elements-field-group--docs#checkbox%20group).',
14
+ },
15
+ },
16
+ },
17
+ args: {
18
+ name: 'checkboxGroupName',
19
+ modelValue: ['checkbox2'],
20
+ options: [
21
+ {
22
+ id: 'checkbox-01',
23
+ label: 'checkbox Label',
24
+ value: 'checkbox1',
25
+ },
26
+ {
27
+ id: 'checkbox-02',
28
+ label: 'checkbox Label',
29
+ value: 'checkbox2',
30
+ },
31
+ {
32
+ id: 'checkbox-03',
33
+ label: 'checkbox Label',
34
+ value: 'checkbox3',
35
+ },
36
+ {
37
+ id: 'checkbox-04',
38
+ label: 'checkbox Label',
39
+ value: 'checkbox4',
40
+ },
41
+ ],
42
+ },
43
+ render: (args) => ({
44
+ components: { MCheckboxGroup },
45
+ setup() {
46
+ const handleUpdate = action('update:modelValue');
47
+
48
+ return { args, handleUpdate };
49
+ },
50
+ template: `
51
+ <MCheckboxGroup
52
+ v-bind="args"
53
+ @update:modelValue="handleUpdate"
54
+ />
55
+ `,
56
+ }),
57
+ };
58
+ export default meta;
59
+ type Story = StoryObj<typeof MCheckboxGroup>;
60
+
61
+ export const Default: Story = {};
@@ -0,0 +1,97 @@
1
+ <template>
2
+ <div class="mc-field__container" :class="classObjectContainer">
3
+ <MCheckbox
4
+ v-for="option in options"
5
+ :id="option.id"
6
+ :key="option.id"
7
+ :label="option.label"
8
+ :is-invalid="option.isInvalid"
9
+ :name="name"
10
+ class="mc-field__item"
11
+ :class="classObjectItem"
12
+ :model-value="modelValue ? modelValue.includes(option.value) : undefined"
13
+ :disabled="option.disabled"
14
+ @update:model-value="(v: boolean) => onChange(v, option.value)"
15
+ />
16
+ </div>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import { computed, ref, watch } from 'vue';
21
+ import MCheckbox from '../checkbox/MCheckbox.vue';
22
+
23
+ /**
24
+ * Checkboxes are used to select one or multiple options in a list. They usually find their place in forms and are also used to accept some mentions.
25
+ */
26
+ const props = defineProps<{
27
+ /**
28
+ * The name attribute for the radio element, typically used for form submission.
29
+ */
30
+ name: string;
31
+ /**
32
+ * Property used to manage the values checked by v-model
33
+ * (Do not use directly)
34
+ */
35
+ modelValue?: Array<string>;
36
+ /**
37
+ * list of properties of each radio button of the radio group
38
+ */
39
+ options: Array<{
40
+ id: string;
41
+ label: string;
42
+ value: string;
43
+ disabled?: boolean;
44
+ isInvalid?: boolean;
45
+ }>;
46
+ /**
47
+ * If `true`, make the form element of the group inline.
48
+ */
49
+ inline?: boolean;
50
+ }>();
51
+
52
+ const selectedValue = ref<string[]>([]);
53
+
54
+ watch(
55
+ () => props.modelValue,
56
+ (newValue) => {
57
+ selectedValue.value = newValue || [];
58
+ },
59
+ { immediate: true },
60
+ );
61
+
62
+ const onChange = (isChecked: boolean, value: string) => {
63
+ let values = [...selectedValue.value];
64
+
65
+ if (isChecked && !values.includes(value)) {
66
+ values.push(value);
67
+ } else {
68
+ values = values.filter((val) => val !== value);
69
+ }
70
+
71
+ emit('update:modelValue', values);
72
+ selectedValue.value = values;
73
+ };
74
+
75
+ const classObjectContainer = computed(() => {
76
+ return {
77
+ 'mc-field__container--inline': props.inline,
78
+ };
79
+ });
80
+
81
+ const classObjectItem = computed(() => {
82
+ return {
83
+ 'mc-field__container--inline__item': props.inline,
84
+ };
85
+ });
86
+
87
+ const emit = defineEmits<{
88
+ /**
89
+ * Emits when the checkbox group value changes, updating the modelValue prop.
90
+ */
91
+ (on: 'update:modelValue', value: Array<string>): void;
92
+ }>();
93
+ </script>
94
+
95
+ <style lang="scss" scoped>
96
+ @use '@mozaic-ds/styles/components/field';
97
+ </style>
@@ -0,0 +1,166 @@
1
+ import { mount } from '@vue/test-utils';
2
+ import { describe, it, expect } from 'vitest';
3
+ import MField from './MField.vue';
4
+
5
+ describe('MField component', () => {
6
+ it('should render label correctly', () => {
7
+ const wrapper = mount(MField, {
8
+ props: {
9
+ id: 'input-id',
10
+ label: 'Field Label',
11
+ },
12
+ });
13
+
14
+ const label = wrapper.find('label');
15
+ expect(label.exists()).toBe(true);
16
+ expect(label.text()).toBe('Field Label');
17
+ });
18
+
19
+ it('should render requirement text if provided', () => {
20
+ const wrapper = mount(MField, {
21
+ props: {
22
+ id: 'input-id',
23
+ label: 'Field Label',
24
+ requirementText: 'required',
25
+ },
26
+ });
27
+
28
+ const requirementText = wrapper.find('.mc-field__requirement');
29
+ expect(requirementText.exists()).toBe(true);
30
+ expect(requirementText.text()).toBe('(required)');
31
+ });
32
+
33
+ it('should not render requirement text if not provided', () => {
34
+ const wrapper = mount(MField, {
35
+ props: {
36
+ id: 'input-id',
37
+ label: 'Field Label',
38
+ },
39
+ });
40
+
41
+ const requirementText = wrapper.find('.mc-field__requirement');
42
+ expect(requirementText.exists()).toBe(false);
43
+ });
44
+
45
+ it('should render help text if provided', () => {
46
+ const wrapper = mount(MField, {
47
+ props: {
48
+ id: 'input-id',
49
+ label: 'Field Label',
50
+ helpText: 'This is some help text.',
51
+ helpId: 'help-id',
52
+ },
53
+ });
54
+
55
+ const helpText = wrapper.find('.mc-field__help');
56
+ expect(helpText.exists()).toBe(true);
57
+ expect(helpText.text()).toBe('This is some help text.');
58
+ });
59
+
60
+ it('should not render help text if not provided', () => {
61
+ const wrapper = mount(MField, {
62
+ props: {
63
+ id: 'input-id',
64
+ label: 'Field Label',
65
+ },
66
+ });
67
+
68
+ const helpText = wrapper.find('.mc-field__help');
69
+ expect(helpText.exists()).toBe(false);
70
+ });
71
+
72
+ it('should apply is-valid class when isValid prop is true', () => {
73
+ const wrapper = mount(MField, {
74
+ props: {
75
+ id: 'input-id',
76
+ label: 'Field Label',
77
+ isValid: true,
78
+ message: 'Valid input',
79
+ },
80
+ });
81
+
82
+ expect(wrapper.find('.mc-field__validation-message').classes()).toContain(
83
+ 'is-valid',
84
+ );
85
+ expect(wrapper.find('.mc-field__validation-message').text()).toBe(
86
+ 'Valid input',
87
+ );
88
+ });
89
+
90
+ it('should apply is-invalid class when isInvalid prop is true', () => {
91
+ const wrapper = mount(MField, {
92
+ props: {
93
+ id: 'input-id',
94
+ label: 'Field Label',
95
+ isInvalid: true,
96
+ message: 'Invalid input',
97
+ },
98
+ });
99
+
100
+ expect(wrapper.find('.mc-field__validation-message').classes()).toContain(
101
+ 'is-invalid',
102
+ );
103
+ expect(wrapper.find('.mc-field__validation-message').text()).toBe(
104
+ 'Invalid input',
105
+ );
106
+ });
107
+
108
+ it('should render a validation message only when isValid or isInvalid is true and message is provided', () => {
109
+ const wrapper = mount(MField, {
110
+ props: {
111
+ id: 'input-id',
112
+ label: 'Field Label',
113
+ isValid: true,
114
+ message: 'This is a valid input',
115
+ },
116
+ });
117
+
118
+ const validationMessage = wrapper.find('.mc-field__validation-message');
119
+ expect(validationMessage.exists()).toBe(true);
120
+ expect(validationMessage.text()).toBe('This is a valid input');
121
+ });
122
+
123
+ it('should render the form element passed in the slot', () => {
124
+ const wrapper = mount(MField, {
125
+ props: {
126
+ id: 'input-id',
127
+ label: 'Field Label',
128
+ },
129
+ slots: {
130
+ default: '<input type="text" />',
131
+ },
132
+ });
133
+
134
+ const input = wrapper.find('input');
135
+ expect(input.exists()).toBe(true);
136
+ expect(input.attributes('type')).toBe('text');
137
+ });
138
+
139
+ it('should render validation message when isInvalid is true and message is provided', () => {
140
+ const wrapper = mount(MField, {
141
+ props: {
142
+ id: 'input-id',
143
+ label: 'Field Label',
144
+ isInvalid: true,
145
+ message: 'There is an error',
146
+ },
147
+ });
148
+
149
+ const validationMessage = wrapper.find('.mc-field__validation-message');
150
+ expect(validationMessage.exists()).toBe(true);
151
+ expect(validationMessage.text()).toBe('There is an error');
152
+ });
153
+
154
+ it('should not render validation message when message is not provided', () => {
155
+ const wrapper = mount(MField, {
156
+ props: {
157
+ id: 'input-id',
158
+ label: 'Field Label',
159
+ isValid: true,
160
+ },
161
+ });
162
+
163
+ const validationMessage = wrapper.find('.mc-field__validation-message');
164
+ expect(validationMessage.exists()).toBe(false);
165
+ });
166
+ });