@mgdis/mg-components 5.17.0 → 5.18.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.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_34.cjs.entry.js +464 -157
- package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +31 -11
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +6 -0
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +8 -0
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +92 -16
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +58 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +79 -8
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +109 -38
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +83 -10
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +82 -9
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +60 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +82 -9
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +94 -21
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +68 -5
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +100 -26
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +67 -4
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +2 -2
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +8 -6
- package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +3 -13
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +34 -14
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js +13 -2
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js +12 -0
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js.map +1 -1
- package/dist/collection/utils/components.utils.js +6 -0
- package/dist/collection/utils/components.utils.js.map +1 -1
- package/dist/collection/utils/components.utils.spec.js +9 -1
- package/dist/collection/utils/components.utils.spec.js.map +1 -1
- package/dist/components/components.utils.js +7 -1
- package/dist/components/components.utils.js.map +1 -1
- package/dist/components/mg-form.js +1 -1
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +52 -13
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +41 -8
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +71 -38
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +45 -10
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +44 -9
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-select2.js +44 -9
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +56 -23
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +60 -26
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-panel.js +8 -7
- package/dist/components/mg-panel.js.map +1 -1
- package/dist/components/mg-popover2.js +33 -14
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-tooltip2.js +30 -11
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_34.entry.js +464 -157
- package/dist/esm/mg-action-more_34.entry.js.map +1 -1
- package/dist/esm/mg-components.js +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/p-ff3ca349.entry.js +2 -0
- package/dist/mg-components/p-ff3ca349.entry.js.map +1 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +2 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +22 -1
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +17 -2
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +35 -20
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +16 -1
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +16 -1
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +16 -1
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +17 -5
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +17 -5
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +1 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -0
- package/dist/types/components.d.ts +59 -11
- package/dist/types/utils/components.utils.d.ts +6 -0
- package/package.json +1 -1
- package/dist/mg-components/p-caafc9cf.entry.js +0 -2
- package/dist/mg-components/p-caafc9cf.entry.js.map +0 -1
package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js
CHANGED
|
@@ -73,14 +73,22 @@ describe('mg-input-text', () => {
|
|
|
73
73
|
expect(err.message).toMatch('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide"');
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
-
test.each(['', undefined])('Should throw an error when pattern is used with patternErrorMessage: %s', async (
|
|
76
|
+
test.each(['', ' ', null, undefined])('Should throw an error when pattern is used with invalid patternErrorMessage: %s', async (patternErrorMessage) => {
|
|
77
77
|
expect.assertions(1);
|
|
78
78
|
try {
|
|
79
|
-
|
|
80
|
-
expect(root).toMatchSnapshot();
|
|
79
|
+
await getPage({ identifier: 'identifier', label: 'blu', pattern: '[a-z]*', patternErrorMessage });
|
|
81
80
|
}
|
|
82
81
|
catch (err) {
|
|
83
|
-
expect(err.message).toMatch('<mg-input-text>
|
|
82
|
+
expect(err.message).toMatch('<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
test.each(['', ' ', null, undefined])('Should throw an error when patternErrorMessage is used with invalid pattern: %s', async (pattern) => {
|
|
86
|
+
expect.assertions(1);
|
|
87
|
+
try {
|
|
88
|
+
await getPage({ identifier: 'identifier', label: 'blu', pattern, patternErrorMessage: 'pattern error message' });
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
expect(err.message).toMatch('<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
84
92
|
}
|
|
85
93
|
});
|
|
86
94
|
test('Should trigger events', async () => {
|
|
@@ -116,7 +124,7 @@ describe('mg-input-text', () => {
|
|
|
116
124
|
{ validity: false, valueMissing: true, patternMismatch: false },
|
|
117
125
|
{ validity: false, valueMissing: false, patternMismatch: true },
|
|
118
126
|
])('validity (%s), valueMissing (%s), patternMismatch (%s)', async ({ validity, valueMissing, patternMismatch }) => {
|
|
119
|
-
const args = { label: 'label', identifier: 'identifier', patternErrorMessage: 'Non' };
|
|
127
|
+
const args = { label: 'label', identifier: 'identifier', pattern: '[a-z]*', patternErrorMessage: 'Non' };
|
|
120
128
|
const page = await getPage(args);
|
|
121
129
|
const element = page.doc.querySelector('mg-input-text');
|
|
122
130
|
const input = element.shadowRoot.querySelector('input');
|
|
@@ -174,6 +182,61 @@ describe('mg-input-text', () => {
|
|
|
174
182
|
await page.waitForChanges();
|
|
175
183
|
expect(page.root).toMatchSnapshot();
|
|
176
184
|
});
|
|
185
|
+
test.each([
|
|
186
|
+
{
|
|
187
|
+
valid: true,
|
|
188
|
+
errorMessage: 'Override error',
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
valid: false,
|
|
192
|
+
errorMessage: 'Override error',
|
|
193
|
+
},
|
|
194
|
+
])("should display override error with setError component's public method", async (params) => {
|
|
195
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
196
|
+
expect(page.root).toMatchSnapshot();
|
|
197
|
+
const element = page.doc.querySelector('mg-input-text');
|
|
198
|
+
const input = element.shadowRoot.querySelector('input');
|
|
199
|
+
//mock validity
|
|
200
|
+
Object.defineProperty(input, 'validity', {
|
|
201
|
+
get: () => ({}),
|
|
202
|
+
});
|
|
203
|
+
await element.setError(params.valid, params.errorMessage);
|
|
204
|
+
await page.waitForChanges();
|
|
205
|
+
expect(page.root).toMatchSnapshot();
|
|
206
|
+
});
|
|
207
|
+
test.each([
|
|
208
|
+
{
|
|
209
|
+
valid: '',
|
|
210
|
+
errorMessage: 'Override error',
|
|
211
|
+
error: '<mg-input-text> method "setError()" param "valid" must be a boolean',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
valid: undefined,
|
|
215
|
+
errorMessage: 'Override error',
|
|
216
|
+
error: '<mg-input-text> method "setError()" param "valid" must be a boolean',
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
valid: true,
|
|
220
|
+
errorMessage: ' ',
|
|
221
|
+
error: '<mg-input-text> method "setError()" param "errorMessage" must be a string',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
valid: true,
|
|
225
|
+
errorMessage: true,
|
|
226
|
+
error: '<mg-input-text> method "setError()" param "errorMessage" must be a string',
|
|
227
|
+
},
|
|
228
|
+
])("shloud throw error with setError component's public method invalid params", async (params) => {
|
|
229
|
+
expect.assertions(1);
|
|
230
|
+
try {
|
|
231
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
232
|
+
const element = page.doc.querySelector('mg-input-text');
|
|
233
|
+
await element.setError(params.valid, params.errorMessage);
|
|
234
|
+
await page.waitForChanges();
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
expect(err.message).toMatch(params.error);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
177
240
|
test.each(['fr', 'xx'])('display error message with locale: %s', async (lang) => {
|
|
178
241
|
const page = await getPage({ label: 'label', identifier: 'identifier', required: true, lang });
|
|
179
242
|
const element = page.doc.querySelector('mg-input-text');
|
package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-input-text.spec.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,QAAQ,MAAM,yCAAyC,CAAC;AAE/D,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,OAAQ,EAAE,EAAE;EACjC,MAAM,IAAI,GAAG,WAAW,CAAC;IACvB,UAAU,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC;IAC3C,QAAQ,EAAE,GAAG,EAAE,CAAC,qCAAmB,IAAI,GAAG,O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M,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;IACrB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;EACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgInputText } from '../mg-input-text';\nimport { MgButton } from '../../../../atoms/mg-button/mg-button';\nimport { MgIcon } from '../../../../atoms/mg-icon/mg-icon';\nimport messages from '../../../../../locales/en/messages.json';\n\nconst getPage = (args, content?) => {\n const page = newSpecPage({\n components: [MgInputText, MgButton, MgIcon],\n template: () => <mg-input-text {...args}>{content}</mg-input-text>,\n });\n\n jest.runAllTimers();\n\n return page;\n};\n\ndescribe('mg-input-text', () => {\n beforeEach(() => jest.useFakeTimers());\n afterEach(() => jest.runOnlyPendingTimers());\n test.each([\n { label: 'label', identifier: 'identifier' },\n { label: 'label', identifier: 'identifier', labelHide: true },\n { label: 'label', identifier: 'identifier', labelOnTop: true },\n { label: 'label', identifier: 'identifier', readonly: true },\n { label: 'label', identifier: 'identifier', type: 'search' },\n { label: 'label', identifier: 'identifier', type: 'search', icon: 'magnifying-glass' },\n { label: 'label', identifier: 'identifier', readonly: true, labelOnTop: true, tooltip: 'Tooltip message' },\n { label: 'label', identifier: 'identifier', readonly: true, value: 'blu' },\n { label: 'label', identifier: 'identifier', required: true, value: 'blu', helpText: 'My help text' },\n { label: 'label', identifier: 'identifier', required: true, readonly: true, value: 'blu', helpText: 'My help text' },\n { label: 'label', identifier: 'identifier', required: true, disabled: true, value: 'blu', helpText: 'My help text' },\n { label: 'label', identifier: 'identifier', tooltip: 'My Tooltip Message' },\n { label: 'label', identifier: 'identifier', tooltip: 'My Tooltip Message', labelOnTop: true },\n { label: 'label', identifier: 'identifier', displayCharacterLeft: false },\n ])('Should render with args %s:', async args => {\n const { root } = await getPage(args);\n expect(root).toMatchSnapshot();\n });\n\n test.each([\n <mg-button slot=\"append-input\" label=\"search\" identifier=\"identifier\">\n <mg-icon icon=\"magnifying-glass\"></mg-icon> Search\n </mg-button>,\n <span slot=\"append-input\">test</span>,\n [\n <mg-button is-icon slot=\"append-input\" label=\"cancel\" identifier=\"identifier-cancel\">\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>,\n <mg-button is-icon slot=\"append-input\" label=\"validate\" identifier=\"identifier-validate\">\n <mg-icon icon=\"check\"></mg-icon>\n </mg-button>,\n ],\n ])('Should render with slot.', async slot => {\n const args = { label: 'label', identifier: 'identifier', type: 'search' };\n\n const page = await getPage(args, slot);\n expect(page.root).toMatchSnapshot();\n });\n\n test.each(['', ' ', undefined])('Should not render with invalid identifier property: %s', async identifier => {\n expect.assertions(1);\n try {\n await getPage({ identifier });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"identifier\" is required.');\n }\n });\n\n test.each(['', ' ', undefined])('Should throw error with invalid label property: %s', async label => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', label });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"label\" is required.');\n }\n });\n\n test('Should throw an error with labelOnTop & labelHide set to true', async () => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', label: 'batman', labelOnTop: true, labelHide: true });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\"');\n }\n });\n\n test.each(['', undefined])('Should throw an error when pattern is used with patternErrorMessage: %s', async value => {\n expect.assertions(1);\n try {\n const { root } = await getPage({ label: 'blu', pattern: '[a-z]*', patternErrorMessage: value });\n expect(root).toMatchSnapshot();\n } catch (err) {\n expect(err.message).toMatch('<mg-input-text> prop \"pattern\" must be paired with the prop \"patternErrorMessage\"');\n }\n });\n\n test('Should trigger events', async () => {\n const inputValue = 'Blu';\n const args = { label: 'label', identifier: 'identifier', helpText: 'My help text' };\n const page = await getPage(args);\n\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => true);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: false,\n patternMismatch: false,\n })),\n });\n\n jest.spyOn(page.rootInstance.valueChange, 'emit');\n\n input.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n expect(page.rootInstance.classCollection.has('is-focused')).toEqual(true);\n\n expect(page.root).toMatchSnapshot(); //Snapshot on focus\n\n input.value = inputValue;\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n expect(page.rootInstance.valueChange.emit).toHaveBeenCalledWith(inputValue);\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n expect(page.rootInstance.classCollection.has('is-focused')).toEqual(false);\n });\n\n describe.each(['readonly', 'disabled'])('validity, case next state is %s', nextState => {\n test.each([\n { validity: true, valueMissing: false, patternMismatch: false },\n { validity: false, valueMissing: true, patternMismatch: false },\n { validity: false, valueMissing: false, patternMismatch: true },\n ])('validity (%s), valueMissing (%s), patternMismatch (%s)', async ({ validity, valueMissing, patternMismatch }) => {\n const args = { label: 'label', identifier: 'identifier', patternErrorMessage: 'Non' };\n const page = await getPage(args);\n\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => validity);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing,\n patternMismatch,\n })),\n });\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n if (validity) {\n expect(page.rootInstance.errorMessage).toBeUndefined();\n } else if (valueMissing) {\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n } else if (patternMismatch) {\n expect(page.rootInstance.errorMessage).toEqual(args.patternErrorMessage);\n }\n expect(page.rootInstance.valid).toEqual(validity);\n expect(page.rootInstance.invalid).toEqual(!validity);\n if (valueMissing) {\n expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled FALSE\n element[nextState] = true;\n await page.waitForChanges();\n expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled TRUE\n }\n });\n\n test(\"should trigger input focus method with setFocus component's public method\", async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier' });\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n input.focus = jest.fn();\n\n await element.setFocus();\n\n await page.waitForChanges();\n\n expect(input.focus).toHaveBeenCalled();\n });\n });\n\n test(\"display error with displayError component's public method\", async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n\n expect(page.root).toMatchSnapshot();\n\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => false);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: true,\n })),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test.each(['fr', 'xx'])('display error message with locale: %s', async lang => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true, lang });\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => false);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: true,\n })),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test('Should remove error on input', async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);\n Object.defineProperty(input, 'validity', {\n get: jest\n .fn()\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n }),\n });\n\n await element.displayError();\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n\n input.value = 'blu';\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n\n // Error message should disapear but we keep the hasDisplayedError status\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n // On blur the hasDisplayedError status change\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n });\n\n test('Should remove error on input when required change dynamically', async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);\n Object.defineProperty(input, 'validity', {\n get: jest\n .fn()\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n }),\n });\n\n await element.displayError();\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n\n element.required = false;\n await page.waitForChanges();\n\n // Error message should disapear and change the hasDisplayedError status\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n\n element.required = true;\n await page.waitForChanges();\n\n // If back on required the message is still not displayed\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n });\n\n test('Should update mg-width', async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier' });\n const element = page.doc.querySelector('mg-input-text');\n\n element.mgWidth = 2;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 4;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 16;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"mg-input-text.spec.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,QAAQ,MAAM,yCAAyC,CAAC;AAE/D,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,OAAQ,EAAE,EAAE;EACjC,MAAM,IAAI,GAAG,WAAW,CAAC;IACvB,UAAU,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC;IAC3C,QAAQ,EAAE,GAAG,EAAE,CAAC,qCAAmB,IAAI,GAAG,OAAO,CAAiB;GACnE,CAAC,CAAC;EAEH,IAAI,CAAC,YAAY,EAAE,CAAC;EAEpB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;EAC7B,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;EACvC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;EAC7C,IAAI,CAAC,IAAI,CAAC;IACR,EAAE,KA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AAC,aAAa,EAAE,CAAC;IAEvD,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IACxB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,yDAAyD;IACzD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,aAAa,EAAE,CAAC;EACzD,CAAC,CAAC,CAAC;EAEH,IAAI,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;IACxC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC;IACzE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IAExD,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC;IACpB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpC,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC;IACpB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;IACrB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;EACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgInputText } from '../mg-input-text';\nimport { MgButton } from '../../../../atoms/mg-button/mg-button';\nimport { MgIcon } from '../../../../atoms/mg-icon/mg-icon';\nimport messages from '../../../../../locales/en/messages.json';\n\nconst getPage = (args, content?) => {\n const page = newSpecPage({\n components: [MgInputText, MgButton, MgIcon],\n template: () => <mg-input-text {...args}>{content}</mg-input-text>,\n });\n\n jest.runAllTimers();\n\n return page;\n};\n\ndescribe('mg-input-text', () => {\n beforeEach(() => jest.useFakeTimers());\n afterEach(() => jest.runOnlyPendingTimers());\n test.each([\n { label: 'label', identifier: 'identifier' },\n { label: 'label', identifier: 'identifier', labelHide: true },\n { label: 'label', identifier: 'identifier', labelOnTop: true },\n { label: 'label', identifier: 'identifier', readonly: true },\n { label: 'label', identifier: 'identifier', type: 'search' },\n { label: 'label', identifier: 'identifier', type: 'search', icon: 'magnifying-glass' },\n { label: 'label', identifier: 'identifier', readonly: true, labelOnTop: true, tooltip: 'Tooltip message' },\n { label: 'label', identifier: 'identifier', readonly: true, value: 'blu' },\n { label: 'label', identifier: 'identifier', required: true, value: 'blu', helpText: 'My help text' },\n { label: 'label', identifier: 'identifier', required: true, readonly: true, value: 'blu', helpText: 'My help text' },\n { label: 'label', identifier: 'identifier', required: true, disabled: true, value: 'blu', helpText: 'My help text' },\n { label: 'label', identifier: 'identifier', tooltip: 'My Tooltip Message' },\n { label: 'label', identifier: 'identifier', tooltip: 'My Tooltip Message', labelOnTop: true },\n { label: 'label', identifier: 'identifier', displayCharacterLeft: false },\n ])('Should render with args %s:', async args => {\n const { root } = await getPage(args);\n expect(root).toMatchSnapshot();\n });\n\n test.each([\n <mg-button slot=\"append-input\" label=\"search\" identifier=\"identifier\">\n <mg-icon icon=\"magnifying-glass\"></mg-icon> Search\n </mg-button>,\n <span slot=\"append-input\">test</span>,\n [\n <mg-button is-icon slot=\"append-input\" label=\"cancel\" identifier=\"identifier-cancel\">\n <mg-icon icon=\"cross\"></mg-icon>\n </mg-button>,\n <mg-button is-icon slot=\"append-input\" label=\"validate\" identifier=\"identifier-validate\">\n <mg-icon icon=\"check\"></mg-icon>\n </mg-button>,\n ],\n ])('Should render with slot.', async slot => {\n const args = { label: 'label', identifier: 'identifier', type: 'search' };\n\n const page = await getPage(args, slot);\n expect(page.root).toMatchSnapshot();\n });\n\n test.each(['', ' ', undefined])('Should not render with invalid identifier property: %s', async identifier => {\n expect.assertions(1);\n try {\n await getPage({ identifier });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"identifier\" is required.');\n }\n });\n\n test.each(['', ' ', undefined])('Should throw error with invalid label property: %s', async label => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', label });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"label\" is required.');\n }\n });\n\n test('Should throw an error with labelOnTop & labelHide set to true', async () => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', label: 'batman', labelOnTop: true, labelHide: true });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\"');\n }\n });\n\n test.each(['', ' ', null, undefined])('Should throw an error when pattern is used with invalid patternErrorMessage: %s', async patternErrorMessage => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', label: 'blu', pattern: '[a-z]*', patternErrorMessage });\n } catch (err) {\n expect(err.message).toMatch('<mg-input-text> props \"pattern\" and \"patternErrorMessage\" must be non-empty string and paired.');\n }\n });\n\n test.each(['', ' ', null, undefined])('Should throw an error when patternErrorMessage is used with invalid pattern: %s', async pattern => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', label: 'blu', pattern, patternErrorMessage: 'pattern error message' });\n } catch (err) {\n expect(err.message).toMatch('<mg-input-text> props \"pattern\" and \"patternErrorMessage\" must be non-empty string and paired.');\n }\n });\n\n test('Should trigger events', async () => {\n const inputValue = 'Blu';\n const args = { label: 'label', identifier: 'identifier', helpText: 'My help text' };\n const page = await getPage(args);\n\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => true);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: false,\n patternMismatch: false,\n })),\n });\n\n jest.spyOn(page.rootInstance.valueChange, 'emit');\n\n input.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n expect(page.rootInstance.classCollection.has('is-focused')).toEqual(true);\n\n expect(page.root).toMatchSnapshot(); //Snapshot on focus\n\n input.value = inputValue;\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n expect(page.rootInstance.valueChange.emit).toHaveBeenCalledWith(inputValue);\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n expect(page.rootInstance.classCollection.has('is-focused')).toEqual(false);\n });\n\n describe.each(['readonly', 'disabled'])('validity, case next state is %s', nextState => {\n test.each([\n { validity: true, valueMissing: false, patternMismatch: false },\n { validity: false, valueMissing: true, patternMismatch: false },\n { validity: false, valueMissing: false, patternMismatch: true },\n ])('validity (%s), valueMissing (%s), patternMismatch (%s)', async ({ validity, valueMissing, patternMismatch }) => {\n const args = { label: 'label', identifier: 'identifier', pattern: '[a-z]*', patternErrorMessage: 'Non' };\n const page = await getPage(args);\n\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => validity);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing,\n patternMismatch,\n })),\n });\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n if (validity) {\n expect(page.rootInstance.errorMessage).toBeUndefined();\n } else if (valueMissing) {\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n } else if (patternMismatch) {\n expect(page.rootInstance.errorMessage).toEqual(args.patternErrorMessage);\n }\n expect(page.rootInstance.valid).toEqual(validity);\n expect(page.rootInstance.invalid).toEqual(!validity);\n if (valueMissing) {\n expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled FALSE\n element[nextState] = true;\n await page.waitForChanges();\n expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled TRUE\n }\n });\n\n test(\"should trigger input focus method with setFocus component's public method\", async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier' });\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n input.focus = jest.fn();\n\n await element.setFocus();\n\n await page.waitForChanges();\n\n expect(input.focus).toHaveBeenCalled();\n });\n });\n\n test(\"display error with displayError component's public method\", async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n\n expect(page.root).toMatchSnapshot();\n\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => false);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: true,\n })),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test.each([\n {\n valid: true,\n errorMessage: 'Override error',\n },\n {\n valid: false,\n errorMessage: 'Override error',\n },\n ])(\"should display override error with setError component's public method\", async params => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n\n expect(page.root).toMatchSnapshot();\n\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n Object.defineProperty(input, 'validity', {\n get: () => ({}),\n });\n\n await element.setError(params.valid, params.errorMessage);\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test.each([\n {\n valid: '',\n errorMessage: 'Override error',\n error: '<mg-input-text> method \"setError()\" param \"valid\" must be a boolean',\n },\n {\n valid: undefined,\n errorMessage: 'Override error',\n error: '<mg-input-text> method \"setError()\" param \"valid\" must be a boolean',\n },\n {\n valid: true,\n errorMessage: ' ',\n error: '<mg-input-text> method \"setError()\" param \"errorMessage\" must be a string',\n },\n {\n valid: true,\n errorMessage: true,\n error: '<mg-input-text> method \"setError()\" param \"errorMessage\" must be a string',\n },\n ])(\"shloud throw error with setError component's public method invalid params\", async params => {\n expect.assertions(1);\n try {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-text');\n\n await element.setError(params.valid as unknown as boolean, params.errorMessage as unknown as string);\n await page.waitForChanges();\n } catch (err) {\n expect(err.message).toMatch(params.error);\n }\n });\n\n test.each(['fr', 'xx'])('display error message with locale: %s', async lang => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true, lang });\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => false);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: true,\n })),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test('Should remove error on input', async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);\n Object.defineProperty(input, 'validity', {\n get: jest\n .fn()\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n }),\n });\n\n await element.displayError();\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n\n input.value = 'blu';\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n\n // Error message should disapear but we keep the hasDisplayedError status\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n // On blur the hasDisplayedError status change\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n });\n\n test('Should remove error on input when required change dynamically', async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-text');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);\n Object.defineProperty(input, 'validity', {\n get: jest\n .fn()\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n }),\n });\n\n await element.displayError();\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n\n element.required = false;\n await page.waitForChanges();\n\n // Error message should disapear and change the hasDisplayedError status\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n\n element.required = true;\n await page.waitForChanges();\n\n // If back on required the message is still not displayed\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n });\n\n test('Should update mg-width', async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier' });\n const element = page.doc.querySelector('mg-input-text');\n\n element.mgWidth = 2;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 4;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 16;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { MgInput } from "../MgInput";
|
|
3
|
-
import { ClassList } from "../../../../utils/components.utils";
|
|
3
|
+
import { ClassList, isValidString } from "../../../../utils/components.utils";
|
|
4
4
|
import { initLocales } from "../../../../locales";
|
|
5
5
|
export class MgInputTextarea {
|
|
6
6
|
constructor() {
|
|
@@ -50,35 +50,27 @@ export class MgInputTextarea {
|
|
|
50
50
|
*/
|
|
51
51
|
this.checkValidity = () => {
|
|
52
52
|
var _a;
|
|
53
|
-
this.
|
|
54
|
-
this.invalid = !this.valid;
|
|
55
|
-
// We need to send valid event even if it is the same value
|
|
56
|
-
this.inputValid.emit(this.valid);
|
|
53
|
+
this.setValidity(this.readonly || this.disabled || (((_a = this.input) === null || _a === void 0 ? void 0 : _a.checkValidity) !== undefined && this.input.checkValidity() && this.getPatternValidity()));
|
|
57
54
|
};
|
|
58
55
|
/**
|
|
59
56
|
* Set input error message
|
|
57
|
+
* @param errorMessage - errorMessage override
|
|
60
58
|
*/
|
|
61
|
-
this.setErrorMessage = () => {
|
|
59
|
+
this.setErrorMessage = (errorMessage) => {
|
|
62
60
|
// Set error message
|
|
63
61
|
this.errorMessage = undefined;
|
|
64
62
|
// Does not match pattern
|
|
65
|
-
if (!this.valid
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.validatePattern = () => {
|
|
77
|
-
if (this.pattern !== undefined &&
|
|
78
|
-
typeof this.pattern === 'string' &&
|
|
79
|
-
this.pattern !== '' &&
|
|
80
|
-
(this.patternErrorMessage === undefined || typeof this.patternErrorMessage !== 'string' || this.patternErrorMessage === '')) {
|
|
81
|
-
throw new Error('<mg-input-textarea> prop "pattern" must be paired with the prop "patternErrorMessage"');
|
|
63
|
+
if (!this.valid) {
|
|
64
|
+
if (errorMessage !== undefined) {
|
|
65
|
+
this.errorMessage = errorMessage;
|
|
66
|
+
}
|
|
67
|
+
else if (!this.getPatternValidity()) {
|
|
68
|
+
this.errorMessage = this.patternErrorMessage;
|
|
69
|
+
}
|
|
70
|
+
// required
|
|
71
|
+
else if (this.input.validity.valueMissing) {
|
|
72
|
+
this.errorMessage = this.messages.errors.required;
|
|
73
|
+
}
|
|
82
74
|
}
|
|
83
75
|
};
|
|
84
76
|
this.value = undefined;
|
|
@@ -119,6 +111,11 @@ export class MgInputTextarea {
|
|
|
119
111
|
}
|
|
120
112
|
}
|
|
121
113
|
}
|
|
114
|
+
validatePattern(newValue) {
|
|
115
|
+
if (newValue !== undefined && !(isValidString(this.pattern) && isValidString(this.patternErrorMessage))) {
|
|
116
|
+
throw new Error('<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
122
119
|
validateDisplayCharacterLeft(newValue) {
|
|
123
120
|
if (newValue) {
|
|
124
121
|
this.classCollection.add(this.classHasDisplayCharacterLeft);
|
|
@@ -128,13 +125,44 @@ export class MgInputTextarea {
|
|
|
128
125
|
}
|
|
129
126
|
}
|
|
130
127
|
/**
|
|
131
|
-
*
|
|
128
|
+
* Display input error if it exists.
|
|
132
129
|
*/
|
|
133
130
|
async displayError() {
|
|
134
131
|
this.checkValidity();
|
|
135
132
|
this.setErrorMessage();
|
|
136
133
|
this.hasDisplayedError = this.invalid;
|
|
137
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Set an error and display a custom error message.
|
|
137
|
+
* This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.
|
|
138
|
+
* It must be paired with an error message to display for the given context.
|
|
139
|
+
* When used to set validity to `false`, you should use this method again to reset the validity to `true`.
|
|
140
|
+
* @param valid - value indicating the validity
|
|
141
|
+
* @param errorMessage - the error message to display
|
|
142
|
+
*/
|
|
143
|
+
async setError(valid, errorMessage) {
|
|
144
|
+
if (typeof valid !== 'boolean') {
|
|
145
|
+
throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean');
|
|
146
|
+
}
|
|
147
|
+
else if (typeof errorMessage !== 'string' || errorMessage.trim() === '') {
|
|
148
|
+
throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string');
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this.setValidity(valid);
|
|
152
|
+
this.setErrorMessage(valid ? undefined : errorMessage);
|
|
153
|
+
this.hasDisplayedError = this.invalid;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Method to set validity values
|
|
158
|
+
* @param newValue - valid new value
|
|
159
|
+
*/
|
|
160
|
+
setValidity(newValue) {
|
|
161
|
+
this.valid = newValue;
|
|
162
|
+
this.invalid = !this.valid;
|
|
163
|
+
// We need to send valid event even if it is the same value
|
|
164
|
+
this.inputValid.emit(this.valid);
|
|
165
|
+
}
|
|
138
166
|
/*************
|
|
139
167
|
* Lifecycle *
|
|
140
168
|
*************/
|
|
@@ -148,7 +176,8 @@ export class MgInputTextarea {
|
|
|
148
176
|
this.characterLeftId = `${this.identifier}-character-left`;
|
|
149
177
|
// Validate
|
|
150
178
|
this.validateDisplayCharacterLeft(this.displayCharacterLeft);
|
|
151
|
-
this.validatePattern();
|
|
179
|
+
this.validatePattern(this.pattern);
|
|
180
|
+
this.validatePattern(this.patternErrorMessage);
|
|
152
181
|
// Check validity when component is ready
|
|
153
182
|
// return a promise to process action only in the FIRST render().
|
|
154
183
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
@@ -614,9 +643,48 @@ export class MgInputTextarea {
|
|
|
614
643
|
"return": "Promise<void>"
|
|
615
644
|
},
|
|
616
645
|
"docs": {
|
|
617
|
-
"text": "
|
|
646
|
+
"text": "Display input error if it exists.",
|
|
618
647
|
"tags": []
|
|
619
648
|
}
|
|
649
|
+
},
|
|
650
|
+
"setError": {
|
|
651
|
+
"complexType": {
|
|
652
|
+
"signature": "(valid: MgInputTextarea['valid'], errorMessage: string) => Promise<void>",
|
|
653
|
+
"parameters": [{
|
|
654
|
+
"tags": [{
|
|
655
|
+
"name": "param",
|
|
656
|
+
"text": "valid - value indicating the validity"
|
|
657
|
+
}],
|
|
658
|
+
"text": "- value indicating the validity"
|
|
659
|
+
}, {
|
|
660
|
+
"tags": [{
|
|
661
|
+
"name": "param",
|
|
662
|
+
"text": "errorMessage - the error message to display"
|
|
663
|
+
}],
|
|
664
|
+
"text": "- the error message to display"
|
|
665
|
+
}],
|
|
666
|
+
"references": {
|
|
667
|
+
"Promise": {
|
|
668
|
+
"location": "global",
|
|
669
|
+
"id": "global::Promise"
|
|
670
|
+
},
|
|
671
|
+
"MgInputTextarea": {
|
|
672
|
+
"location": "global",
|
|
673
|
+
"id": "global::MgInputTextarea"
|
|
674
|
+
}
|
|
675
|
+
},
|
|
676
|
+
"return": "Promise<void>"
|
|
677
|
+
},
|
|
678
|
+
"docs": {
|
|
679
|
+
"text": "Set an error and display a custom error message.\nThis method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\nIt must be paired with an error message to display for the given context.\nWhen used to set validity to `false`, you should use this method again to reset the validity to `true`.",
|
|
680
|
+
"tags": [{
|
|
681
|
+
"name": "param",
|
|
682
|
+
"text": "valid - value indicating the validity"
|
|
683
|
+
}, {
|
|
684
|
+
"name": "param",
|
|
685
|
+
"text": "errorMessage - the error message to display"
|
|
686
|
+
}]
|
|
687
|
+
}
|
|
620
688
|
}
|
|
621
689
|
};
|
|
622
690
|
}
|
|
@@ -634,6 +702,12 @@ export class MgInputTextarea {
|
|
|
634
702
|
}, {
|
|
635
703
|
"propName": "disabled",
|
|
636
704
|
"methodName": "handleValidityChange"
|
|
705
|
+
}, {
|
|
706
|
+
"propName": "pattern",
|
|
707
|
+
"methodName": "validatePattern"
|
|
708
|
+
}, {
|
|
709
|
+
"propName": "patternErrorMessage",
|
|
710
|
+
"methodName": "validatePattern"
|
|
637
711
|
}, {
|
|
638
712
|
"propName": "displayCharacterLeft",
|
|
639
713
|
"methodName": "validateDisplayCharacterLeft"
|
package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-input-textarea.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-textarea/mg-input-textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, h, Prop, EventEmitter, State, Method, Watch } from '@stencil/core';\nimport { MgInput } from '../MgInput';\nimport { Width } from '../MgInput.conf';\nimport { ClassList } from '../../../../utils/components.utils';\nimport { initLocales } from '../../../../locales';\n\n@Component({\n tag: 'mg-input-textarea',\n styleUrl: 'mg-input-textarea.scss',\n shadow: true,\n})\nexport class MgInputTextarea {\n /************\n * Internal *\n ************/\n\n // Classes\n private classFocus = 'is-focused';\n private classHasDisplayCharacterLeft = 'mg-input--has-display-character-left';\n\n // IDs\n private characterLeftId;\n\n // HTML selector\n private input: HTMLTextAreaElement;\n\n // Locales\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputTextareaElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true, reflect: true }) value: string;\n @Watch('value')\n handleValue(newValue: string): void {\n this.checkValidity();\n this.valueChange.emit(newValue);\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n\n /**\n * Input name\n * If not set the value equals the identifier\n */\n @Prop() name: string = this.identifier;\n\n /**\n * Input label\n */\n @Prop() label!: string;\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop: boolean;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Input placeholder.\n * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text.\n */\n @Prop() placeholder: string;\n\n /**\n * Input max length\n */\n @Prop() maxlength = 4000;\n\n /**\n * Define if input is required\n */\n @Prop() required = false;\n\n /**\n * Define if input is readonly\n */\n @Prop() readonly = false;\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n handleValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void {\n if (this.input !== undefined) {\n this.input[prop] = newValue;\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\n }\n\n /**\n * Define input width\n */\n @Prop() mgWidth: Width = 'full';\n\n /**\n * Define input pattern to validate\n */\n @Prop() pattern: string;\n\n /**\n * Define input pattern error message\n */\n @Prop() patternErrorMessage: string;\n\n /**\n * Define the number of visible text lines for the control\n */\n @Prop() rows = 3;\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip: string;\n\n /**\n * Define if component should display character left\n */\n @Prop() displayCharacterLeft = true;\n @Watch('displayCharacterLeft')\n validateDisplayCharacterLeft(newValue: boolean): void {\n if (newValue) {\n this.classCollection.add(this.classHasDisplayCharacterLeft);\n } else {\n this.classCollection.delete(this.classHasDisplayCharacterLeft);\n }\n }\n\n /**\n * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText: string;\n\n /**\n * Define input valid state\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input invalid state\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Define if input is resizable\n */\n @Prop() resizable: 'none' | 'both' | 'horizontal' | 'vertical' = 'none';\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-input--textarea']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<string>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<boolean>;\n\n /**\n * Public method to display errors\n */\n @Method()\n async displayError(): Promise<void> {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n }\n\n /**\n * Handle input event\n */\n private handleInput = (): void => {\n if (this.hasDisplayedError) {\n this.checkValidity();\n this.setErrorMessage();\n }\n this.value = this.input.value;\n };\n\n /**\n * Handle focus event\n */\n private handleFocus = (): void => {\n this.classCollection.add(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n // Manage focus\n this.classCollection.delete(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n // Display Error\n this.displayError();\n };\n\n /**\n * Get pattern validity\n * Pattern is not defined on textarea field: https://developer.mozilla.org/fr/docs/Web/HTML/Element/Textarea\n * @returns is pattern valid\n */\n private getPatternValidity = (): boolean => this.pattern === undefined || new RegExp(`^${this.pattern}$`, 'u').test(this.value);\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.valid = this.readonly || this.disabled || (this.input?.checkValidity !== undefined && this.input.checkValidity() && this.getPatternValidity());\n this.invalid = !this.valid;\n // We need to send valid event even if it is the same value\n this.inputValid.emit(this.valid);\n };\n\n /**\n * Set input error message\n */\n private setErrorMessage = (): void => {\n // Set error message\n this.errorMessage = undefined;\n // Does not match pattern\n if (!this.valid && !this.getPatternValidity()) {\n this.errorMessage = this.patternErrorMessage;\n }\n // required\n else if (!this.valid && this.input.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n };\n\n /**\n * Validate pattern configuration\n */\n private validatePattern = (): void => {\n if (\n this.pattern !== undefined &&\n typeof this.pattern === 'string' &&\n this.pattern !== '' &&\n (this.patternErrorMessage === undefined || typeof this.patternErrorMessage !== 'string' || this.patternErrorMessage === '')\n ) {\n throw new Error('<mg-input-textarea> prop \"pattern\" must be paired with the prop \"patternErrorMessage\"');\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n * @returns timeout\n */\n componentWillLoad(): ReturnType<typeof setTimeout> {\n // Get locales\n this.messages = initLocales(this.element).messages;\n this.characterLeftId = `${this.identifier}-character-left`;\n // Validate\n this.validateDisplayCharacterLeft(this.displayCharacterLeft);\n this.validatePattern();\n // Check validity when component is ready\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n this.checkValidity();\n }, 0);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <MgInput\n identifier={this.identifier}\n classCollection={this.classCollection}\n ariaDescribedbyIDs={[this.characterLeftId]}\n label={this.label}\n labelOnTop={this.labelOnTop}\n labelHide={this.labelHide}\n required={this.required}\n readonly={this.readonly}\n mgWidth={this.mgWidth}\n disabled={this.disabled}\n value={this.value}\n readonlyValue={undefined}\n tooltip={this.tooltip}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n isFieldset={false}\n >\n <div class=\"mg-input__with-character-left\">\n <textarea\n class={{\n 'mg-input__box': true,\n 'mg-input__box--resizable': this.resizable === 'both',\n 'mg-input__box--resizable-horizontal': this.resizable === 'horizontal',\n 'mg-input__box--resizable-vertical': this.resizable === 'vertical',\n }}\n value={this.value}\n id={this.identifier}\n name={this.name}\n placeholder={this.placeholder}\n title={this.placeholder}\n rows={this.rows}\n maxlength={this.maxlength}\n disabled={this.disabled}\n required={this.required}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n ref={(el: HTMLTextAreaElement) => {\n if (el !== null) this.input = el;\n }}\n ></textarea>\n {this.displayCharacterLeft && this.maxlength > 0 && (\n <mg-character-left identifier={this.characterLeftId} characters={this.value} maxlength={this.maxlength}></mg-character-left>\n )}\n </div>\n </MgInput>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mg-input-textarea.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-textarea/mg-input-textarea.tsx"],"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AQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,MAAM,EAAE,IAAI,CAAC,UAAU,EACvB,GAAG,EAAE,CAAC,EAAuB,EAAE,EAAE;YAC/B,IAAI,EAAE,KAAK,IAAI;cAAE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;UACnC,CAAC,GACS;QACX,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAClD,yBAAmB,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,GAAsB,CAC7H,CACG,CACE,CACX,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, h, Prop, EventEmitter, State, Method, Watch } from '@stencil/core';\nimport { MgInput } from '../MgInput';\nimport { Width } from '../MgInput.conf';\nimport { ClassList, isValidString } from '../../../../utils/components.utils';\nimport { initLocales } from '../../../../locales';\n\n@Component({\n tag: 'mg-input-textarea',\n styleUrl: 'mg-input-textarea.scss',\n shadow: true,\n})\nexport class MgInputTextarea {\n /************\n * Internal *\n ************/\n\n // Classes\n private classFocus = 'is-focused';\n private classHasDisplayCharacterLeft = 'mg-input--has-display-character-left';\n\n // IDs\n private characterLeftId;\n\n // HTML selector\n private input: HTMLTextAreaElement;\n\n // Locales\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputTextareaElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true, reflect: true }) value: string;\n @Watch('value')\n handleValue(newValue: string): void {\n this.checkValidity();\n this.valueChange.emit(newValue);\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n\n /**\n * Input name\n * If not set the value equals the identifier\n */\n @Prop() name: string = this.identifier;\n\n /**\n * Input label\n */\n @Prop() label!: string;\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop: boolean;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Input placeholder.\n * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text.\n */\n @Prop() placeholder: string;\n\n /**\n * Input max length\n */\n @Prop() maxlength = 4000;\n\n /**\n * Define if input is required\n */\n @Prop() required = false;\n\n /**\n * Define if input is readonly\n */\n @Prop() readonly = false;\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n handleValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void {\n if (this.input !== undefined) {\n this.input[prop] = newValue;\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\n }\n\n /**\n * Define input width\n */\n @Prop() mgWidth: Width = 'full';\n\n /**\n * Define input pattern to validate\n */\n @Prop() pattern: string;\n\n /**\n * Define input pattern error message\n */\n @Prop() patternErrorMessage: string;\n @Watch('pattern')\n @Watch('patternErrorMessage')\n validatePattern(newValue: string): void {\n if (newValue !== undefined && !(isValidString(this.pattern) && isValidString(this.patternErrorMessage))) {\n throw new Error('<mg-input-textarea> props \"pattern\" and \"patternErrorMessage\" must be non-empty string and paired.');\n }\n }\n\n /**\n * Define the number of visible text lines for the control\n */\n @Prop() rows = 3;\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip: string;\n\n /**\n * Define if component should display character left\n */\n @Prop() displayCharacterLeft = true;\n @Watch('displayCharacterLeft')\n validateDisplayCharacterLeft(newValue: boolean): void {\n if (newValue) {\n this.classCollection.add(this.classHasDisplayCharacterLeft);\n } else {\n this.classCollection.delete(this.classHasDisplayCharacterLeft);\n }\n }\n\n /**\n * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText: string;\n\n /**\n * Define input valid state\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input invalid state\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Define if input is resizable\n */\n @Prop() resizable: 'none' | 'both' | 'horizontal' | 'vertical' = 'none';\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-input--textarea']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<string>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<boolean>;\n\n /**\n * Display input error if it exists.\n */\n @Method()\n async displayError(): Promise<void> {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n }\n\n /**\n * Set an error and display a custom error message.\n * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\n * It must be paired with an error message to display for the given context.\n * When used to set validity to `false`, you should use this method again to reset the validity to `true`.\n * @param valid - value indicating the validity\n * @param errorMessage - the error message to display\n */\n @Method()\n async setError(valid: MgInputTextarea['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-textarea> method \"setError()\" param \"valid\" must be a boolean');\n } else if (typeof errorMessage !== 'string' || errorMessage.trim() === '') {\n throw new Error('<mg-input-textarea> method \"setError()\" param \"errorMessage\" must be a string');\n } else {\n this.setValidity(valid);\n this.setErrorMessage(valid ? undefined : errorMessage);\n this.hasDisplayedError = this.invalid;\n }\n }\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputTextarea['valid']) {\n this.valid = newValue;\n this.invalid = !this.valid;\n // We need to send valid event even if it is the same value\n this.inputValid.emit(this.valid);\n }\n /**\n * Handle input event\n */\n private handleInput = (): void => {\n if (this.hasDisplayedError) {\n this.checkValidity();\n this.setErrorMessage();\n }\n this.value = this.input.value;\n };\n\n /**\n * Handle focus event\n */\n private handleFocus = (): void => {\n this.classCollection.add(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n // Manage focus\n this.classCollection.delete(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n // Display Error\n this.displayError();\n };\n\n /**\n * Get pattern validity\n * Pattern is not defined on textarea field: https://developer.mozilla.org/fr/docs/Web/HTML/Element/Textarea\n * @returns is pattern valid\n */\n private getPatternValidity = (): boolean => this.pattern === undefined || new RegExp(`^${this.pattern}$`, 'u').test(this.value);\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(this.readonly || this.disabled || (this.input?.checkValidity !== undefined && this.input.checkValidity() && this.getPatternValidity()));\n };\n\n /**\n * Set input error message\n * @param errorMessage - errorMessage override\n */\n private setErrorMessage = (errorMessage?: string): void => {\n // Set error message\n this.errorMessage = undefined;\n // Does not match pattern\n if (!this.valid) {\n if (errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n } else if (!this.getPatternValidity()) {\n this.errorMessage = this.patternErrorMessage;\n }\n // required\n else if (this.input.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n * @returns timeout\n */\n componentWillLoad(): ReturnType<typeof setTimeout> {\n // Get locales\n this.messages = initLocales(this.element).messages;\n this.characterLeftId = `${this.identifier}-character-left`;\n // Validate\n this.validateDisplayCharacterLeft(this.displayCharacterLeft);\n this.validatePattern(this.pattern);\n this.validatePattern(this.patternErrorMessage);\n // Check validity when component is ready\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n this.checkValidity();\n }, 0);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <MgInput\n identifier={this.identifier}\n classCollection={this.classCollection}\n ariaDescribedbyIDs={[this.characterLeftId]}\n label={this.label}\n labelOnTop={this.labelOnTop}\n labelHide={this.labelHide}\n required={this.required}\n readonly={this.readonly}\n mgWidth={this.mgWidth}\n disabled={this.disabled}\n value={this.value}\n readonlyValue={undefined}\n tooltip={this.tooltip}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n isFieldset={false}\n >\n <div class=\"mg-input__with-character-left\">\n <textarea\n class={{\n 'mg-input__box': true,\n 'mg-input__box--resizable': this.resizable === 'both',\n 'mg-input__box--resizable-horizontal': this.resizable === 'horizontal',\n 'mg-input__box--resizable-vertical': this.resizable === 'vertical',\n }}\n value={this.value}\n id={this.identifier}\n name={this.name}\n placeholder={this.placeholder}\n title={this.placeholder}\n rows={this.rows}\n maxlength={this.maxlength}\n disabled={this.disabled}\n required={this.required}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n ref={(el: HTMLTextAreaElement) => {\n if (el !== null) this.input = el;\n }}\n ></textarea>\n {this.displayCharacterLeft && this.maxlength > 0 && (\n <mg-character-left identifier={this.characterLeftId} characters={this.value} maxlength={this.maxlength}></mg-character-left>\n )}\n </div>\n </MgInput>\n );\n }\n}\n"]}
|
package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js
CHANGED
|
@@ -60,14 +60,22 @@ describe('mg-input-textarea', () => {
|
|
|
60
60
|
expect(err.message).toMatch('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide"');
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
|
-
test.each(['', undefined])('Should throw an error when pattern is used with patternErrorMessage: %s', async (
|
|
63
|
+
test.each(['', ' ', null, undefined])('Should throw an error when pattern is used with patternErrorMessage: %s', async (patternErrorMessage) => {
|
|
64
64
|
expect.assertions(1);
|
|
65
65
|
try {
|
|
66
|
-
|
|
67
|
-
expect(root).toMatchSnapshot();
|
|
66
|
+
await getPage({ identifier: 'identifier', label: 'blu', pattern: '[a-z]*', patternErrorMessage });
|
|
68
67
|
}
|
|
69
68
|
catch (err) {
|
|
70
|
-
expect(err.message).toMatch('<mg-input-textarea>
|
|
69
|
+
expect(err.message).toMatch('<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
test.each(['', ' ', null, undefined])('Should throw an error when patternErrorMessage is used with invalid pattern: %s', async (pattern) => {
|
|
73
|
+
expect.assertions(1);
|
|
74
|
+
try {
|
|
75
|
+
await getPage({ identifier: 'identifier', label: 'blu', pattern, patternErrorMessage: 'pattern error message' });
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
expect(err.message).toMatch('<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
71
79
|
}
|
|
72
80
|
});
|
|
73
81
|
test('Should trigger events', async () => {
|
|
@@ -150,6 +158,61 @@ describe('mg-input-textarea', () => {
|
|
|
150
158
|
await page.waitForChanges();
|
|
151
159
|
expect(page.root).toMatchSnapshot();
|
|
152
160
|
});
|
|
161
|
+
test.each([
|
|
162
|
+
{
|
|
163
|
+
valid: true,
|
|
164
|
+
errorMessage: 'Override error',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
valid: false,
|
|
168
|
+
errorMessage: 'Override error',
|
|
169
|
+
},
|
|
170
|
+
])("should display override error with setError component's public method", async (params) => {
|
|
171
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
172
|
+
expect(page.root).toMatchSnapshot();
|
|
173
|
+
const element = page.doc.querySelector('mg-input-textarea');
|
|
174
|
+
const input = element.shadowRoot.querySelector('textarea');
|
|
175
|
+
//mock validity
|
|
176
|
+
Object.defineProperty(input, 'validity', {
|
|
177
|
+
get: () => ({}),
|
|
178
|
+
});
|
|
179
|
+
await element.setError(params.valid, params.errorMessage);
|
|
180
|
+
await page.waitForChanges();
|
|
181
|
+
expect(page.root).toMatchSnapshot();
|
|
182
|
+
});
|
|
183
|
+
test.each([
|
|
184
|
+
{
|
|
185
|
+
valid: '',
|
|
186
|
+
errorMessage: 'Override error',
|
|
187
|
+
error: '<mg-input-textarea> method "setError()" param "valid" must be a boolean',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
valid: undefined,
|
|
191
|
+
errorMessage: 'Override error',
|
|
192
|
+
error: '<mg-input-textarea> method "setError()" param "valid" must be a boolean',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
valid: true,
|
|
196
|
+
errorMessage: ' ',
|
|
197
|
+
error: '<mg-input-textarea> method "setError()" param "errorMessage" must be a string',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
valid: true,
|
|
201
|
+
errorMessage: true,
|
|
202
|
+
error: '<mg-input-textarea> method "setError()" param "errorMessage" must be a string',
|
|
203
|
+
},
|
|
204
|
+
])("shloud throw error with setError component's public method invalid params", async (params) => {
|
|
205
|
+
expect.assertions(1);
|
|
206
|
+
try {
|
|
207
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
208
|
+
const element = page.doc.querySelector('mg-input-textarea');
|
|
209
|
+
await element.setError(params.valid, params.errorMessage);
|
|
210
|
+
await page.waitForChanges();
|
|
211
|
+
}
|
|
212
|
+
catch (err) {
|
|
213
|
+
expect(err.message).toMatch(params.error);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
153
216
|
test.each(['fr', 'xx'])('display error message with locale: %s', async (lang) => {
|
|
154
217
|
const page = await getPage({ label: 'label', identifier: 'identifier', required: true, lang });
|
|
155
218
|
const element = page.doc.querySelector('mg-input-textarea');
|