@capillarytech/creatives-library 8.0.250-alpha.2 → 8.0.251
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/assets/Android.png +0 -0
- package/assets/iOS.png +0 -0
- package/constants/unified.js +1 -3
- package/initialReducer.js +0 -2
- package/package.json +1 -1
- package/services/api.js +0 -15
- package/services/tests/api.test.js +0 -34
- package/translations/en.json +3 -4
- package/utils/common.js +0 -11
- package/utils/commonUtils.js +5 -28
- package/utils/tests/commonUtil.test.js +0 -224
- package/utils/tests/transformerUtils.test.js +0 -297
- package/utils/transformTemplateConfig.js +10 -0
- package/utils/transformerUtils.js +0 -40
- package/v2Components/CapDeviceContent/index.js +56 -61
- package/v2Components/CapImageUpload/constants.js +0 -2
- package/v2Components/CapImageUpload/index.js +16 -65
- package/v2Components/CapImageUpload/index.scss +1 -4
- package/v2Components/CapImageUpload/messages.js +1 -5
- package/v2Components/CapTagList/index.js +1 -6
- package/v2Components/CapTagListWithInput/index.js +1 -5
- package/v2Components/CapTagListWithInput/messages.js +1 -1
- package/v2Components/CapWhatsappCTA/tests/index.test.js +0 -5
- package/v2Components/ErrorInfoNote/index.js +72 -455
- package/v2Components/ErrorInfoNote/messages.js +6 -36
- package/v2Components/ErrorInfoNote/style.scss +4 -280
- package/v2Components/FormBuilder/tests/index.test.js +4 -13
- package/v2Components/HtmlEditor/HTMLEditor.js +94 -547
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +133 -1358
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +16 -27
- package/v2Components/HtmlEditor/_htmlEditor.scss +45 -108
- package/v2Components/HtmlEditor/_index.lazy.scss +1 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +101 -22
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +140 -146
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +1 -2
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
- package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +0 -9
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +1 -1
- package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +0 -22
- package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +7 -4
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +45 -35
- package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +3 -1
- package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +6 -7
- package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +6 -3
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +34 -24
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +152 -0
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +31 -49
- package/v2Components/HtmlEditor/components/ValidationPanel/_validationPanel.scss +34 -50
- package/v2Components/HtmlEditor/components/ValidationPanel/index.js +41 -70
- package/v2Components/HtmlEditor/constants.js +20 -42
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +16 -373
- package/v2Components/HtmlEditor/hooks/useEditorContent.js +2 -5
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +146 -88
- package/v2Components/HtmlEditor/hooks/useValidation.js +53 -189
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +85 -95
- package/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +45 -94
- package/v2Components/HtmlEditor/utils/__tests__/validationAdapter.test.js +0 -134
- package/v2Components/HtmlEditor/utils/contentSanitizer.js +41 -40
- package/v2Components/HtmlEditor/utils/htmlValidator.js +72 -71
- package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +102 -134
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +25 -23
- package/v2Components/HtmlEditor/utils/validationAdapter.js +41 -66
- package/v2Components/MobilePushPreviewV2/index.js +7 -32
- package/v2Components/TemplatePreview/_templatePreview.scss +24 -55
- package/v2Components/TemplatePreview/index.js +32 -47
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +0 -1
- package/v2Containers/App/constants.js +0 -5
- package/v2Containers/BeeEditor/index.js +90 -172
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +3 -4
- package/v2Containers/CreativesContainer/SlideBoxContent.js +53 -184
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +13 -163
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -3
- package/v2Containers/CreativesContainer/constants.js +0 -4
- package/v2Containers/CreativesContainer/index.js +46 -407
- package/v2Containers/CreativesContainer/messages.js +0 -12
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -210
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +2 -11
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +50 -342
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -106
- package/v2Containers/Email/actions.js +0 -7
- package/v2Containers/Email/constants.js +1 -5
- package/v2Containers/Email/index.js +29 -234
- package/v2Containers/Email/messages.js +0 -32
- package/v2Containers/Email/reducer.js +1 -12
- package/v2Containers/Email/sagas.js +7 -61
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +0 -2
- package/v2Containers/Email/tests/reducer.test.js +0 -46
- package/v2Containers/Email/tests/sagas.test.js +29 -320
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +19 -207
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +74 -40
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +67 -2
- package/v2Containers/EmailWrapper/constants.js +0 -2
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +77 -629
- package/v2Containers/EmailWrapper/index.js +23 -103
- package/v2Containers/EmailWrapper/messages.js +1 -61
- package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +214 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +77 -594
- package/v2Containers/InApp/actions.js +0 -7
- package/v2Containers/InApp/constants.js +4 -20
- package/v2Containers/InApp/index.js +359 -802
- package/v2Containers/InApp/index.scss +3 -4
- package/v2Containers/InApp/messages.js +3 -7
- package/v2Containers/InApp/reducer.js +3 -21
- package/v2Containers/InApp/sagas.js +9 -29
- package/v2Containers/InApp/selectors.js +5 -25
- package/v2Containers/InApp/tests/index.test.js +50 -154
- package/v2Containers/InApp/tests/reducer.test.js +0 -34
- package/v2Containers/InApp/tests/sagas.test.js +9 -61
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +9 -15
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +6 -10
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +75 -102
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +54 -81
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +174 -244
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +12 -16
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +36 -52
- package/v2Containers/TagList/index.js +19 -62
- package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
- package/v2Containers/Templates/_templates.scss +1 -265
- package/v2Containers/Templates/actions.js +1 -2
- package/v2Containers/Templates/constants.js +0 -1
- package/v2Containers/Templates/index.js +38 -363
- package/v2Containers/Templates/messages.js +0 -28
- package/v2Containers/Templates/reducer.js +0 -4
- package/v2Containers/Templates/tests/index.test.js +0 -10
- package/v2Containers/TemplatesV2/index.js +7 -15
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +486 -682
- package/utils/imageUrlUpload.js +0 -141
- package/v2Components/CapImageUrlUpload/constants.js +0 -26
- package/v2Components/CapImageUrlUpload/index.js +0 -365
- package/v2Components/CapImageUrlUpload/index.scss +0 -35
- package/v2Components/CapImageUrlUpload/messages.js +0 -47
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +0 -874
- package/v2Components/HtmlEditor/components/ValidationPanel/constants.js +0 -6
- package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +0 -254
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +0 -364
- package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +0 -51
- package/v2Components/HtmlEditor/hooks/__tests__/useValidation.apiErrors.test.js +0 -795
- package/v2Components/HtmlEditor/utils/validationConstants.js +0 -40
- package/v2Containers/BeePopupEditor/_beePopupEditor.scss +0 -14
- package/v2Containers/BeePopupEditor/constants.js +0 -10
- package/v2Containers/BeePopupEditor/index.js +0 -194
- package/v2Containers/BeePopupEditor/tests/index.test.js +0 -627
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +0 -1285
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +0 -1870
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +0 -520
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +0 -643
- package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +0 -376
- package/v2Containers/InApp/__tests__/sagas.test.js +0 -363
- package/v2Containers/InApp/tests/selectors.test.js +0 -612
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +0 -151
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +0 -267
- package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +0 -23
- package/v2Containers/InAppWrapper/constants.js +0 -16
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +0 -473
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +0 -198
- package/v2Containers/InAppWrapper/index.js +0 -148
- package/v2Containers/InAppWrapper/messages.js +0 -49
- package/v2Containers/InappAdvance/index.js +0 -1099
- package/v2Containers/InappAdvance/index.scss +0 -10
- package/v2Containers/InappAdvance/tests/index.test.js +0 -448
- package/v2Containers/WebPush/Create/components/BrandIconSection.js +0 -108
- package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -172
- package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
- package/v2Containers/WebPush/Create/components/ButtonList.js +0 -107
- package/v2Containers/WebPush/Create/components/ButtonsLinksSection.js +0 -160
- package/v2Containers/WebPush/Create/components/ButtonsLinksSection.test.js +0 -476
- package/v2Containers/WebPush/Create/components/FormActions.js +0 -54
- package/v2Containers/WebPush/Create/components/FormActions.test.js +0 -163
- package/v2Containers/WebPush/Create/components/MediaSection.js +0 -143
- package/v2Containers/WebPush/Create/components/MediaSection.test.js +0 -341
- package/v2Containers/WebPush/Create/components/MessageSection.js +0 -103
- package/v2Containers/WebPush/Create/components/MessageSection.test.js +0 -268
- package/v2Containers/WebPush/Create/components/NotificationTitleSection.js +0 -87
- package/v2Containers/WebPush/Create/components/NotificationTitleSection.test.js +0 -210
- package/v2Containers/WebPush/Create/components/TemplateNameSection.js +0 -54
- package/v2Containers/WebPush/Create/components/TemplateNameSection.test.js +0 -143
- package/v2Containers/WebPush/Create/components/__snapshots__/ButtonsLinksSection.test.js.snap +0 -82
- package/v2Containers/WebPush/Create/components/__snapshots__/FormActions.test.js.snap +0 -16
- package/v2Containers/WebPush/Create/components/__snapshots__/MediaSection.test.js.snap +0 -41
- package/v2Containers/WebPush/Create/components/__snapshots__/MessageSection.test.js.snap +0 -54
- package/v2Containers/WebPush/Create/components/__snapshots__/NotificationTitleSection.test.js.snap +0 -37
- package/v2Containers/WebPush/Create/components/__snapshots__/TemplateNameSection.test.js.snap +0 -21
- package/v2Containers/WebPush/Create/components/_buttons.scss +0 -246
- package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +0 -554
- package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +0 -607
- package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +0 -515
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +0 -666
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +0 -74
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +0 -46
- package/v2Containers/WebPush/Create/hooks/useButtonManagement.js +0 -150
- package/v2Containers/WebPush/Create/hooks/useButtonManagement.test.js +0 -406
- package/v2Containers/WebPush/Create/hooks/useCharacterCount.js +0 -30
- package/v2Containers/WebPush/Create/hooks/useCharacterCount.test.js +0 -151
- package/v2Containers/WebPush/Create/hooks/useImageUpload.js +0 -104
- package/v2Containers/WebPush/Create/hooks/useImageUpload.test.js +0 -538
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -122
- package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +0 -633
- package/v2Containers/WebPush/Create/index.js +0 -1148
- package/v2Containers/WebPush/Create/index.scss +0 -134
- package/v2Containers/WebPush/Create/messages.js +0 -203
- package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -228
- package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -294
- package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -90
- package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -305
- package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -23
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -155
- package/v2Containers/WebPush/Create/preview/assets/Light.svg +0 -53
- package/v2Containers/WebPush/Create/preview/assets/Top.svg +0 -5
- package/v2Containers/WebPush/Create/preview/assets/android-arrow-down.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/android-arrow-up.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/chrome-icon.png +0 -0
- package/v2Containers/WebPush/Create/preview/assets/edge-icon.png +0 -0
- package/v2Containers/WebPush/Create/preview/assets/firefox-icon.svg +0 -106
- package/v2Containers/WebPush/Create/preview/assets/iOS.svg +0 -26
- package/v2Containers/WebPush/Create/preview/assets/macos-arrow-down-icon.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/macos-triple-dot-icon.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +0 -18
- package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +0 -29
- package/v2Containers/WebPush/Create/preview/assets/windows-close-icon.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/windows-triple-dot-icon.svg +0 -9
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -47
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -141
- package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
- package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -68
- package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -61
- package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -99
- package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -733
- package/v2Containers/WebPush/Create/preview/components/tests/WindowsChromeExpanded.test.js +0 -571
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -81
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/WindowsChromeExpanded.test.js.snap +0 -81
- package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -50
- package/v2Containers/WebPush/Create/preview/constants.js +0 -637
- package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -79
- package/v2Containers/WebPush/Create/preview/preview.scss +0 -351
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -370
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +0 -47
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_base.scss +0 -207
- package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -153
- package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
- package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -101
- package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -229
- package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
- package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1081
- package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
- package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -1327
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -131
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -112
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +0 -144
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +0 -129
- package/v2Containers/WebPush/Create/utils/payloadBuilder.js +0 -96
- package/v2Containers/WebPush/Create/utils/payloadBuilder.test.js +0 -396
- package/v2Containers/WebPush/Create/utils/previewUtils.js +0 -89
- package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -115
- package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
- package/v2Containers/WebPush/Create/utils/validation.js +0 -75
- package/v2Containers/WebPush/Create/utils/validation.test.js +0 -283
- package/v2Containers/WebPush/actions.js +0 -60
- package/v2Containers/WebPush/constants.js +0 -132
- package/v2Containers/WebPush/index.js +0 -2
- package/v2Containers/WebPush/reducer.js +0 -104
- package/v2Containers/WebPush/sagas.js +0 -119
- package/v2Containers/WebPush/selectors.js +0 -65
- package/v2Containers/WebPush/tests/reducer.test.js +0 -863
- package/v2Containers/WebPush/tests/sagas.test.js +0 -566
- package/v2Containers/WebPush/tests/selectors.test.js +0 -960
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import {
|
|
8
8
|
validateHTML,
|
|
9
9
|
validateCSS,
|
|
10
|
-
extractAndValidateCSS
|
|
10
|
+
extractAndValidateCSS
|
|
11
11
|
} from '../htmlValidator';
|
|
12
12
|
|
|
13
13
|
// Mock liquidTemplateSupport module
|
|
@@ -15,8 +15,8 @@ jest.mock('../liquidTemplateSupport', () => ({
|
|
|
15
15
|
validateLiquidHTML: jest.fn(() => ({
|
|
16
16
|
errors: [],
|
|
17
17
|
warnings: [],
|
|
18
|
-
info: []
|
|
19
|
-
}))
|
|
18
|
+
info: []
|
|
19
|
+
}))
|
|
20
20
|
}));
|
|
21
21
|
|
|
22
22
|
// Mock console.warn to avoid noise in tests
|
|
@@ -80,7 +80,7 @@ describe('Enhanced htmlValidator Tests', () => {
|
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
it('handles very long HTML content', () => {
|
|
83
|
-
const longHtml =
|
|
83
|
+
const longHtml = '<p>' + 'a'.repeat(50000) + '</p>';
|
|
84
84
|
const result = validateHTML(longHtml);
|
|
85
85
|
|
|
86
86
|
expect(result).toBeDefined();
|
|
@@ -109,36 +109,24 @@ describe('Enhanced htmlValidator Tests', () => {
|
|
|
109
109
|
const html = '<a href="javascript:alert(1)">Click</a>';
|
|
110
110
|
const result = validateHTML(html);
|
|
111
111
|
|
|
112
|
-
// Unsafe protocols are BLOCKING ERRORS (sanitizer.dangerousProtocolDetected)
|
|
113
112
|
expect(result.errors.length).toBeGreaterThan(0);
|
|
114
113
|
expect(result.isValid).toBe(false);
|
|
115
|
-
// Verify it's the correct rule
|
|
116
|
-
const error = result.errors.find((e) => e.rule === 'sanitizer.dangerousProtocolDetected');
|
|
117
|
-
expect(error).toBeDefined();
|
|
118
114
|
});
|
|
119
115
|
|
|
120
116
|
it('detects potentially unsafe data protocol', () => {
|
|
121
117
|
const html = '<img src="data:image/svg+xml,<svg>...">';
|
|
122
118
|
const result = validateHTML(html);
|
|
123
119
|
|
|
124
|
-
// Unsafe protocols are BLOCKING ERRORS (sanitizer.dangerousProtocolDetected)
|
|
125
120
|
expect(result.errors.length).toBeGreaterThan(0);
|
|
126
121
|
expect(result.isValid).toBe(false);
|
|
127
|
-
// Verify it's the correct rule
|
|
128
|
-
const error = result.errors.find((e) => e.rule === 'sanitizer.dangerousProtocolDetected');
|
|
129
|
-
expect(error).toBeDefined();
|
|
130
122
|
});
|
|
131
123
|
|
|
132
124
|
it('detects potentially unsafe vbscript protocol', () => {
|
|
133
125
|
const html = '<a href="vbscript:msgbox(1)">Click</a>';
|
|
134
126
|
const result = validateHTML(html);
|
|
135
127
|
|
|
136
|
-
// Unsafe protocols are BLOCKING ERRORS (sanitizer.dangerousProtocolDetected)
|
|
137
128
|
expect(result.errors.length).toBeGreaterThan(0);
|
|
138
129
|
expect(result.isValid).toBe(false);
|
|
139
|
-
// Verify it's the correct rule
|
|
140
|
-
const error = result.errors.find((e) => e.rule === 'sanitizer.dangerousProtocolDetected');
|
|
141
|
-
expect(error).toBeDefined();
|
|
142
130
|
});
|
|
143
131
|
|
|
144
132
|
it('handles script tags appropriately', () => {
|
|
@@ -429,7 +417,7 @@ describe('Enhanced htmlValidator Tests', () => {
|
|
|
429
417
|
});
|
|
430
418
|
|
|
431
419
|
it('handles very long CSS content', () => {
|
|
432
|
-
const longCSS =
|
|
420
|
+
const longCSS = '.long { ' + 'color: red; '.repeat(1000) + '}';
|
|
433
421
|
const result = validateCSS(longCSS);
|
|
434
422
|
|
|
435
423
|
expect(result).toBeDefined();
|
|
@@ -448,10 +436,8 @@ describe('Enhanced htmlValidator Tests', () => {
|
|
|
448
436
|
const result = validateCSS(css);
|
|
449
437
|
|
|
450
438
|
expect(result).toBeDefined();
|
|
451
|
-
|
|
452
|
-
expect(result.
|
|
453
|
-
// isValid can be true if only warnings exist (warnings don't block)
|
|
454
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
439
|
+
expect(result.isValid).toBe(false);
|
|
440
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
455
441
|
});
|
|
456
442
|
|
|
457
443
|
it('detects empty rules', () => {
|
|
@@ -462,10 +448,8 @@ describe('Enhanced htmlValidator Tests', () => {
|
|
|
462
448
|
const result = validateCSS(css);
|
|
463
449
|
|
|
464
450
|
expect(result).toBeDefined();
|
|
465
|
-
|
|
466
|
-
expect(result.
|
|
467
|
-
// isValid can be true if only warnings exist (warnings don't block)
|
|
468
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
451
|
+
expect(result.isValid).toBe(false);
|
|
452
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
469
453
|
});
|
|
470
454
|
});
|
|
471
455
|
});
|
|
@@ -552,10 +536,8 @@ describe('Enhanced htmlValidator Tests', () => {
|
|
|
552
536
|
const result = extractAndValidateCSS(html);
|
|
553
537
|
|
|
554
538
|
expect(result).toBeDefined();
|
|
555
|
-
|
|
556
|
-
expect(result.
|
|
557
|
-
// isValid can be true if only warnings exist (warnings don't block)
|
|
558
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
539
|
+
expect(result.isValid).toBe(false);
|
|
540
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
559
541
|
});
|
|
560
542
|
});
|
|
561
543
|
|
|
@@ -594,7 +576,7 @@ describe('Enhanced htmlValidator Tests', () => {
|
|
|
594
576
|
const mockHTMLHint = {
|
|
595
577
|
verify: jest.fn(() => {
|
|
596
578
|
throw new Error('HTMLHint validation failed');
|
|
597
|
-
})
|
|
579
|
+
})
|
|
598
580
|
};
|
|
599
581
|
|
|
600
582
|
// Temporarily replace HTMLHint
|
|
@@ -603,13 +585,9 @@ describe('Enhanced htmlValidator Tests', () => {
|
|
|
603
585
|
const html = '<div>Test content</div>';
|
|
604
586
|
const result = validateHTML(html);
|
|
605
587
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
expect(result).
|
|
609
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
610
|
-
// HTMLHint errors are converted to warnings in the catch block
|
|
611
|
-
expect(result.warnings.length).toBeGreaterThan(0);
|
|
612
|
-
expect(result.warnings[0].message).toContain('HTMLHint validation failed');
|
|
588
|
+
expect(result.isValid).toBe(false);
|
|
589
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
590
|
+
expect(result.errors[0].message).toContain('HTMLHint validation failed');
|
|
613
591
|
|
|
614
592
|
// Restore original HTMLHint
|
|
615
593
|
require('htmlhint').HTMLHint = originalHTMLHint;
|
|
@@ -662,9 +640,10 @@ describe('Enhanced htmlValidator Tests', () => {
|
|
|
662
640
|
});
|
|
663
641
|
|
|
664
642
|
it('falls back to default formatter when custom formatter fails', () => {
|
|
665
|
-
const failingFormatter = jest.fn((key, values) =>
|
|
643
|
+
const failingFormatter = jest.fn((key, values) => {
|
|
666
644
|
// Don't throw error, just return the key as fallback behavior
|
|
667
|
-
key
|
|
645
|
+
return key;
|
|
646
|
+
});
|
|
668
647
|
|
|
669
648
|
const html = '<a href="javascript:alert(1)">Unsafe link</a>';
|
|
670
649
|
const result = validateHTML(html, 'email', failingFormatter);
|
|
@@ -742,10 +721,8 @@ line4`;
|
|
|
742
721
|
const css = '.class { }';
|
|
743
722
|
const result = validateCSS(css);
|
|
744
723
|
|
|
745
|
-
|
|
746
|
-
expect(result.
|
|
747
|
-
// isValid can be true if only warnings exist (warnings don't block)
|
|
748
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
724
|
+
expect(result.isValid).toBe(false);
|
|
725
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
749
726
|
});
|
|
750
727
|
|
|
751
728
|
it('handles multiple consecutive unsafe protocols', () => {
|
|
@@ -778,15 +755,9 @@ line4`;
|
|
|
778
755
|
// Get the mocked module and set it to return specific results
|
|
779
756
|
const { validateLiquidHTML } = require('../liquidTemplateSupport');
|
|
780
757
|
validateLiquidHTML.mockImplementation(() => ({
|
|
781
|
-
errors: [{
|
|
782
|
-
|
|
783
|
-
}]
|
|
784
|
-
warnings: [{
|
|
785
|
-
type: 'warning', message: 'Liquid warning', line: 1, column: 1, rule: 'liquid-test', severity: 'warning', source: 'liquid',
|
|
786
|
-
}],
|
|
787
|
-
info: [{
|
|
788
|
-
type: 'info', message: 'Liquid info', line: 1, column: 1, rule: 'liquid-test', severity: 'info', source: 'liquid',
|
|
789
|
-
}],
|
|
758
|
+
errors: [{ type: 'error', message: 'Liquid error', line: 1, column: 1, rule: 'liquid-test', severity: 'error', source: 'liquid' }],
|
|
759
|
+
warnings: [{ type: 'warning', message: 'Liquid warning', line: 1, column: 1, rule: 'liquid-test', severity: 'warning', source: 'liquid' }],
|
|
760
|
+
info: [{ type: 'info', message: 'Liquid info', line: 1, column: 1, rule: 'liquid-test', severity: 'info', source: 'liquid' }]
|
|
790
761
|
}));
|
|
791
762
|
|
|
792
763
|
const html = '<div>{{ liquid.template }}</div>';
|
|
@@ -819,9 +790,7 @@ line4`;
|
|
|
819
790
|
// Get the mocked module and set it to return only some result types
|
|
820
791
|
const { validateLiquidHTML } = require('../liquidTemplateSupport');
|
|
821
792
|
validateLiquidHTML.mockImplementation(() => ({
|
|
822
|
-
errors: [{
|
|
823
|
-
type: 'error', message: 'Liquid error', line: 1, column: 1, rule: 'liquid-test', severity: 'error', source: 'liquid',
|
|
824
|
-
}],
|
|
793
|
+
errors: [{ type: 'error', message: 'Liquid error', line: 1, column: 1, rule: 'liquid-test', severity: 'error', source: 'liquid' }],
|
|
825
794
|
// Missing warnings and info arrays
|
|
826
795
|
}));
|
|
827
796
|
|
|
@@ -839,9 +808,7 @@ line4`;
|
|
|
839
808
|
// Get the mocked module and set it to return only warnings
|
|
840
809
|
const { validateLiquidHTML } = require('../liquidTemplateSupport');
|
|
841
810
|
validateLiquidHTML.mockImplementation(() => ({
|
|
842
|
-
warnings: [{
|
|
843
|
-
type: 'warning', message: 'Liquid warning', line: 1, column: 1, rule: 'liquid-test', severity: 'warning', source: 'liquid',
|
|
844
|
-
}],
|
|
811
|
+
warnings: [{ type: 'warning', message: 'Liquid warning', line: 1, column: 1, rule: 'liquid-test', severity: 'warning', source: 'liquid' }],
|
|
845
812
|
}));
|
|
846
813
|
|
|
847
814
|
const html = '<div>{{ liquid.template }}</div>';
|
|
@@ -858,9 +825,7 @@ line4`;
|
|
|
858
825
|
// Get the mocked module and set it to return only info
|
|
859
826
|
const { validateLiquidHTML } = require('../liquidTemplateSupport');
|
|
860
827
|
validateLiquidHTML.mockImplementation(() => ({
|
|
861
|
-
info: [{
|
|
862
|
-
type: 'info', message: 'Liquid info', line: 1, column: 1, rule: 'liquid-test', severity: 'info', source: 'liquid',
|
|
863
|
-
}],
|
|
828
|
+
info: [{ type: 'info', message: 'Liquid info', line: 1, column: 1, rule: 'liquid-test', severity: 'info', source: 'liquid' }],
|
|
864
829
|
}));
|
|
865
830
|
|
|
866
831
|
const html = '<div>{{ liquid.template }}</div>';
|
|
@@ -886,10 +851,8 @@ line4`;
|
|
|
886
851
|
`;
|
|
887
852
|
const result = validateCSS(css);
|
|
888
853
|
|
|
889
|
-
|
|
890
|
-
expect(result.
|
|
891
|
-
// isValid can be true if only warnings exist (warnings don't block)
|
|
892
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
854
|
+
expect(result.isValid).toBe(false);
|
|
855
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
893
856
|
});
|
|
894
857
|
|
|
895
858
|
it('handles CSS with nested braces', () => {
|
|
@@ -900,10 +863,8 @@ line4`;
|
|
|
900
863
|
`;
|
|
901
864
|
const result = validateCSS(css);
|
|
902
865
|
|
|
903
|
-
|
|
904
|
-
expect(result.
|
|
905
|
-
// isValid can be true if only warnings exist (warnings don't block)
|
|
906
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
866
|
+
expect(result.isValid).toBe(false);
|
|
867
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
907
868
|
});
|
|
908
869
|
|
|
909
870
|
it('handles CSS with mixed valid and invalid rules', () => {
|
|
@@ -915,11 +876,9 @@ line4`;
|
|
|
915
876
|
`;
|
|
916
877
|
const result = validateCSS(css);
|
|
917
878
|
|
|
918
|
-
|
|
919
|
-
// Should detect at least one empty rule
|
|
920
|
-
expect(result.
|
|
921
|
-
// isValid can be true if only warnings exist (warnings don't block)
|
|
922
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
879
|
+
expect(result.isValid).toBe(false);
|
|
880
|
+
// Should detect at least one empty rule
|
|
881
|
+
expect(result.errors.length).toBeGreaterThanOrEqual(1);
|
|
923
882
|
});
|
|
924
883
|
|
|
925
884
|
it('handles CSS validation exception scenarios', () => {
|
|
@@ -968,10 +927,8 @@ line4`;
|
|
|
968
927
|
`;
|
|
969
928
|
const result = extractAndValidateCSS(html);
|
|
970
929
|
|
|
971
|
-
|
|
972
|
-
expect(result.
|
|
973
|
-
// isValid can be true if only warnings exist (warnings don't block)
|
|
974
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
930
|
+
expect(result.isValid).toBe(false);
|
|
931
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
975
932
|
});
|
|
976
933
|
|
|
977
934
|
it('handles style tags with complex CSS', () => {
|
|
@@ -986,21 +943,17 @@ line4`;
|
|
|
986
943
|
`;
|
|
987
944
|
const result = extractAndValidateCSS(html);
|
|
988
945
|
|
|
989
|
-
|
|
990
|
-
expect(result.
|
|
991
|
-
// isValid can be true if only warnings exist (warnings don't block)
|
|
992
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
946
|
+
expect(result.isValid).toBe(false);
|
|
947
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
993
948
|
});
|
|
994
949
|
|
|
995
950
|
it('correctly identifies unclosed style tags', () => {
|
|
996
951
|
const html = '<style>.test { color: red; }';
|
|
997
952
|
const result = extractAndValidateCSS(html);
|
|
998
953
|
|
|
999
|
-
|
|
1000
|
-
expect(result.
|
|
1001
|
-
expect(result.
|
|
1002
|
-
// isValid can be true if only warnings exist (warnings don't block)
|
|
1003
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
954
|
+
expect(result.isValid).toBe(false);
|
|
955
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
956
|
+
expect(result.errors.some(error => error.rule === 'unclosed-style-tag')).toBe(true);
|
|
1004
957
|
});
|
|
1005
958
|
|
|
1006
959
|
it('handles multiple unclosed style tags', () => {
|
|
@@ -1011,10 +964,8 @@ line4`;
|
|
|
1011
964
|
`;
|
|
1012
965
|
const result = extractAndValidateCSS(html);
|
|
1013
966
|
|
|
1014
|
-
|
|
1015
|
-
expect(result.
|
|
1016
|
-
// isValid can be true if only warnings exist (warnings don't block)
|
|
1017
|
-
expect(typeof result.isValid).toBe('boolean');
|
|
967
|
+
expect(result.isValid).toBe(false);
|
|
968
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
1018
969
|
});
|
|
1019
970
|
});
|
|
1020
971
|
|
|
@@ -1066,10 +1017,10 @@ line4`;
|
|
|
1066
1017
|
'<table><tr><td>Table content</td></tr></table>',
|
|
1067
1018
|
'<form><input type="text"><button>Submit</button></form>',
|
|
1068
1019
|
'<ul><li>List item 1</li><li>List item 2</li></ul>',
|
|
1069
|
-
'<article><header><h1>Article</h1></header><p>Content</p></article>'
|
|
1020
|
+
'<article><header><h1>Article</h1></header><p>Content</p></article>'
|
|
1070
1021
|
];
|
|
1071
1022
|
|
|
1072
|
-
testCases.forEach(
|
|
1023
|
+
testCases.forEach(html => {
|
|
1073
1024
|
const result = validateHTML(html);
|
|
1074
1025
|
expect(result).toBeDefined();
|
|
1075
1026
|
expect(typeof result.isValid).toBe('boolean');
|
|
@@ -1088,4 +1039,4 @@ line4`;
|
|
|
1088
1039
|
expect(typeof inappResult.isValid).toBe('boolean');
|
|
1089
1040
|
});
|
|
1090
1041
|
});
|
|
1091
|
-
});
|
|
1042
|
+
});
|
|
@@ -238,137 +238,3 @@ describe('getValidationSummary', () => {
|
|
|
238
238
|
});
|
|
239
239
|
});
|
|
240
240
|
|
|
241
|
-
describe('validationAdapter error handling', () => {
|
|
242
|
-
describe('transformValidationToErrorInfo error handling', () => {
|
|
243
|
-
it('handles validation without getAllIssues method (line 33-36)', () => {
|
|
244
|
-
const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
245
|
-
const validation = {
|
|
246
|
-
isValidating: false,
|
|
247
|
-
// Missing getAllIssues method
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
const result = transformValidationToErrorInfo(validation);
|
|
251
|
-
|
|
252
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
253
|
-
expect.stringContaining('[validationAdapter] validation.getAllIssues is not a function'),
|
|
254
|
-
validation
|
|
255
|
-
);
|
|
256
|
-
expect(result).toEqual({
|
|
257
|
-
errorMessages: {
|
|
258
|
-
LIQUID_ERROR_MSG: [],
|
|
259
|
-
STANDARD_ERROR_MSG: [],
|
|
260
|
-
},
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
consoleSpy.mockRestore();
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
it('handles getAllIssues returning non-array (line 40-43)', () => {
|
|
267
|
-
const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
268
|
-
const validation = {
|
|
269
|
-
isValidating: false,
|
|
270
|
-
getAllIssues: jest.fn(() => 'not an array'), // Returns string instead of array
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
const result = transformValidationToErrorInfo(validation);
|
|
274
|
-
|
|
275
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
276
|
-
expect.stringContaining('[validationAdapter] validation.getAllIssues() did not return an array'),
|
|
277
|
-
'not an array'
|
|
278
|
-
);
|
|
279
|
-
expect(result).toEqual({
|
|
280
|
-
errorMessages: {
|
|
281
|
-
LIQUID_ERROR_MSG: [],
|
|
282
|
-
STANDARD_ERROR_MSG: [],
|
|
283
|
-
},
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
consoleSpy.mockRestore();
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
describe('hasValidationErrors error handling', () => {
|
|
291
|
-
it('handles validation without getAllIssues method (line 106-110)', () => {
|
|
292
|
-
const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
293
|
-
const validation = {
|
|
294
|
-
isValidating: false,
|
|
295
|
-
// Missing getAllIssues method
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
const result = hasValidationErrors(validation);
|
|
299
|
-
|
|
300
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
301
|
-
expect.stringContaining('[validationAdapter] validation.getAllIssues is not a function'),
|
|
302
|
-
validation
|
|
303
|
-
);
|
|
304
|
-
expect(result).toBe(false);
|
|
305
|
-
|
|
306
|
-
consoleSpy.mockRestore();
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
it('handles getAllIssues returning non-array (line 112-116)', () => {
|
|
310
|
-
const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
311
|
-
const validation = {
|
|
312
|
-
isValidating: false,
|
|
313
|
-
getAllIssues: jest.fn(() => null), // Returns null instead of array
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
const result = hasValidationErrors(validation);
|
|
317
|
-
|
|
318
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
319
|
-
expect.stringContaining('[validationAdapter] validation.getAllIssues() did not return an array'),
|
|
320
|
-
null
|
|
321
|
-
);
|
|
322
|
-
expect(result).toBe(false);
|
|
323
|
-
|
|
324
|
-
consoleSpy.mockRestore();
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
describe('getValidationSummary error handling', () => {
|
|
329
|
-
it('handles validation without getAllIssues method (line 131-135)', () => {
|
|
330
|
-
const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
331
|
-
const validation = {
|
|
332
|
-
isValidating: false,
|
|
333
|
-
// Missing getAllIssues method
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
const result = getValidationSummary(validation);
|
|
337
|
-
|
|
338
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
339
|
-
expect.stringContaining('[validationAdapter] validation.getAllIssues is not a function'),
|
|
340
|
-
validation
|
|
341
|
-
);
|
|
342
|
-
expect(result).toEqual({
|
|
343
|
-
totalErrors: 0,
|
|
344
|
-
totalWarnings: 0,
|
|
345
|
-
hasLiquidErrors: false,
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
consoleSpy.mockRestore();
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
it('handles getAllIssues returning non-array (line 138-141)', () => {
|
|
352
|
-
const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
353
|
-
const validation = {
|
|
354
|
-
isValidating: false,
|
|
355
|
-
getAllIssues: jest.fn(() => ({})), // Returns object instead of array
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
const result = getValidationSummary(validation);
|
|
359
|
-
|
|
360
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
361
|
-
expect.stringContaining('[validationAdapter] validation.getAllIssues() did not return an array'),
|
|
362
|
-
{}
|
|
363
|
-
);
|
|
364
|
-
expect(result).toEqual({
|
|
365
|
-
totalErrors: 0,
|
|
366
|
-
totalWarnings: 0,
|
|
367
|
-
hasLiquidErrors: false,
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
consoleSpy.mockRestore();
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
});
|
|
374
|
-
|