@blaze-cms/react-page-builder 0.135.0 → 0.136.0-alpha.0
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/CHANGELOG.md +15 -0
- package/lib/components/Banner/AdSlotRender.js +12 -3
- package/lib/components/Banner/AdSlotRender.js.map +1 -1
- package/lib/components/Banner/Banner.js +4 -7
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/BannerRender.js +7 -3
- package/lib/components/Banner/BannerRender.js.map +1 -1
- package/lib/components/Banner/helpers.js +2 -2
- package/lib/components/Banner/helpers.js.map +1 -1
- package/lib/components/BlazeLink.js +2 -2
- package/lib/components/BlazeLink.js.map +1 -1
- package/lib/components/Button.js +2 -2
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/CardsContainer.js +2 -2
- package/lib/components/Card/CardsContainer.js.map +1 -1
- package/lib/components/Card/CardsRender.js +2 -2
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Card/helpers/filter-query-setup.js +2 -2
- package/lib/components/Card/helpers/filter-query-setup.js.map +1 -1
- package/lib/components/ClickWrapper.js +2 -2
- package/lib/components/ClickWrapper.js.map +1 -1
- package/lib/components/Code/Code.js +2 -2
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js +2 -0
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib/components/Image/Image.js +2 -2
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Layout/Layout.js +2 -2
- package/lib/components/Layout/Layout.js.map +1 -1
- package/lib/components/List/ListBuilder.js +2 -2
- package/lib/components/List/ListBuilder.js.map +1 -1
- package/lib/components/List/ListFactory.js +2 -2
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRender.js +2 -2
- package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib/components/List/components/Full/FullRender.js +2 -2
- package/lib/components/List/components/Full/FullRender.js.map +1 -1
- package/lib/components/List/components/Full/FullRenderItem.js +2 -2
- package/lib/components/List/components/Full/FullRenderItem.js.map +1 -1
- package/lib/components/List/components/Pagination/ListPagination.js +2 -2
- package/lib/components/List/components/Pagination/ListPagination.js.map +1 -1
- package/lib/components/List/helpers/build-az-url.js +2 -2
- package/lib/components/List/helpers/build-az-url.js.map +1 -1
- package/lib/components/List/helpers/build-pagination-url.js +2 -2
- package/lib/components/List/helpers/build-pagination-url.js.map +1 -1
- package/lib/components/SearchFilter/components/Range.js +2 -2
- package/lib/components/SearchFilter/components/Range.js.map +1 -1
- package/lib/components/SearchFilter/searchFilterReducer.js +2 -2
- package/lib/components/SearchFilterSort/helpers/update-sort.js +2 -2
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/components/TextBlock/index.js +2 -2
- package/lib/components/TextBlock/index.js.map +1 -1
- package/lib/components/Video/Video.js +2 -2
- package/lib/components/Video/Video.js.map +1 -1
- package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js +2 -2
- package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js.map +1 -1
- package/lib/helpers/append-images.js +2 -2
- package/lib/helpers/build-raw-query-base.js +2 -2
- package/lib/helpers/build-raw-query-base.js.map +1 -1
- package/lib/helpers/build-raw-query.js +2 -2
- package/lib/helpers/build-raw-query.js.map +1 -1
- package/lib/helpers/get-banner-data.js +2 -2
- package/lib/helpers/get-click-wrapper-options.js +2 -2
- package/lib/helpers/get-click-wrapper-options.js.map +1 -1
- package/lib/helpers/get-entities-with-banner.js +2 -2
- package/lib/helpers/get-entities-with-banner.js.map +1 -1
- package/lib/helpers/get-generic-props.js +2 -2
- package/lib/helpers/get-generic-props.js.map +1 -1
- package/lib/helpers/get-generic-render-variables.js +2 -2
- package/lib/helpers/get-generic-render-variables.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js +2 -2
- package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js.map +1 -1
- package/lib/helpers/process-data-summary-value.js +2 -2
- package/lib/helpers/process-data-summary-value.js.map +1 -1
- package/lib/helpers/remove-unwanted-characters.js +2 -2
- package/lib/helpers/render-children.js +2 -2
- package/lib/helpers/render-children.js.map +1 -1
- package/lib/helpers/split-children.js +2 -2
- package/lib/helpers/update-childrens-parent.js +2 -2
- package/lib/hooks/helpers/append-gtm-classname.js +2 -2
- package/lib/hooks/helpers/append-gtm-classname.js.map +1 -1
- package/lib/hooks/helpers/buildPBComponents.js +2 -2
- package/lib/hooks/helpers/buildPBComponents.js.map +1 -1
- package/lib/hooks/helpers/get-lightbox-images.js +2 -2
- package/lib/hooks/helpers/get-lightbox-images.js.map +1 -1
- package/lib/hooks/helpers/inject-element-banners.js +2 -2
- package/lib/hooks/helpers/inject-element-banners.js.map +1 -1
- package/lib/hooks/helpers/inject-textblock-banners.js +2 -2
- package/lib/hooks/helpers/inject-textblock-banners.js.map +1 -1
- package/lib/utils/get-class-modifiers.js +2 -2
- package/lib/utils/get-class-modifiers.js.map +1 -1
- package/lib-es/components/Banner/AdSlotRender.js +12 -3
- package/lib-es/components/Banner/AdSlotRender.js.map +1 -1
- package/lib-es/components/Banner/Banner.js +4 -7
- package/lib-es/components/Banner/Banner.js.map +1 -1
- package/lib-es/components/Banner/BannerRender.js +8 -4
- package/lib-es/components/Banner/BannerRender.js.map +1 -1
- package/lib-es/components/Banner/helpers.js +2 -2
- package/lib-es/components/BlazeLink.js +2 -2
- package/lib-es/components/Button.js +2 -2
- package/lib-es/components/Card/CardsContainer.js +2 -2
- package/lib-es/components/Card/CardsRender.js +2 -2
- package/lib-es/components/Card/helpers/filter-query-setup.js +2 -2
- package/lib-es/components/ClickWrapper.js +2 -2
- package/lib-es/components/Code/Code.js +2 -2
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +2 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib-es/components/Image/Image.js +2 -2
- package/lib-es/components/Layout/Layout.js +2 -2
- package/lib-es/components/List/ListBuilder.js +2 -2
- package/lib-es/components/List/ListFactory.js +2 -2
- package/lib-es/components/List/components/Cards/CardsRender.js +2 -2
- package/lib-es/components/List/components/Full/FullRender.js +2 -2
- package/lib-es/components/List/components/Full/FullRenderItem.js +2 -2
- package/lib-es/components/List/components/Pagination/ListPagination.js +2 -2
- package/lib-es/components/List/helpers/build-az-url.js +2 -2
- package/lib-es/components/List/helpers/build-pagination-url.js +2 -2
- package/lib-es/components/SearchFilter/components/Range.js +2 -2
- package/lib-es/components/SearchFilter/searchFilterReducer.js +2 -2
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js +2 -2
- package/lib-es/components/TextBlock/index.js +2 -2
- package/lib-es/components/Video/Video.js +2 -2
- package/lib-es/components/Video/providers/JWPlayer/JWPlayerProvider.js +2 -2
- package/lib-es/helpers/append-images.js +2 -2
- package/lib-es/helpers/build-raw-query-base.js +2 -2
- package/lib-es/helpers/build-raw-query.js +2 -2
- package/lib-es/helpers/get-banner-data.js +2 -2
- package/lib-es/helpers/get-click-wrapper-options.js +2 -2
- package/lib-es/helpers/get-entities-with-banner.js +2 -2
- package/lib-es/helpers/get-generic-props.js +2 -2
- package/lib-es/helpers/get-generic-render-variables.js +2 -2
- package/lib-es/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js +2 -2
- package/lib-es/helpers/process-data-summary-value.js +2 -2
- package/lib-es/helpers/remove-unwanted-characters.js +2 -2
- package/lib-es/helpers/render-children.js +2 -2
- package/lib-es/helpers/split-children.js +2 -2
- package/lib-es/helpers/update-childrens-parent.js +2 -2
- package/lib-es/hooks/helpers/append-gtm-classname.js +2 -2
- package/lib-es/hooks/helpers/buildPBComponents.js +2 -2
- package/lib-es/hooks/helpers/get-lightbox-images.js +2 -2
- package/lib-es/hooks/helpers/inject-element-banners.js +2 -2
- package/lib-es/hooks/helpers/inject-textblock-banners.js +2 -2
- package/lib-es/utils/get-class-modifiers.js +2 -2
- package/package.json +3 -3
- package/src/components/Banner/AdSlotRender.js +9 -5
- package/src/components/Banner/Banner.js +9 -11
- package/src/components/Banner/BannerRender.js +4 -0
- package/src/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -1
- package/tests/unit/src/components/Banner/AdSlotRender.test.js +6 -11
- package/tests/unit/src/components/Banner/__snapshots__/AdSlotRender.test.js.snap +45 -25
- package/tests/unit/src/components/Banner/__snapshots__/BannerRender.test.js.snap +8 -3
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +41 -0
- package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +21 -0
- package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +87 -0
- package/tests/unit/src/components/PlaceholderIcon/index.test.js +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.136.0-alpha.0",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@blaze-cms/core-errors-ui": "^0.131.0",
|
|
33
33
|
"@blaze-cms/image-cdn-react": "0.3.0-alpha.6",
|
|
34
34
|
"@blaze-cms/nextjs-components": "^0.134.0",
|
|
35
|
-
"@blaze-cms/plugin-search-ui": "
|
|
35
|
+
"@blaze-cms/plugin-search-ui": "0.136.0-alpha.0",
|
|
36
36
|
"@blaze-cms/setup-ui": "^0.131.0",
|
|
37
37
|
"@blaze-cms/utils": "^0.131.0",
|
|
38
38
|
"@blaze-cms/utils-handlebars": "^0.134.0",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"lib/*",
|
|
90
90
|
"lib-es/*"
|
|
91
91
|
],
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "1097c61e5ff2f2e0bc67772fb489efdd80e10d90"
|
|
93
93
|
}
|
|
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { AdSlot } from 'react-dfp';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { BANNER_LOADING, BANNER_EMPTY, BANNER_LOADED } from '../../constants';
|
|
5
|
+
import Wrapper from '../Wrapper';
|
|
5
6
|
|
|
6
7
|
const AdSlotRender = ({
|
|
7
8
|
shouldShowBanner,
|
|
@@ -9,6 +10,7 @@ const AdSlotRender = ({
|
|
|
9
10
|
sizeId,
|
|
10
11
|
parsedAdunit,
|
|
11
12
|
parsedSizes,
|
|
13
|
+
modifiers,
|
|
12
14
|
targetingArguments
|
|
13
15
|
}) => {
|
|
14
16
|
const [{ loadingStatus = BANNER_LOADING, minHeight }, setLoadingStatus] = useState({});
|
|
@@ -24,11 +26,11 @@ const AdSlotRender = ({
|
|
|
24
26
|
})
|
|
25
27
|
.sort();
|
|
26
28
|
const className = `ad-slot ad-slot-${loadingStatus} ${bannerClass}`;
|
|
27
|
-
|
|
29
|
+
const newModifers = `${modifiers} banner-${loadingStatus}`;
|
|
28
30
|
return (
|
|
29
|
-
|
|
31
|
+
<Wrapper className="banner" modifiers={newModifers}>
|
|
30
32
|
{styles && <style>{styles.join('\n')}</style>}
|
|
31
|
-
<div className={className} style={{ minHeight }}>
|
|
33
|
+
<div className={className} style={{ minHeight }} data-testid="ad-slot">
|
|
32
34
|
{shouldShowBanner && (
|
|
33
35
|
<AdSlot
|
|
34
36
|
adUnit={parsedAdunit}
|
|
@@ -46,7 +48,7 @@ const AdSlotRender = ({
|
|
|
46
48
|
/>
|
|
47
49
|
)}
|
|
48
50
|
</div>
|
|
49
|
-
|
|
51
|
+
</Wrapper>
|
|
50
52
|
);
|
|
51
53
|
};
|
|
52
54
|
|
|
@@ -56,11 +58,13 @@ AdSlotRender.propTypes = {
|
|
|
56
58
|
sizeId: PropTypes.string.isRequired,
|
|
57
59
|
parsedAdunit: PropTypes.string.isRequired,
|
|
58
60
|
parsedSizes: PropTypes.array,
|
|
61
|
+
modifiers: PropTypes.string,
|
|
59
62
|
targetingArguments: PropTypes.object.isRequired
|
|
60
63
|
};
|
|
61
64
|
|
|
62
65
|
AdSlotRender.defaultProps = {
|
|
63
|
-
parsedSizes: null
|
|
66
|
+
parsedSizes: null,
|
|
67
|
+
modifiers: ''
|
|
64
68
|
};
|
|
65
69
|
|
|
66
70
|
export default AdSlotRender;
|
|
@@ -7,7 +7,6 @@ import { useQuery } from '@apollo/client';
|
|
|
7
7
|
import { useRouter } from 'next/router';
|
|
8
8
|
import { buildUserQuery, buildPropsData } from './helpers';
|
|
9
9
|
import { getSingleEntitySchema, getUser } from '../../application/query';
|
|
10
|
-
import Wrapper from '../Wrapper';
|
|
11
10
|
import BannerRender from './BannerRender';
|
|
12
11
|
import buildPropsQuery from '../../helpers/build-props-query';
|
|
13
12
|
import { getClassModifiers } from '../../utils';
|
|
@@ -47,16 +46,15 @@ const Banner = ({ type, ...otherProps }) => {
|
|
|
47
46
|
const bannerKey = `${sizeId}${asPath}`;
|
|
48
47
|
|
|
49
48
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</Wrapper>
|
|
49
|
+
<BannerRender
|
|
50
|
+
key={bannerKey}
|
|
51
|
+
{...otherProps}
|
|
52
|
+
action={action}
|
|
53
|
+
actionKey={actionKey}
|
|
54
|
+
asPath={asPath}
|
|
55
|
+
userPropsData={userPropsData}
|
|
56
|
+
modifiers={modifiers}
|
|
57
|
+
/>
|
|
60
58
|
);
|
|
61
59
|
};
|
|
62
60
|
|
|
@@ -34,6 +34,7 @@ const BannerRender = ({
|
|
|
34
34
|
actionKey,
|
|
35
35
|
renderCounter,
|
|
36
36
|
userPropsData,
|
|
37
|
+
modifiers,
|
|
37
38
|
...otherProps
|
|
38
39
|
}) => {
|
|
39
40
|
const { id } = otherProps;
|
|
@@ -90,6 +91,7 @@ const BannerRender = ({
|
|
|
90
91
|
sizeId={sizeId}
|
|
91
92
|
parsedAdunit={parsedAdunit}
|
|
92
93
|
parsedSizes={parsedSizes}
|
|
94
|
+
modifiers={modifiers}
|
|
93
95
|
targetingArguments={targetingArguments}
|
|
94
96
|
/>
|
|
95
97
|
);
|
|
@@ -108,6 +110,7 @@ BannerRender.propTypes = {
|
|
|
108
110
|
targetings: PropTypes.string,
|
|
109
111
|
sizes: PropTypes.string,
|
|
110
112
|
renderCounter: PropTypes.number,
|
|
113
|
+
modifiers: PropTypes.string,
|
|
111
114
|
userPropsData: PropTypes.object
|
|
112
115
|
};
|
|
113
116
|
|
|
@@ -120,6 +123,7 @@ BannerRender.defaultProps = {
|
|
|
120
123
|
targetings: '',
|
|
121
124
|
sizes: '',
|
|
122
125
|
renderCounter: null,
|
|
126
|
+
modifiers: '',
|
|
123
127
|
userPropsData: {}
|
|
124
128
|
};
|
|
125
129
|
|
|
@@ -45,11 +45,12 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
45
45
|
|
|
46
46
|
return propertiesToDisplay.map(key => {
|
|
47
47
|
const loopValue = loopValues[key];
|
|
48
|
-
const
|
|
48
|
+
const loopValueItem = loopValue && loopValue[i];
|
|
49
|
+
const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
49
50
|
if (!propValue) return null;
|
|
50
51
|
|
|
51
52
|
const processedValue = processDataSummaryValue(propValue, options);
|
|
52
|
-
const linkToPublishedContent = getLinkToPublishedContent(key, data);
|
|
53
|
+
const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);
|
|
53
54
|
return [upperFirst(label), processedValue, linkToPublishedContent, modifier];
|
|
54
55
|
});
|
|
55
56
|
})
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
const getLinkToPublishedContent = (key = '', props = {}) => {
|
|
1
|
+
const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {
|
|
2
2
|
const [baseKey] = key.split('.');
|
|
3
3
|
if (!props[baseKey]) return '';
|
|
4
|
+
|
|
5
|
+
if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
|
|
6
|
+
|
|
4
7
|
const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
|
|
5
8
|
return content && content.url ? content.url : '';
|
|
6
9
|
};
|
|
@@ -50,17 +50,17 @@ describe('Banner render component', () => {
|
|
|
50
50
|
<AdSlotRender {...defaultProps} shouldShowBanner={false} />
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
expect(container.childNodes[0].nodeName).toEqual('
|
|
54
|
-
expect(
|
|
53
|
+
expect(container.childNodes[0].nodeName).toEqual('DIV');
|
|
54
|
+
expect(getByTestId('ad-slot')).toHaveClass('ad-slot ad-slot-loading banner-sizeId');
|
|
55
55
|
expect(() => getByTestId(slotTestId)).toThrow();
|
|
56
56
|
expect(asFragment()).toMatchSnapshot();
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
describe('AdSlot loading', () => {
|
|
60
60
|
it('should render AdSlot', () => {
|
|
61
|
-
const { asFragment,
|
|
61
|
+
const { asFragment, getByTestId } = render(<AdSlotRender {...defaultProps} />);
|
|
62
62
|
expect(getByTestId('adslot-test')).toBeDefined();
|
|
63
|
-
expect(
|
|
63
|
+
expect(getByTestId('ad-slot')).toHaveClass('ad-slot ad-slot-loading banner-sizeId');
|
|
64
64
|
expect(asFragment()).toMatchSnapshot();
|
|
65
65
|
});
|
|
66
66
|
|
|
@@ -69,16 +69,11 @@ describe('Banner render component', () => {
|
|
|
69
69
|
const adSlot = getByTestId(slotTestId);
|
|
70
70
|
|
|
71
71
|
fireEvent.mouseOver(adSlot);
|
|
72
|
-
await waitFor(() =>
|
|
73
|
-
expect(container.childNodes[0]).toHaveClass('ad-slot ad-slot-loaded banner-sizeId')
|
|
74
|
-
);
|
|
75
|
-
expect(container.childNodes[0]).toHaveStyle('min-height: 250px');
|
|
72
|
+
await waitFor(() => expect(container.childNodes[0]).toHaveClass('banner banner-loaded'));
|
|
76
73
|
expect(asFragment()).toMatchSnapshot();
|
|
77
74
|
|
|
78
75
|
fireEvent.mouseLeave(adSlot);
|
|
79
|
-
await waitFor(() =>
|
|
80
|
-
expect(container.childNodes[0]).toHaveClass('ad-slot ad-slot-empty banner-sizeId')
|
|
81
|
-
);
|
|
76
|
+
await waitFor(() => expect(container.childNodes[0]).toHaveClass('banner banner-empty'));
|
|
82
77
|
expect(asFragment()).toMatchSnapshot();
|
|
83
78
|
});
|
|
84
79
|
});
|
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
exports[`Banner render component AdSlot loading should change class and remove responsive styles after loaded events 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="
|
|
7
|
-
style="min-height: 250px;"
|
|
6
|
+
class="banner banner-loaded"
|
|
8
7
|
>
|
|
9
8
|
<div
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
class="ad-slot ad-slot-loaded banner-sizeId"
|
|
10
|
+
data-testid="ad-slot"
|
|
11
|
+
style="min-height: 250px;"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
data-testid="adslot-test"
|
|
15
|
+
role="button"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
13
18
|
</div>
|
|
14
19
|
</DocumentFragment>
|
|
15
20
|
`;
|
|
@@ -17,44 +22,59 @@ exports[`Banner render component AdSlot loading should change class and remove r
|
|
|
17
22
|
exports[`Banner render component AdSlot loading should change class and remove responsive styles after loaded events 2`] = `
|
|
18
23
|
<DocumentFragment>
|
|
19
24
|
<div
|
|
20
|
-
class="
|
|
21
|
-
style=""
|
|
25
|
+
class="banner banner-empty"
|
|
22
26
|
>
|
|
23
27
|
<div
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
class="ad-slot ad-slot-empty banner-sizeId"
|
|
29
|
+
data-testid="ad-slot"
|
|
30
|
+
style=""
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
data-testid="adslot-test"
|
|
34
|
+
role="button"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
27
37
|
</div>
|
|
28
38
|
</DocumentFragment>
|
|
29
39
|
`;
|
|
30
40
|
|
|
31
41
|
exports[`Banner render component AdSlot loading should render AdSlot 1`] = `
|
|
32
42
|
<DocumentFragment>
|
|
33
|
-
<style>
|
|
34
|
-
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
35
|
-
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
36
|
-
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
37
|
-
</style>
|
|
38
43
|
<div
|
|
39
|
-
class="
|
|
44
|
+
class="banner banner-loading"
|
|
40
45
|
>
|
|
46
|
+
<style>
|
|
47
|
+
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
48
|
+
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
49
|
+
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
50
|
+
</style>
|
|
41
51
|
<div
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
53
|
+
data-testid="ad-slot"
|
|
54
|
+
>
|
|
55
|
+
<div
|
|
56
|
+
data-testid="adslot-test"
|
|
57
|
+
role="button"
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
45
60
|
</div>
|
|
46
61
|
</DocumentFragment>
|
|
47
62
|
`;
|
|
48
63
|
|
|
49
64
|
exports[`Banner render component should not render AdSlot if shouldShowBanner=false but should render styles and wrapper 1`] = `
|
|
50
65
|
<DocumentFragment>
|
|
51
|
-
<
|
|
52
|
-
|
|
66
|
+
<div
|
|
67
|
+
class="banner banner-loading"
|
|
68
|
+
>
|
|
69
|
+
<style>
|
|
70
|
+
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
53
71
|
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
54
72
|
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
</style>
|
|
74
|
+
<div
|
|
75
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
76
|
+
data-testid="ad-slot"
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
59
79
|
</DocumentFragment>
|
|
60
80
|
`;
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Banner render component should render 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<style />
|
|
6
5
|
<div
|
|
7
|
-
class="
|
|
8
|
-
|
|
6
|
+
class="banner banner-loading"
|
|
7
|
+
>
|
|
8
|
+
<style />
|
|
9
|
+
<div
|
|
10
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
11
|
+
data-testid="ad-slot"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
9
14
|
</DocumentFragment>
|
|
10
15
|
`;
|
|
@@ -90,4 +90,45 @@ describe('buildLoopPropsContent helper function', () => {
|
|
|
90
90
|
});
|
|
91
91
|
expect.hasAssertions();
|
|
92
92
|
});
|
|
93
|
+
|
|
94
|
+
it('should nested items with urls', () => {
|
|
95
|
+
const data = {
|
|
96
|
+
nestedLoopProp: [
|
|
97
|
+
{
|
|
98
|
+
nestedValue: 'abc',
|
|
99
|
+
url: 'http://blazecms.app/abc'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
nestedValue: '123',
|
|
103
|
+
url: 'http://blazecms.app/123'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
nestedValue: 'no url',
|
|
107
|
+
url: null
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
};
|
|
111
|
+
const withUrl = buildLoopPropsContent(
|
|
112
|
+
mockedLoopProps,
|
|
113
|
+
[
|
|
114
|
+
{
|
|
115
|
+
bold: false,
|
|
116
|
+
enableLink: true,
|
|
117
|
+
label: '',
|
|
118
|
+
modifier: '',
|
|
119
|
+
prefix: '',
|
|
120
|
+
propertiesToDisplay: ['nestedLoopProp.nestedValue'],
|
|
121
|
+
shouldStrip: true
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
0,
|
|
125
|
+
data
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
withUrl.forEach(([, value, url], index) => {
|
|
129
|
+
expect(value).toEqual(data.nestedLoopProp[index].nestedValue);
|
|
130
|
+
expect(url).toEqual(data.nestedLoopProp[index].url || '');
|
|
131
|
+
});
|
|
132
|
+
expect.hasAssertions();
|
|
133
|
+
});
|
|
93
134
|
});
|
|
@@ -38,4 +38,25 @@ describe('get link to published content', () => {
|
|
|
38
38
|
const result = getLinkToPublishedContent(publishedKey, props);
|
|
39
39
|
expect(result).toEqual('');
|
|
40
40
|
});
|
|
41
|
+
|
|
42
|
+
it('should return url from the currentValue', () => {
|
|
43
|
+
const currentValue = { url: 'currentValueUrl' };
|
|
44
|
+
const props = { content: [content] };
|
|
45
|
+
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
46
|
+
expect(result).toEqual(currentValue.url);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should return url from the currentValue even if falsey', () => {
|
|
50
|
+
const currentValue = { url: null };
|
|
51
|
+
const props = { content: [content] };
|
|
52
|
+
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
53
|
+
expect(result).toEqual(currentValue.url);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should not return url from the currentValue if not set', () => {
|
|
57
|
+
const currentValue = {};
|
|
58
|
+
const props = { content: [content] };
|
|
59
|
+
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
60
|
+
expect(result).toEqual(content.url);
|
|
61
|
+
});
|
|
41
62
|
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Placeholder component should render PlaceholderIcon 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="editor-view__placeholder"
|
|
7
|
+
data-testid="placeholder-icon"
|
|
8
|
+
>
|
|
9
|
+
<svg
|
|
10
|
+
height="25px"
|
|
11
|
+
version="1.1"
|
|
12
|
+
viewBox="0 0 20 20"
|
|
13
|
+
width="25px"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
16
|
+
>
|
|
17
|
+
<title>
|
|
18
|
+
card
|
|
19
|
+
</title>
|
|
20
|
+
<g
|
|
21
|
+
fill="none"
|
|
22
|
+
fill-rule="evenodd"
|
|
23
|
+
id="Icons"
|
|
24
|
+
stroke="none"
|
|
25
|
+
stroke-width="1"
|
|
26
|
+
>
|
|
27
|
+
<g
|
|
28
|
+
id="card"
|
|
29
|
+
transform="translate(-259, -214)"
|
|
30
|
+
>
|
|
31
|
+
<g
|
|
32
|
+
transform="translate(259, 214)"
|
|
33
|
+
>
|
|
34
|
+
<g
|
|
35
|
+
id="Group-7"
|
|
36
|
+
transform="translate(1, 1)"
|
|
37
|
+
>
|
|
38
|
+
<path
|
|
39
|
+
d="M1.07,10 C3.04212623,8.18723771 4.14171262,7.28085657 4.36875916,7.28085657 C4.79707626,7.28085657 7,9 7.5,9 C8.40867615,9 12.0764465,4.56171314 12.9,4.56171314 C13.4490356,4.56171314 14.8390356,5.81447543 17.07,8.32"
|
|
40
|
+
fill-rule="nonzero"
|
|
41
|
+
id="Path-3"
|
|
42
|
+
stroke="none"
|
|
43
|
+
stroke-width="1.3"
|
|
44
|
+
/>
|
|
45
|
+
<path
|
|
46
|
+
d="M5.00003877,4.07973585 C5.00003879,3.4834142 5.50109477,3 6.11917864,3 C6.73726251,3 7.2383185,3.4834142 7.2383185,4.07973585 C7.2383185,4.6760575 6.73726252,5.15947172 6.11917864,5.15947172 C5.82268209,5.15728623 5.53857972,5.04442179 5.32645457,4.84454876 C5.11586241,4.64208328 4.99827309,4.36656405 5.00003877,4.07973585 Z"
|
|
47
|
+
fill="#899BBC"
|
|
48
|
+
fill-rule="nonzero"
|
|
49
|
+
id="Path"
|
|
50
|
+
/>
|
|
51
|
+
<path
|
|
52
|
+
d="M3.375,14.625 C3.375,14.3143398 3.62683983,14.0625 3.9375,14.0625 L14.0625,14.0625 C14.3731602,14.0625 14.625,14.3143398 14.625,14.625 C14.625,14.9356602 14.3731602,15.1875 14.0625,15.1875 L3.9375,15.1875 C3.62683983,15.1875 3.375,14.9356602 3.375,14.625 Z"
|
|
53
|
+
fill="#899BBC"
|
|
54
|
+
fill-rule="nonzero"
|
|
55
|
+
id="Shape"
|
|
56
|
+
/>
|
|
57
|
+
<rect
|
|
58
|
+
height="16.7"
|
|
59
|
+
id="Rectangle"
|
|
60
|
+
rx="2"
|
|
61
|
+
stroke="#899BBC"
|
|
62
|
+
stroke-width="1.3"
|
|
63
|
+
width="16.7"
|
|
64
|
+
x="0.65"
|
|
65
|
+
y="0.65"
|
|
66
|
+
/>
|
|
67
|
+
<line
|
|
68
|
+
id="Line-2"
|
|
69
|
+
stroke="#899BBC"
|
|
70
|
+
stroke-linecap="square"
|
|
71
|
+
stroke-width="1.3"
|
|
72
|
+
x1="1"
|
|
73
|
+
x2="16.5625"
|
|
74
|
+
y1="11.8125"
|
|
75
|
+
y2="11.8125"
|
|
76
|
+
/>
|
|
77
|
+
</g>
|
|
78
|
+
</g>
|
|
79
|
+
</g>
|
|
80
|
+
</g>
|
|
81
|
+
</svg>
|
|
82
|
+
<span>
|
|
83
|
+
card
|
|
84
|
+
</span>
|
|
85
|
+
</div>
|
|
86
|
+
</DocumentFragment>
|
|
87
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
import { render } from '@blaze-cms/tools/test-helpers/test-functions';
|
|
5
|
+
|
|
6
|
+
import PlaceholderIcon from '../../../../../../blaze-plugin-page-builder-ui/src/components/EditorView/PlaceholderIcon';
|
|
7
|
+
import { CardIcon } from '../../../../../../blaze-plugin-page-builder-ui/src/Icons';
|
|
8
|
+
|
|
9
|
+
const mockedProps = {
|
|
10
|
+
type: 'card',
|
|
11
|
+
icon: CardIcon
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
describe('Placeholder component', () => {
|
|
15
|
+
it('should render PlaceholderIcon', () => {
|
|
16
|
+
const { asFragment, getByTestId } = render(PlaceholderIcon, mockedProps);
|
|
17
|
+
expect(getByTestId('placeholder-icon')).toBeDefined();
|
|
18
|
+
expect(asFragment()).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
});
|