@capillarytech/creatives-library 7.12.43 → 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/index.js +2 -2
- package/v2Containers/Line/Container/Wrapper/messages.js +2 -2
- 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/constants.js +1 -1
- 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,13 @@
|
|
|
1
|
+
import { calculateAspectRatio } from '../utils';
|
|
2
|
+
|
|
3
|
+
describe('calculateAspectRatio -- Test', () => {
|
|
4
|
+
it('Should return aspect ratio 1:1', () =>
|
|
5
|
+
expect(calculateAspectRatio(400, 400)).toEqual('1:1'));
|
|
6
|
+
it('Should return aspect ratio 1:2', () =>
|
|
7
|
+
expect(calculateAspectRatio(400, 800)).toEqual('1:2'));
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
describe('calculateGCD -- Test', () => {
|
|
11
|
+
it('Should return gcd', () =>
|
|
12
|
+
expect(calculateAspectRatio(400, 400)).toEqual('1:1'));
|
|
13
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const calculateGCD = (width, height) => {
|
|
2
|
+
while (height !== 0) {
|
|
3
|
+
const reminder = width % height;
|
|
4
|
+
width = height;
|
|
5
|
+
height = reminder;
|
|
6
|
+
}
|
|
7
|
+
return Math.abs(width);
|
|
8
|
+
};
|
|
9
|
+
export const calculateAspectRatio = (width, height) => {
|
|
10
|
+
const absValue = calculateGCD(width, height);
|
|
11
|
+
return `${width / absValue}:${height / absValue}`;
|
|
12
|
+
};
|
|
@@ -6,7 +6,7 @@ import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
|
6
6
|
import CapModal from '@capillarytech/cap-ui-library/CapModal';
|
|
7
7
|
import style, { CapModalStyles } from './style';
|
|
8
8
|
import withStyles from '../../../../hoc/withStyles';
|
|
9
|
-
import { TEXT,
|
|
9
|
+
import { TEXT, TEMPLATE } from '../constants';
|
|
10
10
|
import { getTabPanes } from './utils';
|
|
11
11
|
import messages from './messages';
|
|
12
12
|
import { CAP_SPACE_16, CAP_SPACE_08 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
@@ -30,7 +30,7 @@ export const LineWrapper = ({
|
|
|
30
30
|
const [isConfirmModalVisible, togglePopup] = useState(false);
|
|
31
31
|
|
|
32
32
|
useEffect(() => {
|
|
33
|
-
updateActiveKey(selectedType);
|
|
33
|
+
updateActiveKey(selectedType === 'template' ? TEMPLATE : selectedType);
|
|
34
34
|
}, [selectedType]);
|
|
35
35
|
|
|
36
36
|
const onTabChange = (type) => {
|
|
@@ -43,8 +43,8 @@ export default defineMessages({
|
|
|
43
43
|
id: `${scope}.imagemapLabel`,
|
|
44
44
|
defaultMessage: 'Rich message',
|
|
45
45
|
},
|
|
46
|
-
"
|
|
47
|
-
id: `${scope}.
|
|
46
|
+
"flexLabel": {
|
|
47
|
+
id: `${scope}.flexLabel`,
|
|
48
48
|
defaultMessage: 'Card message',
|
|
49
49
|
},
|
|
50
50
|
"videoLabel": {
|