@blaze-cms/react-page-builder 0.132.0 → 0.133.0-admin-updates.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 (195) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/lib/components/Banner/BannerRender.js +2 -2
  3. package/lib/components/Banner/BannerRender.js.map +1 -1
  4. package/lib/components/Banner/helpers.js +2 -2
  5. package/lib/components/Banner/helpers.js.map +1 -1
  6. package/lib/components/BlazeLink.js +2 -2
  7. package/lib/components/BlazeLink.js.map +1 -1
  8. package/lib/components/Button.js +2 -2
  9. package/lib/components/Button.js.map +1 -1
  10. package/lib/components/Card/CardsContainer.js +2 -2
  11. package/lib/components/Card/CardsContainer.js.map +1 -1
  12. package/lib/components/Card/CardsRender.js +2 -2
  13. package/lib/components/Card/CardsRender.js.map +1 -1
  14. package/lib/components/Card/helpers/filter-query-setup.js +11 -5
  15. package/lib/components/Card/helpers/filter-query-setup.js.map +1 -1
  16. package/lib/components/ClickWrapper.js +2 -2
  17. package/lib/components/ClickWrapper.js.map +1 -1
  18. package/lib/components/Code/Code.js +2 -2
  19. package/lib/components/Code/Code.js.map +1 -1
  20. package/lib/components/DataSummary/helpers/build-loop-props-content.js +3 -2
  21. package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  22. package/lib/components/DataSummary/helpers/get-link-to-published-content.js +2 -0
  23. package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
  24. package/lib/components/Image/Image.js +2 -2
  25. package/lib/components/Image/Image.js.map +1 -1
  26. package/lib/components/Layout/Layout.js +2 -2
  27. package/lib/components/Layout/Layout.js.map +1 -1
  28. package/lib/components/List/ListBuilder.js +46 -26
  29. package/lib/components/List/ListBuilder.js.map +1 -1
  30. package/lib/components/List/ListFactory.js +5 -5
  31. package/lib/components/List/ListFactory.js.map +1 -1
  32. package/lib/components/List/components/Cards/CardsRender.js +2 -2
  33. package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
  34. package/lib/components/List/components/Full/FullRender.js +2 -2
  35. package/lib/components/List/components/Full/FullRender.js.map +1 -1
  36. package/lib/components/List/components/Full/FullRenderItem.js +2 -2
  37. package/lib/components/List/components/Full/FullRenderItem.js.map +1 -1
  38. package/lib/components/List/components/Pagination/ListPagination.js +2 -2
  39. package/lib/components/List/components/Pagination/ListPagination.js.map +1 -1
  40. package/lib/components/List/helpers/build-az-url.js +2 -2
  41. package/lib/components/List/helpers/build-az-url.js.map +1 -1
  42. package/lib/components/List/helpers/build-pagination-url.js +2 -2
  43. package/lib/components/List/helpers/build-pagination-url.js.map +1 -1
  44. package/lib/components/List/helpers/get-list-query.js +6 -2
  45. package/lib/components/List/helpers/get-list-query.js.map +1 -1
  46. package/lib/components/List/helpers/get-sort-props.js +5 -1
  47. package/lib/components/List/helpers/get-sort-props.js.map +1 -1
  48. package/lib/components/SearchFilter/components/Range.js +2 -2
  49. package/lib/components/SearchFilter/components/Range.js.map +1 -1
  50. package/lib/components/SearchFilter/searchFilterReducer.js +2 -2
  51. package/lib/components/SearchFilterSort/helpers/update-sort.js +2 -2
  52. package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
  53. package/lib/components/TextBlock/index.js +2 -2
  54. package/lib/components/TextBlock/index.js.map +1 -1
  55. package/lib/components/Video/Video.js +2 -2
  56. package/lib/components/Video/Video.js.map +1 -1
  57. package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js +2 -2
  58. package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js.map +1 -1
  59. package/lib/constants/index.js +4 -34
  60. package/lib/constants/index.js.map +1 -1
  61. package/lib/helpers/append-images.js +2 -2
  62. package/lib/helpers/build-az-filter.js +8 -7
  63. package/lib/helpers/build-az-filter.js.map +1 -1
  64. package/lib/helpers/build-raw-query-base.js +2 -2
  65. package/lib/helpers/build-raw-query-base.js.map +1 -1
  66. package/lib/helpers/build-raw-query.js +29 -8
  67. package/lib/helpers/build-raw-query.js.map +1 -1
  68. package/lib/helpers/build-sort-values.js +49 -0
  69. package/lib/helpers/build-sort-values.js.map +1 -0
  70. package/lib/helpers/get-banner-data.js +2 -2
  71. package/lib/helpers/get-click-wrapper-options.js +2 -2
  72. package/lib/helpers/get-click-wrapper-options.js.map +1 -1
  73. package/lib/helpers/get-entities-with-banner.js +2 -2
  74. package/lib/helpers/get-entities-with-banner.js.map +1 -1
  75. package/lib/helpers/get-extra-az-bits.js +46 -3
  76. package/lib/helpers/get-extra-az-bits.js.map +1 -1
  77. package/lib/helpers/get-generic-props.js +2 -2
  78. package/lib/helpers/get-generic-props.js.map +1 -1
  79. package/lib/helpers/get-generic-render-variables.js +30 -37
  80. package/lib/helpers/get-generic-render-variables.js.map +1 -1
  81. package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js +2 -2
  82. package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js.map +1 -1
  83. package/lib/helpers/process-data-summary-value.js +2 -2
  84. package/lib/helpers/process-data-summary-value.js.map +1 -1
  85. package/lib/helpers/remove-unwanted-characters.js +2 -2
  86. package/lib/helpers/render-children.js +2 -2
  87. package/lib/helpers/render-children.js.map +1 -1
  88. package/lib/helpers/split-children.js +2 -2
  89. package/lib/helpers/update-childrens-parent.js +2 -2
  90. package/lib/hooks/helpers/append-gtm-classname.js +2 -2
  91. package/lib/hooks/helpers/append-gtm-classname.js.map +1 -1
  92. package/lib/hooks/helpers/buildPBComponents.js +2 -2
  93. package/lib/hooks/helpers/buildPBComponents.js.map +1 -1
  94. package/lib/hooks/helpers/get-lightbox-images.js +2 -2
  95. package/lib/hooks/helpers/get-lightbox-images.js.map +1 -1
  96. package/lib/hooks/helpers/inject-element-banners.js +2 -2
  97. package/lib/hooks/helpers/inject-element-banners.js.map +1 -1
  98. package/lib/hooks/helpers/inject-textblock-banners.js +2 -2
  99. package/lib/hooks/helpers/inject-textblock-banners.js.map +1 -1
  100. package/lib/utils/get-class-modifiers.js +2 -2
  101. package/lib/utils/get-class-modifiers.js.map +1 -1
  102. package/lib-es/components/Banner/BannerRender.js +2 -2
  103. package/lib-es/components/Banner/helpers.js +2 -2
  104. package/lib-es/components/BlazeLink.js +2 -2
  105. package/lib-es/components/Button.js +2 -2
  106. package/lib-es/components/Card/CardsContainer.js +2 -2
  107. package/lib-es/components/Card/CardsRender.js +2 -2
  108. package/lib-es/components/Card/helpers/filter-query-setup.js +11 -5
  109. package/lib-es/components/Card/helpers/filter-query-setup.js.map +1 -1
  110. package/lib-es/components/ClickWrapper.js +2 -2
  111. package/lib-es/components/Code/Code.js +2 -2
  112. package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +3 -2
  113. package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  114. package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +2 -1
  115. package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
  116. package/lib-es/components/Image/Image.js +2 -2
  117. package/lib-es/components/Layout/Layout.js +2 -2
  118. package/lib-es/components/List/ListBuilder.js +46 -26
  119. package/lib-es/components/List/ListBuilder.js.map +1 -1
  120. package/lib-es/components/List/ListFactory.js +5 -5
  121. package/lib-es/components/List/ListFactory.js.map +1 -1
  122. package/lib-es/components/List/components/Cards/CardsRender.js +2 -2
  123. package/lib-es/components/List/components/Full/FullRender.js +2 -2
  124. package/lib-es/components/List/components/Full/FullRenderItem.js +2 -2
  125. package/lib-es/components/List/components/Pagination/ListPagination.js +2 -2
  126. package/lib-es/components/List/helpers/build-az-url.js +2 -2
  127. package/lib-es/components/List/helpers/build-pagination-url.js +2 -2
  128. package/lib-es/components/List/helpers/get-list-query.js +5 -2
  129. package/lib-es/components/List/helpers/get-list-query.js.map +1 -1
  130. package/lib-es/components/List/helpers/get-sort-props.js +5 -1
  131. package/lib-es/components/List/helpers/get-sort-props.js.map +1 -1
  132. package/lib-es/components/SearchFilter/components/Range.js +2 -2
  133. package/lib-es/components/SearchFilter/searchFilterReducer.js +2 -2
  134. package/lib-es/components/SearchFilterSort/helpers/update-sort.js +2 -2
  135. package/lib-es/components/TextBlock/index.js +2 -2
  136. package/lib-es/components/Video/Video.js +2 -2
  137. package/lib-es/components/Video/providers/JWPlayer/JWPlayerProvider.js +2 -2
  138. package/lib-es/constants/index.js +2 -31
  139. package/lib-es/constants/index.js.map +1 -1
  140. package/lib-es/helpers/append-images.js +2 -2
  141. package/lib-es/helpers/build-az-filter.js +3 -2
  142. package/lib-es/helpers/build-az-filter.js.map +1 -1
  143. package/lib-es/helpers/build-raw-query-base.js +2 -2
  144. package/lib-es/helpers/build-raw-query.js +26 -8
  145. package/lib-es/helpers/build-raw-query.js.map +1 -1
  146. package/lib-es/helpers/build-sort-values.js +34 -0
  147. package/lib-es/helpers/build-sort-values.js.map +1 -0
  148. package/lib-es/helpers/get-banner-data.js +2 -2
  149. package/lib-es/helpers/get-click-wrapper-options.js +2 -2
  150. package/lib-es/helpers/get-entities-with-banner.js +2 -2
  151. package/lib-es/helpers/get-extra-az-bits.js +48 -2
  152. package/lib-es/helpers/get-extra-az-bits.js.map +1 -1
  153. package/lib-es/helpers/get-generic-props.js +2 -2
  154. package/lib-es/helpers/get-generic-render-variables.js +24 -28
  155. package/lib-es/helpers/get-generic-render-variables.js.map +1 -1
  156. package/lib-es/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js +2 -2
  157. package/lib-es/helpers/process-data-summary-value.js +2 -2
  158. package/lib-es/helpers/remove-unwanted-characters.js +2 -2
  159. package/lib-es/helpers/render-children.js +2 -2
  160. package/lib-es/helpers/split-children.js +2 -2
  161. package/lib-es/helpers/update-childrens-parent.js +2 -2
  162. package/lib-es/hooks/helpers/append-gtm-classname.js +2 -2
  163. package/lib-es/hooks/helpers/buildPBComponents.js +2 -2
  164. package/lib-es/hooks/helpers/get-lightbox-images.js +2 -2
  165. package/lib-es/hooks/helpers/inject-element-banners.js +2 -2
  166. package/lib-es/hooks/helpers/inject-textblock-banners.js +2 -2
  167. package/lib-es/utils/get-class-modifiers.js +2 -2
  168. package/package.json +10 -10
  169. package/src/components/Card/helpers/filter-query-setup.js +4 -5
  170. package/src/components/DataSummary/helpers/build-loop-props-content.js +3 -2
  171. package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -1
  172. package/src/components/List/ListBuilder.js +46 -55
  173. package/src/components/List/ListFactory.js +9 -7
  174. package/src/components/List/helpers/get-list-query.js +5 -2
  175. package/src/components/List/helpers/get-sort-props.js +9 -1
  176. package/src/constants/index.js +2 -32
  177. package/src/helpers/build-az-filter.js +3 -2
  178. package/src/helpers/build-raw-query.js +9 -7
  179. package/src/helpers/build-sort-values.js +32 -0
  180. package/src/helpers/get-extra-az-bits.js +40 -2
  181. package/src/helpers/get-generic-render-variables.js +20 -27
  182. package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +41 -0
  183. package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +21 -0
  184. package/tests/unit/src/components/List/helpers/get-list-query.test.js +55 -0
  185. package/tests/unit/src/components/List/helpers/get-sort-props.test.js +18 -0
  186. package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +72 -0
  187. package/tests/unit/src/components/PlaceholderIcon/index.test.js +20 -0
  188. package/tests/unit/src/constants/__snapshots__/index.test.js.snap +3 -0
  189. package/tests/unit/src/constants/index.test.js +7 -0
  190. package/tests/unit/src/helpers/__snapshots__/get-extra-az-bits.test.js.snap +137 -0
  191. package/tests/unit/src/helpers/build-az-query.test.js +4 -3
  192. package/tests/unit/src/helpers/build-raw-query.test.js +82 -58
  193. package/tests/unit/src/helpers/build-sort-values.test.js +34 -0
  194. package/tests/unit/src/helpers/get-extra-az-bits.test.js +36 -6
  195. package/tests/unit/src/helpers/get-generic-render-variables.test.js +50 -53
