@capillarytech/creatives-library 7.12.50 → 7.12.53
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/config/app.js +0 -1
- package/package.json +1 -1
- package/services/api.js +15 -2
- package/v2Components/CapImageUpload/index.js +33 -17
- package/v2Components/CapImageUpload/messages.js +11 -3
- package/v2Components/CapWhatsappCTA/constants.js +12 -1
- package/v2Components/CapWhatsappCTA/index.js +88 -29
- package/v2Components/CapWhatsappCTA/index.scss +4 -6
- package/v2Components/CapWhatsappCTA/messages.js +24 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +9 -8
- package/v2Components/TemplatePreview/index.js +8 -6
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +3 -19
- package/v2Components/TemplatePreview/tests/index.test.js +0 -2
- package/v2Components/WhatsappStatusContainer/index.js +42 -52
- package/v2Containers/Cap/tests/index.test.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +8 -8
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +28 -36
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +165 -344
- package/v2Containers/CreativesContainer/tests/index.test.js +0 -3
- package/v2Containers/Line/Container/ImageCarousel/Content.js +15 -29
- package/v2Containers/Line/Container/ImageCarousel/constants.js +3 -0
- package/v2Containers/Line/Container/ImageCarousel/index.js +28 -40
- package/v2Containers/Line/Container/ImageCarousel/messages.js +2 -2
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +9851 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +21113 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/content.test.js +71 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/index.test.js +58 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/mockData.js +1322 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/utils.test.js +13 -0
- package/v2Containers/Line/Container/ImageCarousel/utils.js +12 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +84451 -0
- package/v2Containers/Line/Container/Wrapper/tests/index.test.js +58 -0
- package/v2Containers/Line/Container/Wrapper/tests/mockData.js +171 -0
- package/v2Containers/Line/Container/index.js +5 -1
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +63597 -0
- package/v2Containers/Line/Container/tests/index.test.js +105 -0
- package/v2Containers/Line/Container/tests/mockData.js +1334 -0
- package/v2Containers/Templates/_templates.scss +5 -0
- package/v2Containers/Templates/actions.js +7 -0
- package/v2Containers/Templates/constants.js +9 -1
- package/v2Containers/Templates/index.js +45 -30
- package/v2Containers/Templates/messages.js +1 -1
- package/v2Containers/Templates/reducer.js +15 -0
- package/v2Containers/Templates/sagas.js +32 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1774 -1881
- package/v2Containers/Templates/tests/index.test.js +14 -3
- package/v2Containers/Whatsapp/actions.js +22 -0
- package/v2Containers/Whatsapp/constants.js +56 -23
- package/v2Containers/Whatsapp/index.js +204 -66
- package/v2Containers/Whatsapp/index.scss +18 -2
- package/v2Containers/Whatsapp/messages.js +35 -7
- package/v2Containers/Whatsapp/reducer.js +35 -1
- package/v2Containers/Whatsapp/sagas.js +30 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +44349 -32926
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +15 -21
- package/v2Containers/Whatsapp/utils.js +16 -9
- package/v2Containers/mockdata.js +210 -555
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { browserHistory } from 'react-router';
|
|
3
|
+
import { act } from 'react-dom/test-utils';
|
|
4
|
+
import { Provider } from 'react-redux';
|
|
5
|
+
import configureStore from '../../../../../store';
|
|
6
|
+
import { mountWithIntl } from '../../../../../../app/helpers/intl-enzym-test-helpers';
|
|
7
|
+
import { LineImageCarouselContent } from '../Content';
|
|
8
|
+
import { mockData } from './mockData';
|
|
9
|
+
|
|
10
|
+
let store;
|
|
11
|
+
beforeAll(() => {
|
|
12
|
+
store = configureStore({}, browserHistory);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('Creatives line image carousel test/>', () => {
|
|
16
|
+
let renderedComponent;
|
|
17
|
+
const clearAsset = jest.fn();
|
|
18
|
+
const uploadAsset = jest.fn();
|
|
19
|
+
const formatMessage = jest.fn();
|
|
20
|
+
const updateCarouselMessageState = jest.fn();
|
|
21
|
+
const updateUploadedAssetList = jest.fn();
|
|
22
|
+
|
|
23
|
+
const renderHelper = (args) => {
|
|
24
|
+
renderedComponent = mountWithIntl(
|
|
25
|
+
<Provider store={store}>
|
|
26
|
+
<LineImageCarouselContent
|
|
27
|
+
id={'template__0'}
|
|
28
|
+
intl={{ formatMessage }}
|
|
29
|
+
isFullMode={true}
|
|
30
|
+
actions={{
|
|
31
|
+
clearAsset,
|
|
32
|
+
uploadAsset,
|
|
33
|
+
}}
|
|
34
|
+
Line={args?.lineData}
|
|
35
|
+
content={args?.content}
|
|
36
|
+
index={0}
|
|
37
|
+
activeIndex={0}
|
|
38
|
+
updateCarouselMessageState={updateCarouselMessageState}
|
|
39
|
+
uploadedAssetList={args?.uploadedAssetList}
|
|
40
|
+
updateUploadedAssetList={updateUploadedAssetList}
|
|
41
|
+
/>
|
|
42
|
+
</Provider>,
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
it('should render', () => {
|
|
47
|
+
const { lineData1, content1, uploadedAssetList } = mockData;
|
|
48
|
+
renderHelper({
|
|
49
|
+
lineData: lineData1,
|
|
50
|
+
content: content1,
|
|
51
|
+
uploadedAssetList,
|
|
52
|
+
});
|
|
53
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
54
|
+
act(() => {
|
|
55
|
+
renderedComponent.find('CapButton.dragger-button').simulate('click');
|
|
56
|
+
});
|
|
57
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
58
|
+
});
|
|
59
|
+
it('should render', () => {
|
|
60
|
+
const { lineData2, content2, uploadedAssetList } = mockData;
|
|
61
|
+
renderHelper({
|
|
62
|
+
lineData: lineData2,
|
|
63
|
+
content: content2,
|
|
64
|
+
uploadedAssetList,
|
|
65
|
+
});
|
|
66
|
+
act(() => {
|
|
67
|
+
renderedComponent.find('CapButton.dragger-button').simulate('click');
|
|
68
|
+
});
|
|
69
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { browserHistory } from 'react-router';
|
|
3
|
+
import { Provider } from 'react-redux';
|
|
4
|
+
import configureStore from '../../../../../store';
|
|
5
|
+
import { mountWithIntl } from '../../../../../helpers/intl-enzym-test-helpers';
|
|
6
|
+
import { LineImageCarousel } from '../index';
|
|
7
|
+
import { mockData } from './mockData';
|
|
8
|
+
|
|
9
|
+
let store;
|
|
10
|
+
beforeAll(() => {
|
|
11
|
+
store = configureStore({}, browserHistory);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
jest.mock('../Content', () => ({
|
|
15
|
+
__esModule: true,
|
|
16
|
+
default: (props) => (
|
|
17
|
+
<div className="LineImageCarouselContent-mock" {...props}>
|
|
18
|
+
LineImageCarouselContent
|
|
19
|
+
</div>
|
|
20
|
+
),
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
describe('line wrapper test/>', () => {
|
|
24
|
+
let renderedComponent;
|
|
25
|
+
const formatMessage = jest.fn();
|
|
26
|
+
const updateMessageState = jest.fn();
|
|
27
|
+
const getAllTemplates = jest.fn();
|
|
28
|
+
const renderHelper = (Line, Templates, content, activeKey) => {
|
|
29
|
+
renderedComponent = mountWithIntl(
|
|
30
|
+
<Provider store={store}>
|
|
31
|
+
<LineImageCarousel
|
|
32
|
+
id="flex__0"
|
|
33
|
+
intl={{ formatMessage }}
|
|
34
|
+
isFullMode={true}
|
|
35
|
+
index={0}
|
|
36
|
+
activeKey={activeKey}
|
|
37
|
+
Line={Line}
|
|
38
|
+
Templates={Templates}
|
|
39
|
+
content={content}
|
|
40
|
+
updateMessageState={updateMessageState}
|
|
41
|
+
getAllTemplates={getAllTemplates}
|
|
42
|
+
/>
|
|
43
|
+
</Provider>,
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
it('should render line component new', () => {
|
|
48
|
+
const { lineData1, Templates1, content3 } = mockData;
|
|
49
|
+
renderHelper(lineData1, Templates1, content3, 'flex');
|
|
50
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should render line component old', () => {
|
|
54
|
+
const { lineData2, Templates2, content4 } = mockData;
|
|
55
|
+
renderHelper(lineData2, Templates2, content4, 0);
|
|
56
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
57
|
+
});
|
|
58
|
+
});
|