@blaze-cms/react-page-builder 0.133.0 → 0.134.0-project-admin-customisations.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/lib/components/Banner/AdSlotRender.js +12 -3
  3. package/lib/components/Banner/AdSlotRender.js.map +1 -1
  4. package/lib/components/Banner/Banner.js +4 -7
  5. package/lib/components/Banner/Banner.js.map +1 -1
  6. package/lib/components/Banner/BannerRender.js +5 -1
  7. package/lib/components/Banner/BannerRender.js.map +1 -1
  8. package/lib/components/ContentGroupSection/ContentGroupSection.js +1 -4
  9. package/lib/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
  10. package/lib/components/DataSummary/helpers/build-loop-props-content.js +3 -2
  11. package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  12. package/lib/components/DataSummary/helpers/get-link-to-published-content.js +2 -0
  13. package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
  14. package/lib/components/SearchFilter/components/Checkbox.js +1 -3
  15. package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
  16. package/lib-es/components/Banner/AdSlotRender.js +12 -3
  17. package/lib-es/components/Banner/AdSlotRender.js.map +1 -1
  18. package/lib-es/components/Banner/Banner.js +4 -7
  19. package/lib-es/components/Banner/Banner.js.map +1 -1
  20. package/lib-es/components/Banner/BannerRender.js +6 -2
  21. package/lib-es/components/Banner/BannerRender.js.map +1 -1
  22. package/lib-es/components/ContentGroupSection/ContentGroupSection.js +4 -8
  23. package/lib-es/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
  24. package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +3 -2
  25. package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  26. package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +2 -1
  27. package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
  28. package/lib-es/components/SearchFilter/components/Checkbox.js +1 -3
  29. package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
  30. package/package.json +10 -10
  31. package/src/components/Banner/AdSlotRender.js +9 -5
  32. package/src/components/Banner/Banner.js +9 -11
  33. package/src/components/Banner/BannerRender.js +4 -0
  34. package/src/components/ContentGroupSection/ContentGroupSection.js +1 -1
  35. package/src/components/DataSummary/helpers/build-loop-props-content.js +3 -2
  36. package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -1
  37. package/src/components/SearchFilter/components/Checkbox.js +0 -2
  38. package/tests/unit/src/components/Banner/AdSlotRender.test.js +6 -11
  39. package/tests/unit/src/components/Banner/__snapshots__/AdSlotRender.test.js.snap +45 -25
  40. package/tests/unit/src/components/Banner/__snapshots__/BannerRender.test.js.snap +8 -3
  41. package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +41 -0
  42. package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +21 -0
  43. package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +72 -0
  44. package/tests/unit/src/components/PlaceholderIcon/index.test.js +20 -0
@@ -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="ad-slot ad-slot-loaded banner-sizeId"
7
- style="min-height: 250px;"
6
+ class="banner banner-loaded"
8
7
  >
9
8
  <div
10
- data-testid="adslot-test"
11
- role="button"
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="ad-slot ad-slot-empty banner-sizeId"
21
- style=""
25
+ class="banner banner-empty"
22
26
  >
23
27
  <div
24
- data-testid="adslot-test"
25
- role="button"
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="ad-slot ad-slot-loading banner-sizeId"
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
- data-testid="adslot-test"
43
- role="button"
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
- <style>
52
- @media(min-width:320px){.banner-sizeId{min-height:100px;}
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
- </style>
56
- <div
57
- class="ad-slot ad-slot-loading banner-sizeId"
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="ad-slot ad-slot-loading banner-sizeId"
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,72 @@
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 16 16"
13
+ width="25px"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ >
16
+ <title>
17
+ card
18
+ </title>
19
+ <g
20
+ fill="none"
21
+ fill-rule="evenodd"
22
+ id="Icons"
23
+ stroke="none"
24
+ stroke-width="1"
25
+ >
26
+ <g
27
+ id="card"
28
+ transform="translate(-261.000000, -216.000000)"
29
+ >
30
+ <g
31
+ transform="translate(261.000000, 216.000000)"
32
+ >
33
+ <path
34
+ d="M15,1 L15,9.53124644 L14.998,9.531 L14.9986024,7.67959976 L11.4210663,4.62547112 L7.4590683,8.08893259 C7.08560181,8.77082265 6.07591438,8.77082265 5.51715851,8.27688661 L3.50145721,6.5 L1,8.77 L1,7.323 L2.58011188,5.9054667 C3.10161735,5.44445974 3.91799869,5.41372594 4.47882094,5.81326531 L4.59488493,5.9054667 L6.4402744,7.56106172 L10.4252459,3.98593625 C10.9840017,3.49200022 11.8812631,3.49200022 12.4400189,3.98593625 L14.9986024,6.28137475 L14.998,1 Z M6.14778213,2.60821539 C6.69719001,2.60821539 7.14257312,3.0379169 7.14257312,3.56798059 C7.14257312,4.09804429 6.69719002,4.52774581 6.14778213,4.52774581 C5.88422964,4.52580316 5.6316942,4.42547921 5.44313851,4.24781429 C5.25594548,4.06784498 5.15142164,3.82293899 5.15297371,3.56798059 C5.15297371,3.0379169 5.59837425,2.60821539 6.14778213,2.60821539 Z"
35
+ fill="#63779C"
36
+ fill-rule="nonzero"
37
+ id="Combined-Shape"
38
+ />
39
+ <path
40
+ d="M3,13 C3,12.7238576 3.22385763,12.5 3.5,12.5 L12.5,12.5 C12.7761424,12.5 13,12.7238576 13,13 C13,13.2761424 12.7761424,13.5 12.5,13.5 L3.5,13.5 C3.22385763,13.5 3,13.2761424 3,13 Z"
41
+ fill="#899BBC"
42
+ fill-rule="nonzero"
43
+ id="Shape"
44
+ />
45
+ <rect
46
+ height="15"
47
+ id="Rectangle"
48
+ rx="2"
49
+ stroke="#899BBC"
50
+ width="15"
51
+ x="0.5"
52
+ y="0.5"
53
+ />
54
+ <line
55
+ id="Line-2"
56
+ stroke="#63779C"
57
+ stroke-linecap="square"
58
+ x1="0.5"
59
+ x2="15.5"
60
+ y1="10.5"
61
+ y2="10.5"
62
+ />
63
+ </g>
64
+ </g>
65
+ </g>
66
+ </svg>
67
+ <span>
68
+ card
69
+ </span>
70
+ </div>
71
+ </DocumentFragment>
72
+ `;
@@ -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/components/EditorView/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
+ });