@@ -0,0 +1,55 @@
1
+ import getListQuery from '../../../../../../src/components/List/helpers/get-list-query';
2
+
3
+ describe('getListQuery', () => {
4
+ it('should handle empty query', () => {
5
+ const query = {};
6
+ const hasListSpecificFilters = false;
7
+ const name = 'testList';
8
+
9
+ const result = getListQuery(query, hasListSpecificFilters, name);
10
+
11
+ expect(result).toEqual({});
12
+ });
13
+
14
+ it('should handle query without list-specific filters', () => {
15
+ const query = {
16
+ param1: 'value1',
17
+ param2: 'value2',
18
+ otherParam: 'otherValue',
19
+ 'pb[testList][page]': '2',
20
+ 'pb[testList][sort]': 'date',
21
+ 'pb[testList][sortby]': 'asc'
22
+ };
23
+ const hasListSpecificFilters = false;
24
+ const name = 'testList';
25
+
26
+ const result = getListQuery(query, hasListSpecificFilters, name);
27
+
28
+ expect(result).toEqual({
29
+ param1: 'value1',
30
+ param2: 'value2',
31
+ otherParam: 'otherValue',
32
+ sort: 'date',
33
+ sortby: 'asc',
34
+ 'pb[testList][page]': '2'
35
+ });
36
+ });
37
+
38
+ it('should handle query with list-specific filters', () => {
39
+ const query = {
40
+ 'pb[testList][filter1]': 'filterValue1',
41
+ 'pb[testList][page]': '3',
42
+ 'pb[testList][sort]': 'name'
43
+ };
44
+ const hasListSpecificFilters = true;
45
+ const name = 'testList';
46
+
47
+ const result = getListQuery(query, hasListSpecificFilters, name);
48
+
49
+ expect(result).toEqual({
50
+ filter1: 'filterValue1',
51
+ sort: 'name',
52
+ 'pb[testList][page]': '3'
53
+ });
54
+ });
55
+ });
@@ -42,6 +42,24 @@ describe('getSortProps helper function', () => {
42
42
  ]);
