@capillarytech/creatives-library 7.12.44 → 7.12.45
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/v2Containers/Cap/tests/index.test.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +8 -7
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +30 -20
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +303 -12
- 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 +24 -35
- package/v2Containers/Line/Container/ImageCarousel/messages.js +4 -0
- 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 +2 -0
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +59589 -0
- package/v2Containers/Line/Container/tests/index.test.js +105 -0
- package/v2Containers/Line/Container/tests/mockData.js +1334 -0
- package/v2Containers/mockdata.js +68 -11
|
@@ -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
|
+
});
|