@capillarytech/creatives-library 9.2.2-alpha.sprint-cap-214249.44 → 9.2.3
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/constants/unified.js +0 -3
- package/package.json +1 -1
- package/translations/en.json +0 -1
- package/translations/ja-JP.json +0 -1
- package/translations/zh.json +0 -1
- package/utils/tagValidations.js +4 -35
- package/utils/tests/tagValidations.test.js +0 -48
- package/v2Components/CapTagList/index.js +7 -46
- package/v2Components/CapTagList/messages.js +0 -44
- package/v2Components/CapTagList/style.scss +1 -113
- package/v2Components/FormBuilder/Classic.js +14 -24
- package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +0 -1
- package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +1 -1
- package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +0 -57
- package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +4 -4
- package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +0 -3
- package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +0 -5
- package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +0 -6
- package/v2Components/FormBuilder/Functional/channels/sms/validate.js +1 -3
- package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +0 -3
- package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +0 -22
- package/v2Containers/Cap/messages.js +0 -4
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
- package/v2Containers/InApp/index.js +1 -4
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +0 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +0 -2
- package/v2Containers/Line/Container/Text/index.js +1 -3
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +0 -16
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +0 -18
- package/v2Containers/MobilePushNew/index.js +1 -4
- package/v2Containers/Rcs/index.js +1 -8
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -59
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
- package/v2Containers/SmsTrai/Edit/index.js +5 -13
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +0 -15
- package/v2Containers/Viber/index.js +1 -3
- package/v2Containers/WebPush/Create/utils/validation.js +0 -6
- package/v2Containers/WebPush/Create/utils/validation.test.js +0 -50
- package/v2Containers/Whatsapp/index.js +5 -9
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Zalo/index.js +1 -4
- package/v2Components/CapTagList/TagFallbackPanel.js +0 -124
- package/v2Components/CapTagList/constants.js +0 -5
- package/v2Components/CapTagList/tests/TagFallback.test.js +0 -222
- package/v2Components/CapTagList/utils.js +0 -17
|
@@ -341,7 +341,6 @@ exports[`Creatives SmsTraiEdit test/> should render 1`] = `
|
|
|
341
341
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
342
342
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
343
343
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
344
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
345
344
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
346
345
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
347
346
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -3824,7 +3823,6 @@ FREE GIFTS-
|
|
|
3824
3823
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
3825
3824
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
3826
3825
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
3827
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
3828
3826
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
3829
3827
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
3830
3828
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -6074,7 +6072,6 @@ new message content.",
|
|
|
6074
6072
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
6075
6073
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
6076
6074
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
6077
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
6078
6075
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
6079
6076
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
6080
6077
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -13184,7 +13181,6 @@ FREE GIFTS-
|
|
|
13184
13181
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
13185
13182
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
13186
13183
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
13187
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
13188
13184
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
13189
13185
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
13190
13186
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -15527,7 +15523,6 @@ FREE GIFTS-
|
|
|
15527
15523
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
15528
15524
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
15529
15525
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
15530
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
15531
15526
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
15532
15527
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
15533
15528
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -18019,7 +18014,6 @@ exports[`Creatives SmsTraiEdit test/> should render 2`] = `
|
|
|
18019
18014
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
18020
18015
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
18021
18016
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
18022
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
18023
18017
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
18024
18018
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
18025
18019
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -21994,7 +21988,6 @@ FREE GIFTS-
|
|
|
21994
21988
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
21995
21989
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
21996
21990
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
21997
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
21998
21991
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
21999
21992
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
22000
21993
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -24244,7 +24237,6 @@ new message content.",
|
|
|
24244
24237
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
24245
24238
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
24246
24239
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
24247
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
24248
24240
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
24249
24241
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
24250
24242
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -32326,7 +32318,6 @@ FREE GIFTS-
|
|
|
32326
32318
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
32327
32319
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
32328
32320
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
32329
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
32330
32321
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
32331
32322
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
32332
32323
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -34669,7 +34660,6 @@ FREE GIFTS-
|
|
|
34669
34660
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
34670
34661
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
34671
34662
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
34672
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
34673
34663
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
34674
34664
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
34675
34665
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -37161,7 +37151,6 @@ exports[`Creatives SmsTraiEdit test/> should save 1`] = `
|
|
|
37161
37151
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
37162
37152
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
37163
37153
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
37164
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
37165
37154
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
37166
37155
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
37167
37156
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -40644,7 +40633,6 @@ FREE GIFTS-
|
|
|
40644
40633
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
40645
40634
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
40646
40635
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
40647
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
40648
40636
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
40649
40637
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
40650
40638
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -42894,7 +42882,6 @@ new message content.",
|
|
|
42894
42882
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
42895
42883
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
42896
42884
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
42897
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
42898
42885
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
42899
42886
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
42900
42887
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -50004,7 +49991,6 @@ FREE GIFTS-
|
|
|
50004
49991
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
50005
49992
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
50006
49993
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
50007
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
50008
49994
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
50009
49995
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
50010
49996
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -52347,7 +52333,6 @@ FREE GIFTS-
|
|
|
52347
52333
|
"creatives.componentsV2.TopBar.profile": "Profile",
|
|
52348
52334
|
"creatives.componentsV2.TopBar.settings": "Settings",
|
|
52349
52335
|
"creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
|
|
52350
|
-
"creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
|
|
52351
52336
|
"creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
|
|
52352
52337
|
"creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
|
|
52353
52338
|
"creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
|
|
@@ -347,7 +347,7 @@ export const Viber = (props) => {
|
|
|
347
347
|
// validation on Text area and tags validation
|
|
348
348
|
const updateTextContentError = (value) => {
|
|
349
349
|
let errorMessage = false;
|
|
350
|
-
const { valid, isBraceError
|
|
350
|
+
const { valid, isBraceError } = validateTags({
|
|
351
351
|
content: value,
|
|
352
352
|
tagsParam: tags,
|
|
353
353
|
location,
|
|
@@ -360,8 +360,6 @@ export const Viber = (props) => {
|
|
|
360
360
|
errorMessage = formatMessage(messages.limitExceededContentErrorMessage);
|
|
361
361
|
} else if (isBraceError) {
|
|
362
362
|
errorMessage = formatMessage(globalMessages.unbalanacedCurlyBraces);
|
|
363
|
-
} else if (isDefaultQuoteError) {
|
|
364
|
-
errorMessage = formatMessage(globalMessages.unquotedTagDefaultValue);
|
|
365
363
|
} else if (!valid) {
|
|
366
364
|
errorMessage = formatMessage(messages.invalidTagError);
|
|
367
365
|
}
|
|
@@ -37,9 +37,6 @@ export const validateTitle = (value, formatMessage, messages, restrictPersonaliz
|
|
|
37
37
|
if (validationResponse?.isBraceError) {
|
|
38
38
|
return formatMessage(globalMessages.unbalanacedCurlyBraces);
|
|
39
39
|
}
|
|
40
|
-
if (validationResponse?.isDefaultQuoteError) {
|
|
41
|
-
return formatMessage(globalMessages.unquotedTagDefaultValue);
|
|
42
|
-
}
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
return '';
|
|
@@ -86,9 +83,6 @@ export const validateMessageContent = (value, formatMessage, messages, validatio
|
|
|
86
83
|
if (validationResponse?.isBraceError) {
|
|
87
84
|
return formatMessage(globalMessages.unbalanacedCurlyBraces);
|
|
88
85
|
}
|
|
89
|
-
if (validationResponse?.isDefaultQuoteError) {
|
|
90
|
-
return formatMessage(globalMessages.unquotedTagDefaultValue);
|
|
91
|
-
}
|
|
92
86
|
|
|
93
87
|
if (restrictPersonalization && hasPersonalizationTags(value)) {
|
|
94
88
|
return formatMessage(messages.personalizationTokensErrorMessage);
|
|
@@ -24,9 +24,6 @@ jest.mock('../../../Cap/messages', () => ({
|
|
|
24
24
|
unbalanacedCurlyBraces: {
|
|
25
25
|
defaultMessage: 'Unbalanced curly braces',
|
|
26
26
|
},
|
|
27
|
-
unquotedTagDefaultValue: {
|
|
28
|
-
defaultMessage: 'Default value must be within quotes',
|
|
29
|
-
},
|
|
30
27
|
}));
|
|
31
28
|
|
|
32
29
|
import { validateTags } from '../../../../utils/tagValidations';
|
|
@@ -151,27 +148,6 @@ describe('validation', () => {
|
|
|
151
148
|
});
|
|
152
149
|
});
|
|
153
150
|
|
|
154
|
-
it('should return default quote error when validateTags returns isDefaultQuoteError', () => {
|
|
155
|
-
validateTags.mockReturnValue({ isBraceError: false, isDefaultQuoteError: true });
|
|
156
|
-
const result = validateTitle('{{name | default: x}}', mockFormatMessage, mockMessages, false, {}, false);
|
|
157
|
-
expect(result).toBe('Default value must be within quotes');
|
|
158
|
-
expect(mockFormatMessage).toHaveBeenCalledWith(globalMessages.unquotedTagDefaultValue);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('should prefer brace error over default quote error', () => {
|
|
162
|
-
validateTags.mockReturnValue({ isBraceError: true, isDefaultQuoteError: true });
|
|
163
|
-
const result = validateTitle('{{name', mockFormatMessage, mockMessages, false, {}, false);
|
|
164
|
-
expect(result).toBe('Unbalanced curly braces');
|
|
165
|
-
expect(mockFormatMessage).not.toHaveBeenCalledWith(globalMessages.unquotedTagDefaultValue);
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('should return empty when validateTags has no errors or returns null/undefined', () => {
|
|
169
|
-
[{ isBraceError: false, isDefaultQuoteError: false }, null, undefined].forEach((response) => {
|
|
170
|
-
validateTags.mockReturnValue(response);
|
|
171
|
-
expect(validateTitle('Valid Title', mockFormatMessage, mockMessages, false, {}, false)).toBe('');
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
|
|
175
151
|
it('should not run tag validation when validationConfig is null', () => {
|
|
176
152
|
validateTags.mockClear();
|
|
177
153
|
const result = validateTitle('Valid Title', mockFormatMessage, mockMessages, false, null);
|
|
@@ -290,32 +266,6 @@ describe('validation', () => {
|
|
|
290
266
|
expect(mockFormatMessage).toHaveBeenCalledWith(globalMessages.unbalanacedCurlyBraces);
|
|
291
267
|
});
|
|
292
268
|
|
|
293
|
-
it('should return default quote error when validateTags returns isDefaultQuoteError', () => {
|
|
294
|
-
validateTags.mockReturnValue({ isBraceError: false, isDefaultQuoteError: true });
|
|
295
|
-
const result = validateMessageContent('{{name | default: x}}', mockFormatMessage, mockMessages, mockValidationConfig);
|
|
296
|
-
expect(result).toBe('Default value must be within quotes');
|
|
297
|
-
expect(mockFormatMessage).toHaveBeenCalledWith(globalMessages.unquotedTagDefaultValue);
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
it('should prefer brace error over default quote error', () => {
|
|
301
|
-
validateTags.mockReturnValue({ isBraceError: true, isDefaultQuoteError: true });
|
|
302
|
-
const result = validateMessageContent('{{name', mockFormatMessage, mockMessages, mockValidationConfig);
|
|
303
|
-
expect(result).toBe('Unbalanced curly braces');
|
|
304
|
-
expect(mockFormatMessage).not.toHaveBeenCalledWith(globalMessages.unquotedTagDefaultValue);
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
it('should return default quote error before personalization error', () => {
|
|
308
|
-
validateTags.mockReturnValue({ isDefaultQuoteError: true });
|
|
309
|
-
const result = validateMessageContent('{{first_name | default: x}}', mockFormatMessage, mockMessages, mockValidationConfig, false, true);
|
|
310
|
-
expect(result).toBe('Default value must be within quotes');
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
it('should return empty when isDefaultQuoteError is false', () => {
|
|
314
|
-
validateTags.mockReturnValue({ isBraceError: false, isDefaultQuoteError: false });
|
|
315
|
-
const result = validateMessageContent('Valid message', mockFormatMessage, mockMessages, mockValidationConfig);
|
|
316
|
-
expect(result).toBe('');
|
|
317
|
-
});
|
|
318
|
-
|
|
319
269
|
it('should pass validation config to validateTags', () => {
|
|
320
270
|
const customConfig = {
|
|
321
271
|
tagsParam: [{ id: 1, name: 'Tag1' }],
|
|
@@ -637,18 +637,17 @@ export const Whatsapp = (props) => {
|
|
|
637
637
|
tagModule: getDefaultTags,
|
|
638
638
|
isFullMode,
|
|
639
639
|
}) || {};
|
|
640
|
-
const hasTagSyntaxError = !!(validationResponse.isBraceError || validationResponse.isDefaultQuoteError);
|
|
641
640
|
if (type === HEADER_TEXT) {
|
|
642
641
|
headerTagValidationResponse = validationResponse;
|
|
643
|
-
updateIsHeaderTagValidationError(
|
|
642
|
+
updateIsHeaderTagValidationError(validationResponse.isBraceError);
|
|
644
643
|
} else if (type === CAROUSEL_TEXT) {
|
|
645
644
|
return [
|
|
646
|
-
{ fieldName: "carouselTagValidationErrMessage", value:
|
|
647
|
-
{ fieldName: "carouselTagValidationErr", value:
|
|
645
|
+
{ fieldName: "carouselTagValidationErrMessage", value: validationResponse.isBraceError ? validationResponse : {} },
|
|
646
|
+
{ fieldName: "carouselTagValidationErr", value: validationResponse.isBraceError },
|
|
648
647
|
];
|
|
649
648
|
} else {
|
|
650
649
|
tagValidationResponse = validationResponse;
|
|
651
|
-
updateIsTagValidationError(
|
|
650
|
+
updateIsTagValidationError(validationResponse.isBraceError);
|
|
652
651
|
}
|
|
653
652
|
}
|
|
654
653
|
};
|
|
@@ -2838,13 +2837,10 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2838
2837
|
} else {
|
|
2839
2838
|
validationResponse = tagValidationResponse;
|
|
2840
2839
|
}
|
|
2841
|
-
const { isBraceError
|
|
2840
|
+
const { isBraceError } = validationResponse || {};
|
|
2842
2841
|
if (isBraceError) {
|
|
2843
2842
|
return <CapError>{formatMessage(globalMessages.unbalanacedCurlyBraces)}</CapError>;
|
|
2844
2843
|
}
|
|
2845
|
-
if (isDefaultQuoteError) {
|
|
2846
|
-
return <CapError>{formatMessage(globalMessages.unquotedTagDefaultValue)}</CapError>;
|
|
2847
|
-
}
|
|
2848
2844
|
return null;
|
|
2849
2845
|
};
|
|
2850
2846
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 57295127 bytes
|
|
4
|
+
sha256: 3ca4752bd0410b9d7f0e57070855228ef817cc04531f23794bf27e2647b4f7a2
|
|
@@ -281,13 +281,10 @@ export const Zalo = (props) => {
|
|
|
281
281
|
tagModule: getDefaultTags,
|
|
282
282
|
isFullMode,
|
|
283
283
|
}) || {};
|
|
284
|
-
const { isBraceError
|
|
284
|
+
const { isBraceError } = tagValidationResponse;
|
|
285
285
|
if (isBraceError) {
|
|
286
286
|
return formatMessage(globalMessages.unbalanacedCurlyBraces);
|
|
287
287
|
}
|
|
288
|
-
if (isDefaultQuoteError) {
|
|
289
|
-
return formatMessage(globalMessages.unquotedTagDefaultValue);
|
|
290
|
-
}
|
|
291
288
|
return '';
|
|
292
289
|
};
|
|
293
290
|
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TagFallbackPanel
|
|
3
|
-
*
|
|
4
|
-
* Shown in the tag list after a tag is clicked, to choose what is sent when the tag has no value.
|
|
5
|
-
*/
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import CapButton from '@capillarytech/cap-ui-library/CapButton';
|
|
9
|
-
import CapHeading from '@capillarytech/cap-ui-library/CapHeading';
|
|
10
|
-
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
11
|
-
import CapInput from '@capillarytech/cap-ui-library/CapInput';
|
|
12
|
-
import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
|
|
13
|
-
import CapRadio from '@capillarytech/cap-ui-library/CapRadio';
|
|
14
|
-
import CapRadioGroup from '@capillarytech/cap-ui-library/CapRadioGroup';
|
|
15
|
-
import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
16
|
-
import { injectIntl, intlShape } from 'react-intl';
|
|
17
|
-
import messages from './messages';
|
|
18
|
-
import { FALLBACK_OPTIONS } from './constants';
|
|
19
|
-
import { buildTagWithFallback, isValidFallbackValue } from './utils';
|
|
20
|
-
|
|
21
|
-
export class TagFallbackPanel extends React.Component {
|
|
22
|
-
constructor(props) {
|
|
23
|
-
super(props);
|
|
24
|
-
this.state = {
|
|
25
|
-
option: FALLBACK_OPTIONS.NONE,
|
|
26
|
-
fallbackValue: '',
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
onOptionChange = (e) => {
|
|
31
|
-
this.setState({ option: e.target.value });
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
onFallbackValueChange = (e) => {
|
|
35
|
-
this.setState({ fallbackValue: e.target.value });
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
getTagValue = () => {
|
|
39
|
-
const { option, fallbackValue } = this.state;
|
|
40
|
-
return buildTagWithFallback(this.props.tagKey, option, fallbackValue);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
copyTag = () => {
|
|
44
|
-
navigator?.clipboard?.writeText(`{{${this.getTagValue()}}}`);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
onInsert = () => {
|
|
48
|
-
this.props.onInsert(this.getTagValue());
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
render() {
|
|
52
|
-
const {
|
|
53
|
-
intl: { formatMessage }, tagName, parentName, onBack,
|
|
54
|
-
} = this.props;
|
|
55
|
-
const { option, fallbackValue } = this.state;
|
|
56
|
-
const isCustomValue = option === FALLBACK_OPTIONS.CUSTOM_VALUE;
|
|
57
|
-
const isFallbackValueInvalid = isCustomValue && !isValidFallbackValue(fallbackValue);
|
|
58
|
-
const isInsertDisabled = isCustomValue && (!fallbackValue.trim() || isFallbackValueInvalid);
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<CapRow className="tag-fallback-panel">
|
|
62
|
-
<CapRow className="tag-fallback-header">
|
|
63
|
-
<CapRow type="flex" align="middle" noWrap className="tag-fallback-title-row">
|
|
64
|
-
<CapIcon
|
|
65
|
-
type="back"
|
|
66
|
-
size="m"
|
|
67
|
-
className="tag-fallback-back"
|
|
68
|
-
aria-label={formatMessage(messages.back)}
|
|
69
|
-
onClick={onBack}
|
|
70
|
-
/>
|
|
71
|
-
<CapHeading type="h4" className="tag-fallback-tag-name">{tagName}</CapHeading>
|
|
72
|
-
</CapRow>
|
|
73
|
-
{parentName ? <CapLabel type="label2" className="tag-fallback-group-name">{parentName}</CapLabel> : null}
|
|
74
|
-
</CapRow>
|
|
75
|
-
<CapRow className="tag-fallback-body">
|
|
76
|
-
<CapHeading type="h4" className="tag-fallback-heading">{formatMessage(messages.fallbackBehaviour)}</CapHeading>
|
|
77
|
-
<CapLabel type="label2" className="tag-fallback-subtext">{formatMessage(messages.fallbackBehaviourDesc)}</CapLabel>
|
|
78
|
-
<CapRadioGroup className="tag-fallback-options" value={option} onChange={this.onOptionChange}>
|
|
79
|
-
<CapRadio value={FALLBACK_OPTIONS.NONE}>{formatMessage(messages.dontSendMessage)}</CapRadio>
|
|
80
|
-
<CapRadio value={FALLBACK_OPTIONS.NULL_VALUE}>{formatMessage(messages.sendWithNullValue)}</CapRadio>
|
|
81
|
-
<CapRadio value={FALLBACK_OPTIONS.CUSTOM_VALUE}>{formatMessage(messages.fallbackValue)}</CapRadio>
|
|
82
|
-
</CapRadioGroup>
|
|
83
|
-
{isCustomValue && (
|
|
84
|
-
<CapInput
|
|
85
|
-
className="tag-fallback-input"
|
|
86
|
-
value={fallbackValue}
|
|
87
|
-
onChange={this.onFallbackValueChange}
|
|
88
|
-
placeholder={formatMessage(messages.fallbackValuePlaceholder)}
|
|
89
|
-
errorMessage={isFallbackValueInvalid ? formatMessage(messages.fallbackValueInvalid) : ''}
|
|
90
|
-
size="default"
|
|
91
|
-
/>
|
|
92
|
-
)}
|
|
93
|
-
<CapLabel type="label2" className="tag-fallback-preview-label">{formatMessage(messages.addsToMessageAs)}</CapLabel>
|
|
94
|
-
<CapRow type="flex" align="middle" noWrap className="tag-fallback-preview-row">
|
|
95
|
-
<CapLabel className="tag-fallback-preview">{`{{${this.getTagValue()}}}`}</CapLabel>
|
|
96
|
-
<CapIcon
|
|
97
|
-
type="copy"
|
|
98
|
-
size="m"
|
|
99
|
-
className="tag-fallback-copy"
|
|
100
|
-
aria-label={formatMessage(messages.copy)}
|
|
101
|
-
onClick={this.copyTag}
|
|
102
|
-
/>
|
|
103
|
-
</CapRow>
|
|
104
|
-
</CapRow>
|
|
105
|
-
<CapRow type="flex" justify="end" className="tag-fallback-footer">
|
|
106
|
-
<CapButton type="primary" disabled={isInsertDisabled} onClick={this.onInsert}>
|
|
107
|
-
{formatMessage(messages.insertTag)}
|
|
108
|
-
</CapButton>
|
|
109
|
-
</CapRow>
|
|
110
|
-
</CapRow>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
TagFallbackPanel.propTypes = {
|
|
116
|
-
intl: intlShape.isRequired,
|
|
117
|
-
tagKey: PropTypes.string.isRequired,
|
|
118
|
-
tagName: PropTypes.node,
|
|
119
|
-
parentName: PropTypes.node,
|
|
120
|
-
onBack: PropTypes.func.isRequired,
|
|
121
|
-
onInsert: PropTypes.func.isRequired,
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export default injectIntl(TagFallbackPanel);
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen, fireEvent, act } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
import { IntlProvider } from 'react-intl';
|
|
5
|
-
import TagFallbackPanel from '../TagFallbackPanel';
|
|
6
|
-
import { CapTagList } from '../index';
|
|
7
|
-
import { FALLBACK_OPTIONS } from '../constants';
|
|
8
|
-
import { buildTagWithFallback, isValidFallbackValue } from '../utils';
|
|
9
|
-
|
|
10
|
-
describe('buildTagWithFallback', () => {
|
|
11
|
-
it('returns tag as it is for NONE', () => {
|
|
12
|
-
expect(buildTagWithFallback('badge_description', FALLBACK_OPTIONS.NONE)).toBe('badge_description');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('adds empty default for NULL_VALUE', () => {
|
|
16
|
-
expect(buildTagWithFallback('badge_description', FALLBACK_OPTIONS.NULL_VALUE)).toBe("badge_description | default: ''");
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('adds trimmed fallback value for CUSTOM_VALUE', () => {
|
|
20
|
-
expect(buildTagWithFallback('badge_description', FALLBACK_OPTIONS.CUSTOM_VALUE, ' Gold ')).toBe("badge_description | default: 'Gold'");
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('wraps value in double quotes when it has a single quote', () => {
|
|
24
|
-
expect(buildTagWithFallback('name', FALLBACK_OPTIONS.CUSTOM_VALUE, "member's")).toBe('name | default: "member\'s"');
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('isValidFallbackValue', () => {
|
|
29
|
-
it('rejects braces and values having both quote types', () => {
|
|
30
|
-
expect(isValidFallbackValue('Gold')).toBe(true);
|
|
31
|
-
expect(isValidFallbackValue("member's")).toBe(true);
|
|
32
|
-
expect(isValidFallbackValue('a}b')).toBe(false);
|
|
33
|
-
expect(isValidFallbackValue('{a')).toBe(false);
|
|
34
|
-
expect(isValidFallbackValue(`it's "x"`)).toBe(false);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('treats a missing value as valid (defaults to empty string)', () => {
|
|
38
|
-
expect(isValidFallbackValue()).toBe(true);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe('TagFallbackPanel', () => {
|
|
43
|
-
const renderPanel = (props = {}) => {
|
|
44
|
-
const onInsert = jest.fn();
|
|
45
|
-
const onBack = jest.fn();
|
|
46
|
-
render(
|
|
47
|
-
<IntlProvider locale="en">
|
|
48
|
-
<TagFallbackPanel
|
|
49
|
-
tagKey="badge_description"
|
|
50
|
-
tagName="Badge description"
|
|
51
|
-
parentName="Badge"
|
|
52
|
-
onBack={onBack}
|
|
53
|
-
onInsert={onInsert}
|
|
54
|
-
{...props}
|
|
55
|
-
/>
|
|
56
|
-
</IntlProvider>
|
|
57
|
-
);
|
|
58
|
-
return { onInsert, onBack };
|
|
59
|
-
};
|
|
60
|
-
const insertButton = () => screen.getByText('Insert tag').closest('button');
|
|
61
|
-
|
|
62
|
-
it('shows tag and parent name with "Don’t send message" selected by default', () => {
|
|
63
|
-
renderPanel();
|
|
64
|
-
expect(screen.getByText('Badge description')).toBeInTheDocument();
|
|
65
|
-
expect(screen.getByText('Badge')).toBeInTheDocument();
|
|
66
|
-
expect(screen.getByLabelText('Don’t send message')).toBeChecked();
|
|
67
|
-
expect(screen.getByText('{{badge_description}}')).toBeInTheDocument();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('does not render the group name when parentName is not passed', () => {
|
|
71
|
-
renderPanel({ parentName: undefined });
|
|
72
|
-
expect(screen.getByText('Badge description')).toBeInTheDocument();
|
|
73
|
-
expect(screen.queryByText('Badge')).toBeNull();
|
|
74
|
-
expect(document.querySelector('.tag-fallback-group-name')).toBeNull();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('does not throw on copy when clipboard is not available', () => {
|
|
78
|
-
Object.assign(navigator, { clipboard: undefined });
|
|
79
|
-
renderPanel();
|
|
80
|
-
expect(() => fireEvent.click(screen.getByLabelText('Copy'))).not.toThrow();
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('inserts tag as it is by default', () => {
|
|
84
|
-
const { onInsert } = renderPanel();
|
|
85
|
-
fireEvent.click(insertButton());
|
|
86
|
-
expect(onInsert).toHaveBeenCalledWith('badge_description');
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('inserts tag with empty default for "Send with null value"', () => {
|
|
90
|
-
const { onInsert } = renderPanel();
|
|
91
|
-
fireEvent.click(screen.getByLabelText('Send with null value'));
|
|
92
|
-
expect(screen.getByText("{{badge_description | default: ''}}")).toBeInTheDocument();
|
|
93
|
-
fireEvent.click(insertButton());
|
|
94
|
-
expect(onInsert).toHaveBeenCalledWith("badge_description | default: ''");
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('inserts tag with entered fallback value', () => {
|
|
98
|
-
const { onInsert } = renderPanel();
|
|
99
|
-
fireEvent.click(screen.getByLabelText('Fallback value'));
|
|
100
|
-
expect(insertButton()).toBeDisabled();
|
|
101
|
-
fireEvent.change(screen.getByPlaceholderText('Enter fallback value'), { target: { value: 'Gold' } });
|
|
102
|
-
expect(screen.getByText("{{badge_description | default: 'Gold'}}")).toBeInTheDocument();
|
|
103
|
-
fireEvent.click(insertButton());
|
|
104
|
-
expect(onInsert).toHaveBeenCalledWith("badge_description | default: 'Gold'");
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('disables insert for an invalid fallback value', () => {
|
|
108
|
-
renderPanel();
|
|
109
|
-
fireEvent.click(screen.getByLabelText('Fallback value'));
|
|
110
|
-
fireEvent.change(screen.getByPlaceholderText('Enter fallback value'), { target: { value: '{bad}' } });
|
|
111
|
-
expect(insertButton()).toBeDisabled();
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('copies the previewed tag on copy icon click', () => {
|
|
115
|
-
const writeText = jest.fn();
|
|
116
|
-
Object.assign(navigator, { clipboard: { writeText } });
|
|
117
|
-
renderPanel();
|
|
118
|
-
fireEvent.click(screen.getByLabelText('Send with null value'));
|
|
119
|
-
fireEvent.click(screen.getByLabelText('Copy'));
|
|
120
|
-
expect(writeText).toHaveBeenCalledWith("{{badge_description | default: ''}}");
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('calls onBack on back arrow click', () => {
|
|
124
|
-
const { onBack } = renderPanel();
|
|
125
|
-
fireEvent.click(screen.getByLabelText('Back'));
|
|
126
|
-
expect(onBack).toHaveBeenCalled();
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
describe('CapTagList fallback flow', () => {
|
|
131
|
-
const getInstance = (props = {}) => {
|
|
132
|
-
const instance = new CapTagList({
|
|
133
|
-
tags: {},
|
|
134
|
-
onSelect: jest.fn(),
|
|
135
|
-
intl: { formatMessage: ({ defaultMessage }) => defaultMessage },
|
|
136
|
-
disableTagsDetails: {},
|
|
137
|
-
...props,
|
|
138
|
-
});
|
|
139
|
-
instance.setState = (update) => {
|
|
140
|
-
instance.state = { ...instance.state, ...(typeof update === 'function' ? update(instance.state) : update) };
|
|
141
|
-
};
|
|
142
|
-
return instance;
|
|
143
|
-
};
|
|
144
|
-
const leafInfo = (tagKey, extra = {}) => ({
|
|
145
|
-
selectedNodes: [{ isLeaf: true, tagKey, tagName: 'Badge description', parentName: 'Badge', ...extra }],
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('opens the fallback panel instead of inserting on leaf click', () => {
|
|
149
|
-
const instance = getInstance();
|
|
150
|
-
const info = leafInfo('badge_description');
|
|
151
|
-
instance.handleOnSelect(['Badge.badge_description'], info);
|
|
152
|
-
expect(instance.props.onSelect).not.toHaveBeenCalled();
|
|
153
|
-
expect(instance.state.selectedTag).toEqual({
|
|
154
|
-
tagKey: 'badge_description', tagName: 'Badge description', parentName: 'Badge', info,
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it('keeps the dynamic expiry tag flow as it is', () => {
|
|
159
|
-
const instance = getInstance();
|
|
160
|
-
instance.handleOnSelect(['k'], leafInfo('dynamic_expiry_date_after_(N)_days.FORMAT_1'));
|
|
161
|
-
expect(instance.state.selectedTag).toBeNull();
|
|
162
|
-
expect(instance.state.showModal).toBe(true);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('inserts built tag value and closes on insert', () => {
|
|
166
|
-
const instance = getInstance();
|
|
167
|
-
const info = leafInfo('badge_description');
|
|
168
|
-
instance.handleOnSelect(['Badge.badge_description'], info);
|
|
169
|
-
instance.handleFallbackInsert("badge_description | default: 'Gold'");
|
|
170
|
-
expect(instance.props.onSelect).toHaveBeenCalledWith(["badge_description | default: 'Gold'"], info);
|
|
171
|
-
expect(instance.state).toEqual(expect.objectContaining({ visible: false, selectedTag: null, selectedNodeKey: '' }));
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it('goes back to the tag list and clears selection on back', () => {
|
|
175
|
-
const instance = getInstance();
|
|
176
|
-
instance.handleOnSelect(['Badge.badge_description'], leafInfo('badge_description'));
|
|
177
|
-
instance.handleFallbackBack();
|
|
178
|
-
expect(instance.state.selectedTag).toBeNull();
|
|
179
|
-
expect(instance.state.selectedNodeKey).toBe('');
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
it('resets the fallback panel when popover closes', () => {
|
|
183
|
-
const instance = getInstance();
|
|
184
|
-
instance.handleOnSelect(['Badge.badge_description'], leafInfo('badge_description'));
|
|
185
|
-
instance.togglePopoverVisibility(false);
|
|
186
|
-
expect(instance.state.selectedTag).toBeNull();
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
it('keeps the searched text after going back from the fallback panel', () => {
|
|
190
|
-
const intl = { formatMessage: ({ defaultMessage }) => defaultMessage, locale: 'en' };
|
|
191
|
-
const ref = React.createRef();
|
|
192
|
-
render(
|
|
193
|
-
<IntlProvider locale="en">
|
|
194
|
-
<CapTagList
|
|
195
|
-
ref={ref}
|
|
196
|
-
tags={{ Badge: { name: 'Badge', subtags: { badge_description: { name: 'Badge description', desc: 'Badge description' } } } }}
|
|
197
|
-
onSelect={jest.fn()}
|
|
198
|
-
intl={intl}
|
|
199
|
-
disableTagsDetails={{}}
|
|
200
|
-
hidePopover
|
|
201
|
-
visibleTaglist
|
|
202
|
-
/>
|
|
203
|
-
</IntlProvider>
|
|
204
|
-
);
|
|
205
|
-
fireEvent.change(screen.getByPlaceholderText('Search'), { target: { value: 'badge desc' } });
|
|
206
|
-
// antd tree rows are not rendered in jsdom, so select the tag through the instance
|
|
207
|
-
act(() => ref.current.handleOnSelect(['Badge.badge_description'], leafInfo('badge_description')));
|
|
208
|
-
expect(screen.queryByPlaceholderText('Search')).toBeNull();
|
|
209
|
-
fireEvent.click(screen.getByLabelText('Back'));
|
|
210
|
-
expect(screen.getByPlaceholderText('Search')).toHaveValue('badge desc');
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
it('adds tag and parent names to leaf nodes', () => {
|
|
214
|
-
const instance = getInstance();
|
|
215
|
-
const list = instance.renderTags({
|
|
216
|
-
Badge: { name: 'Badge', subtags: { badge_description: { name: 'Badge description', desc: 'Badge description' } } },
|
|
217
|
-
});
|
|
218
|
-
expect(list[0].children[0]).toEqual(expect.objectContaining({
|
|
219
|
-
tagKey: 'badge_description', tagName: 'Badge description', parentName: 'Badge',
|
|
220
|
-
}));
|
|
221
|
-
});
|
|
222
|
-
});
|