43
43
  });
44
44
 
45
+ it('should add score sort as second value if has textSearch', () => {
46
+ const { sortbyFilters, updatedSortProperties } = getSortProps({
47
+ ...props,
48
+ querySortBy,
49
+ querySort: desc,
50
+ isTextSearchFilterApplied: true
51
+ });
52
+ expect(sortbyFilters).toEqual([querySortBy, property]);
53
+ expect(updatedSortProperties).toEqual([
54
+ {
55
+ propsToDisplay: [querySortBy],
56
+ sort: desc
57
+ },
58
+ { isScore: true },
59
+ ...sortProperties
60
+ ]);
61
+ });
62
+
45
63
  it('should use old style sort', () => {
46
64
  const { sortbyFilters, updatedSortProperties } = getSortProps({
47
65
  ...props,
@@ -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
+ });
@@ -0,0 +1,3 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`constants should match snapshot 1`] = `undefined`;
@@ -0,0 +1,7 @@
1
+ import constants from '../../../../src/constants';
2
+
3
+ describe('constants', () => {
4
+ it('should match snapshot', () => {
5
+ expect(constants).toMatchSnapshot();
6
+ });
7
+ });
@@ -0,0 +1,137 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`getExtraAzBits helper function should return ALL_AZ_SORT if shouldReturnAggs is false and is Az and no Az filter is passed 1`] = `
4
+ Object {
5
+ "sort": Array [
6
+ Object {
7
+ "_script": Object {
8
+ "order": "asc",
9
+ "script": Object {
10
+ "lang": "painless",
11
+ "params": Object {
12
+ "letters": Array [
13
+ "A",
14
+ "B",
15
+ "C",
16
+ "D",
17
+ "E",
18
+ "F",
19
+ "G",
20
+ "H",
21
+ "I",
22
+ "J",
23
+ "K",
24
+ "L",
25
+ "M",
26
+ "N",
27
+ "O",
28
+ "P",
29
+ "Q",
30
+ "R",
31
+ "S",
32
+ "T",
33
+ "U",
34
+ "V",
35
+ "W",
36
+ "X",
37
+ "Y",
38
+ "Z",
39
+ ],
40
+ },
41
+ "source": "int charPos = params.letters.indexOf(doc['name.keyword'].value.substring(0,1).toUpperCase()); charPos > -1 ? charPos : 100",
42
+ },
43
+ "type": "number",
44
+ },
45
+ },
46
+ Object {
47
+ "name.keyword": "asc",
48
+ },
49
+ ],
50
+ }
51
+ `;
52
+
53
+ exports[`getExtraAzBits helper function should return ALL_AZ_SORT if shouldReturnAggs is false and is Az and no Az filter is passed with custom property 1`] = `
54
+ Object {
55
+ "sort": Array [
56
+ Object {
57
+ "_script": Object {
58
+ "order": "asc",
59
+ "script": Object {
60
+ "lang": "painless",
61
+ "params": Object {
62
+ "letters": Array [
63
+ "A",
64
+ "B",
65
+ "C",
66
+ "D",
67
+ "E",
68
+ "F",
69
+ "G",
70
+ "H",
71
+ "I",
72
+ "J",
73
+ "K",
74
+ "L",
75
+ "M",
76
+ "N",
77
+ "O",
78
+ "P",
79
+ "Q",
80
+ "R",
81
+ "S",
82
+ "T",
83
+ "U",
84
+ "V",
85
+ "W",
86
+ "X",
87
+ "Y",
88
+ "Z",
89
+ ],
90
+ },
91
+ "source": "int charPos = params.letters.indexOf(doc['lastname.keyword'].value.substring(0,1).toUpperCase()); charPos > -1 ? charPos : 100",
92
+ },
93
+ "type": "number",
94
+ },
95
+ },
96
+ Object {
97
+ "lastname.keyword": "asc",
98
+ },
99
+ ],
100
+ }
101
+ `;
102
+
103
+ exports[`getExtraAzBits helper function should return AZ_AGGS if shouldReturnAggs and isAz is true 1`] = `
104
+ Object {
105
+ "aggs": Object {
106
+ "azCount": Object {
107
+ "terms": Object {
108
+ "script": "doc['name.keyword'].getValue().substring(0,1).toUpperCase()",
109
+ "size": 500,
110
+ },
111
+ },
112
+ },
113
+ "sort": Array [
114
+ Object {
115
+ "name.keyword": "asc",
116
+ },
117
+ ],
118
+ }
119
+ `;
120
+
121
+ exports[`getExtraAzBits helper function should return AZ_AGGS if shouldReturnAggs and isAz is true with custom property 1`] = `
122
+ Object {
123
+ "aggs": Object {
124
+ "azCount": Object {
125
+ "terms": Object {
126
+ "script": "doc['lastname.keyword'].getValue().substring(0,1).toUpperCase()",
127
+ "size": 500,
128
+ },
129
+ },
130
+ },
131
+ "sort": Array [
132
+ Object {
133
+ "lastname.keyword": "asc",
134
+ },
135
+ ],
136
+ }
137
+ `;
@@ -1,11 +1,12 @@
1
1
  import buildAzFilter from '../../../../src/helpers/build-az-filter';
2
+ import { AZ_DEFAULT_PROP } from '../../../../src/constants';
2
3
 
3
4
  const mockFilters = [{ must: ['this'] }];
4
5
  const mockedResult = [
5
6
  { must: ['this'] },
6
7
  {
7
8
  regexp: {
8
- 'name.keyword': {
9
+ [`${AZ_DEFAULT_PROP}.keyword`]: {
9
10
  value: `b.*`,
10
11
  case_insensitive: true
11
12
  }
@@ -14,12 +15,12 @@ const mockedResult = [
14
15
  ];
15
16
  describe('buildAzFilter helper function', () => {
16
17
  it('should leave unchanged filters if no az is passed', () => {
17
- buildAzFilter('', mockFilters);
18
+ buildAzFilter('', mockFilters, AZ_DEFAULT_PROP);
18
19
  expect(mockFilters).toEqual(mockFilters);
19
20
  });
20
21
 
21
22
  it('should update filters if az is passed', () => {
22
- buildAzFilter('b', mockFilters);
23
+ buildAzFilter('b', mockFilters, AZ_DEFAULT_PROP);
23
24
  expect(mockFilters).toEqual(mockedResult);
24
25
  });
25
26
  });