@blaze-cms/react-page-builder 0.146.0-core-styles.42 → 0.146.0-node18.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 (278) hide show
  1. package/CHANGELOG.md +31 -197
  2. package/lib/HOC/recreateOnNavigation.js.map +1 -1
  3. package/lib/HOC/withTitle.js.map +1 -1
  4. package/lib/application/query/index.js +1 -0
  5. package/lib/application/query/index.js.map +1 -1
  6. package/lib/components/BackToTop/BackToTop.js.map +1 -1
  7. package/lib/components/Banner/AdSlotRender.js +1 -1
  8. package/lib/components/Banner/Banner.js +1 -1
  9. package/lib/components/Banner/BannerRender.js.map +1 -1
  10. package/lib/components/Breadcrumb/Breadcrumb.js +1 -1
  11. package/lib/components/Breadcrumb/Breadcrumb.js.map +1 -1
  12. package/lib/components/Button.js.map +1 -1
  13. package/lib/components/Card/CardsContainer.js +1 -1
  14. package/lib/components/Card/CardsFactory.js.map +1 -1
  15. package/lib/components/Card/CardsRender.js.map +1 -1
  16. package/lib/components/Carousel/CarouselRender/CarouselRender.js +1 -0
  17. package/lib/components/Carousel/CarouselRender/CarouselRender.js.map +1 -1
  18. package/lib/components/CarouselWrapper/DefaultCarousel.js.map +1 -1
  19. package/lib/components/ContentGroup/ContentGroupTabs.js +1 -1
  20. package/lib/components/ContentGroup/ContentGroupTabs.js.map +1 -1
  21. package/lib/components/ContentGroup/helpers/get-sections-data.js +1 -0
  22. package/lib/components/ContentGroup/helpers/get-sections-data.js.map +1 -1
  23. package/lib/components/DataSummary/DataSummaryRender.js +1 -0
  24. package/lib/components/DataSummary/DataSummaryRender.js.map +1 -1
  25. package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummaryContent.js +1 -1
  26. package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +1 -1
  27. package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummaryContent.js +1 -1
  28. package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummaryContent.js +1 -1
  29. package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummaryContent.js +1 -1
  30. package/lib/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
  31. package/lib/components/DateTime/DateTime.js +4 -4
  32. package/lib/components/DateTime/DateTime.js.map +1 -1
  33. package/lib/components/EmailConfirm/EmailConfirm.js +3 -3
  34. package/lib/components/EmailConfirm/EmailConfirm.js.map +1 -1
  35. package/lib/components/Image/GlobalLightbox/GlobalLightbox.js +2 -2
  36. package/lib/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
  37. package/lib/components/Image/GlobalLightbox/index.js.map +1 -1
  38. package/lib/components/Image/Image.js.map +1 -1
  39. package/lib/components/Image/ImageFactory.js +1 -1
  40. package/lib/components/Image/ImageFactory.js.map +1 -1
  41. package/lib/components/ItemList/helpers/get-item-list-ids.js +1 -0
  42. package/lib/components/ItemList/helpers/get-item-list-ids.js.map +1 -1
  43. package/lib/components/ItemList/hooks/use-item-list-id.js.map +1 -1
  44. package/lib/components/Layout/LayoutFactory.js.map +1 -1
  45. package/lib/components/Layout/LayoutWithStickyTimer.js.map +1 -1
  46. package/lib/components/List/ListFactory.js.map +1 -1
  47. package/lib/components/List/ListRender.js.map +1 -1
  48. package/lib/components/List/components/Cards/CardsRenderWrapper.js +1 -1
  49. package/lib/components/List/components/Full/FullRender.js +1 -1
  50. package/lib/components/List/components/Full/FullRenderItem.js +1 -1
  51. package/lib/components/List/components/Header/ListHeader.js +1 -0
  52. package/lib/components/List/components/Header/ListHeader.js.map +1 -1
  53. package/lib/components/List/components/Pagination/ListPagination.js.map +1 -1
  54. package/lib/components/List/components/Pagination/LoadMore.js +2 -2
  55. package/lib/components/List/components/Pagination/LoadMore.js.map +1 -1
  56. package/lib/components/List/helpers/build-query-booster.js +1 -1
  57. package/lib/components/List/helpers/sort-aggs.js.map +1 -1
  58. package/lib/components/Menu/Menu.js.map +1 -1
  59. package/lib/components/MenuItem/MenuItemRender.js.map +1 -1
  60. package/lib/components/ModalAdapter/index.js.map +1 -1
  61. package/lib/components/SearchContent/SearchContent.js.map +1 -1
  62. package/lib/components/SearchContent/SearchContentItems.js +1 -0
  63. package/lib/components/SearchContent/SearchContentItems.js.map +1 -1
  64. package/lib/components/SearchFilter/SearchFilter/FiltersList.js +1 -1
  65. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  66. package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js +1 -0
  67. package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js.map +1 -1
  68. package/lib/components/SearchFilter/helpers/get-select-options.js +1 -0
  69. package/lib/components/SearchFilter/helpers/get-select-options.js.map +1 -1
  70. package/lib/components/SearchFilter/helpers/parse-filter-value.js +1 -0
  71. package/lib/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
  72. package/lib/components/SearchFilterSort/SearchFilterSort.js +1 -0
  73. package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
  74. package/lib/components/SocialFollow/SocialFollowRender.js +1 -0
  75. package/lib/components/SocialFollow/SocialFollowRender.js.map +1 -1
  76. package/lib/components/Video/providers/Vimeo/VimeoProvider.js.map +1 -1
  77. package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
  78. package/lib/components/Video/providers/get-provider.js.map +1 -1
  79. package/lib/components/Wrapper.js +2 -2
  80. package/lib/components/Wrapper.js.map +1 -1
  81. package/lib/components/index.js.map +1 -1
  82. package/lib/constants/index.js.map +1 -1
  83. package/lib/helpers/build-query-fields.js +1 -0
  84. package/lib/helpers/build-query-fields.js.map +1 -1
  85. package/lib/helpers/build-search-values-checkbox-select.js +1 -1
  86. package/lib/helpers/build-search-values-checkbox-select.js.map +1 -1
  87. package/lib/helpers/check-props-to-use.js +1 -0
  88. package/lib/helpers/check-props-to-use.js.map +1 -1
  89. package/lib/helpers/get-current-offset.js +4 -5
  90. package/lib/helpers/get-current-offset.js.map +1 -1
  91. package/lib/helpers/get-entities-with-banner.js +1 -1
  92. package/lib/helpers/get-wrapped-value-with-link.js +1 -0
  93. package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
  94. package/lib/helpers/inject-multiple-banners/get-banners-for-entities/get-banners-for-entities.js +1 -0
  95. package/lib/helpers/inject-multiple-banners/get-banners-for-entities/get-banners-for-entities.js.map +1 -1
  96. package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js +1 -1
  97. package/lib/helpers/process-data-summary-value.js +1 -1
  98. package/lib/helpers/remove-unwanted-characters.js +1 -1
  99. package/lib/helpers/remove-unwanted-characters.js.map +1 -1
  100. package/lib/hooks/helpers/buildPBComponents.js.map +1 -1
  101. package/lib/hooks/helpers/get-components-to-insert-by-type.js.map +1 -1
  102. package/lib/hooks/helpers/get-lightbox-images.js +1 -1
  103. package/lib/hooks/helpers/inject-textblock-banners.js.map +1 -1
  104. package/lib/hooks/use-check-mobile-screen.js.map +1 -1
  105. package/lib/hooks/use-get-entity-schema.js.map +1 -1
  106. package/lib/hooks/use-get-image-id-from-relation.js.map +1 -1
  107. package/lib/hooks/use-page-builder.js +1 -1
  108. package/lib/hooks/use-page-builder.js.map +1 -1
  109. package/lib/utils/get-props-to-display-modifiers.js +1 -0
  110. package/lib/utils/get-props-to-display-modifiers.js.map +1 -1
  111. package/lib/variants/Infographic/index.js.map +1 -1
  112. package/lib/variants/LongformGallery/LongformGallery.js +1 -0
  113. package/lib/variants/LongformGallery/LongformGallery.js.map +1 -1
  114. package/lib/variants/LongformGallery/index.js.map +1 -1
  115. package/lib/variants/SlideSummary/index.js.map +1 -1
  116. package/lib/variants/ThumbnailCarousel/ThumbnailCarousel.js +1 -0
  117. package/lib/variants/ThumbnailCarousel/ThumbnailCarousel.js.map +1 -1
  118. package/lib/variants/ThumbnailCarousel/ThumbnailImage/ThumbnailImage.js.map +1 -1
  119. package/lib/variants/ThumbnailCarousel/index.js.map +1 -1
  120. package/lib-es/HOC/recreateOnNavigation.js.map +1 -1
  121. package/lib-es/HOC/withTitle.js.map +1 -1
  122. package/lib-es/components/BackToTop/BackToTop.js.map +1 -1
  123. package/lib-es/components/Banner/BannerRender.js.map +1 -1
  124. package/lib-es/components/Breadcrumb/Breadcrumb.js.map +1 -1
  125. package/lib-es/components/Button.js.map +1 -1
  126. package/lib-es/components/Card/CardsFactory.js.map +1 -1
  127. package/lib-es/components/Card/CardsRender.js.map +1 -1
  128. package/lib-es/components/CarouselWrapper/DefaultCarousel.js.map +1 -1
  129. package/lib-es/components/ContentGroup/ContentGroupTabs.js.map +1 -1
  130. package/lib-es/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
  131. package/lib-es/components/DateTime/DateTime.js +4 -4
  132. package/lib-es/components/DateTime/DateTime.js.map +1 -1
  133. package/lib-es/components/EmailConfirm/EmailConfirm.js +4 -4
  134. package/lib-es/components/EmailConfirm/EmailConfirm.js.map +1 -1
  135. package/lib-es/components/Image/GlobalLightbox/GlobalLightbox.js +3 -3
  136. package/lib-es/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
  137. package/lib-es/components/Image/GlobalLightbox/index.js.map +1 -1
  138. package/lib-es/components/Image/Image.js.map +1 -1
  139. package/lib-es/components/Image/ImageFactory.js.map +1 -1
  140. package/lib-es/components/ItemList/hooks/use-item-list-id.js.map +1 -1
  141. package/lib-es/components/Layout/LayoutFactory.js.map +1 -1
  142. package/lib-es/components/Layout/LayoutWithStickyTimer.js.map +1 -1
  143. package/lib-es/components/List/ListFactory.js.map +1 -1
  144. package/lib-es/components/List/ListRender.js.map +1 -1
  145. package/lib-es/components/List/components/Pagination/ListPagination.js.map +1 -1
  146. package/lib-es/components/List/components/Pagination/LoadMore.js +2 -2
  147. package/lib-es/components/List/components/Pagination/LoadMore.js.map +1 -1
  148. package/lib-es/components/List/helpers/sort-aggs.js.map +1 -1
  149. package/lib-es/components/Menu/Menu.js.map +1 -1
  150. package/lib-es/components/MenuItem/MenuItemRender.js.map +1 -1
  151. package/lib-es/components/ModalAdapter/index.js.map +1 -1
  152. package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
  153. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  154. package/lib-es/components/Video/providers/Vimeo/VimeoProvider.js.map +1 -1
  155. package/lib-es/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
  156. package/lib-es/components/Video/providers/get-provider.js.map +1 -1
  157. package/lib-es/components/Wrapper.js +2 -2
  158. package/lib-es/components/Wrapper.js.map +1 -1
  159. package/lib-es/components/index.js.map +1 -1
  160. package/lib-es/constants/index.js.map +1 -1
  161. package/lib-es/helpers/build-search-values-checkbox-select.js +1 -1
  162. package/lib-es/helpers/build-search-values-checkbox-select.js.map +1 -1
  163. package/lib-es/helpers/get-current-offset.js +1 -1
  164. package/lib-es/helpers/get-current-offset.js.map +1 -1
  165. package/lib-es/helpers/get-wrapped-value-with-link.js.map +1 -1
  166. package/lib-es/helpers/remove-unwanted-characters.js.map +1 -1
  167. package/lib-es/hooks/helpers/buildPBComponents.js.map +1 -1
  168. package/lib-es/hooks/helpers/get-components-to-insert-by-type.js.map +1 -1
  169. package/lib-es/hooks/helpers/inject-textblock-banners.js.map +1 -1
  170. package/lib-es/hooks/use-check-mobile-screen.js.map +1 -1
  171. package/lib-es/hooks/use-get-entity-schema.js.map +1 -1
  172. package/lib-es/hooks/use-get-image-id-from-relation.js.map +1 -1
  173. package/lib-es/hooks/use-page-builder.js +1 -1
  174. package/lib-es/hooks/use-page-builder.js.map +1 -1
  175. package/lib-es/variants/Infographic/index.js.map +1 -1
  176. package/lib-es/variants/LongformGallery/LongformGallery.js.map +1 -1
  177. package/lib-es/variants/LongformGallery/index.js.map +1 -1
  178. package/lib-es/variants/SlideSummary/index.js.map +1 -1
  179. package/lib-es/variants/ThumbnailCarousel/ThumbnailImage/ThumbnailImage.js.map +1 -1
  180. package/lib-es/variants/ThumbnailCarousel/index.js.map +1 -1
  181. package/package.json +20 -19
  182. package/src/HOC/recreateOnNavigation.js +3 -3
  183. package/src/HOC/withTitle.js +3 -3
  184. package/src/components/BackToTop/BackToTop.js +5 -8
  185. package/src/components/Banner/BannerRender.js +0 -2
  186. package/src/components/Breadcrumb/Breadcrumb.js +5 -1
  187. package/src/components/Button.js +3 -6
  188. package/src/components/Card/CardsFactory.js +8 -7
  189. package/src/components/Card/CardsRender.js +5 -3
  190. package/src/components/CarouselWrapper/DefaultCarousel.js +20 -26
  191. package/src/components/ContentGroup/ContentGroupTabs.js +4 -7
  192. package/src/components/DataSummary/DataSummaryTypes/index.js +14 -10
  193. package/src/components/DateTime/DateTime.js +4 -4
  194. package/src/components/EmailConfirm/EmailConfirm.js +9 -11
  195. package/src/components/Image/GlobalLightbox/GlobalLightbox.js +7 -9
  196. package/src/components/Image/GlobalLightbox/index.js +2 -2
  197. package/src/components/Image/Image.js +6 -4
  198. package/src/components/Image/ImageFactory.js +5 -5
  199. package/src/components/ItemList/hooks/use-item-list-id.js +10 -13
  200. package/src/components/Layout/LayoutFactory.js +2 -2
  201. package/src/components/Layout/LayoutWithStickyTimer.js +11 -14
  202. package/src/components/List/ListFactory.js +10 -11
  203. package/src/components/List/ListRender.js +6 -1
  204. package/src/components/List/components/Pagination/ListPagination.js +3 -6
  205. package/src/components/List/components/Pagination/LoadMore.js +7 -9
  206. package/src/components/List/helpers/sort-aggs.js +1 -2
  207. package/src/components/Menu/Menu.js +12 -16
  208. package/src/components/MenuItem/MenuItemRender.js +3 -6
  209. package/src/components/ModalAdapter/index.js +2 -2
  210. package/src/components/SearchContent/SearchContent.js +26 -32
  211. package/src/components/SearchFilter/SearchFilter/SearchFilter.js +15 -19
  212. package/src/components/Video/providers/Vimeo/VimeoProvider.js +19 -22
  213. package/src/components/Video/providers/YouTube/YoutubeEmbeded.js +58 -64
  214. package/src/components/Video/providers/get-provider.js +4 -4
  215. package/src/components/Wrapper.js +5 -7
  216. package/src/components/index.js +20 -20
  217. package/src/constants/index.js +2 -1
  218. package/src/helpers/build-search-values-checkbox-select.js +1 -1
  219. package/src/helpers/get-current-offset.js +1 -1
  220. package/src/helpers/get-wrapped-value-with-link.js +1 -1
  221. package/src/helpers/remove-unwanted-characters.js +1 -4
  222. package/src/hooks/helpers/buildPBComponents.js +2 -4
  223. package/src/hooks/helpers/get-components-to-insert-by-type.js +3 -1
  224. package/src/hooks/helpers/inject-textblock-banners.js +2 -8
  225. package/src/hooks/use-check-mobile-screen.js +5 -8
  226. package/src/hooks/use-get-entity-schema.js +5 -1
  227. package/src/hooks/use-get-image-id-from-relation.js +5 -1
  228. package/src/hooks/use-page-builder.js +9 -12
  229. package/src/variants/Infographic/index.js +2 -2
  230. package/src/variants/LongformGallery/LongformGallery.js +2 -8
  231. package/src/variants/LongformGallery/index.js +2 -2
  232. package/src/variants/SlideSummary/index.js +2 -2
  233. package/src/variants/ThumbnailCarousel/ThumbnailImage/ThumbnailImage.js +2 -3
  234. package/src/variants/ThumbnailCarousel/index.js +2 -2
  235. package/tests/unit/src/HOC/withTitle.test.js +11 -21
  236. package/tests/unit/src/Layout/Layout.test.js +2 -1
  237. package/tests/unit/src/Layout/helpers/check-if-row-has-columns.test.js +1 -0
  238. package/tests/unit/src/components/Banner/AdSlotRender.test.js +4 -1
  239. package/tests/unit/src/components/Banner/helpers.test.js +34 -7
  240. package/tests/unit/src/components/BlazeLink.test.js +1 -4
  241. package/tests/unit/src/components/Breadcrumb/__snapshots__/Breadcrumb.test.js.snap +18 -0
  242. package/tests/unit/src/components/Card/Card.test.js +17 -4
  243. package/tests/unit/src/components/Card/CardContainer.test.js +7 -1
  244. package/tests/unit/src/components/Card/__snapshots__/Card.test.js.snap +15 -0
  245. package/tests/unit/src/components/Card/__snapshots__/CardContainer.test.js.snap +12 -0
  246. package/tests/unit/src/components/Card/mockData.js +2 -4
  247. package/tests/unit/src/components/Carousel/CarouselRender/CarouselRender.test.js +47 -46
  248. package/tests/unit/src/components/Carousel/CarouselRender/__snapshots__/CarouselRender.test.js.snap +45 -1
  249. package/tests/unit/src/components/Carousel/CarouselRender/mocks.js +0 -0
  250. package/tests/unit/src/components/Carousel/__snapshots__/Carousel.test.js.snap +1 -1
  251. package/tests/unit/src/components/ContentGroup/ContentGroupTabs.test.js +4 -1
  252. package/tests/unit/src/components/ContentGroup/helpers/get-sections-data.test.js +4 -1
  253. package/tests/unit/src/components/DataSummary/__snapshots__/DataSummaryRender.test.js.snap +0 -1
  254. package/tests/unit/src/components/DataSummary/helpers/build-props-to-display-with-content.test.js +5 -1
  255. package/tests/unit/src/components/DataSummary/helpers/get-value-from-array.test.js +4 -1
  256. package/tests/unit/src/components/DataSummary/helpers/strip-summary-props-content.test.js +8 -2
  257. package/tests/unit/src/components/DataSummary/mockData.js +4 -1
  258. package/tests/unit/src/components/Image/ImageFactory.test.js +4 -3
  259. package/tests/unit/src/components/ItemList/ItemListCounter.test.js +2 -1
  260. package/tests/unit/src/components/ItemList/hooks/use-item-list-id.test.js +1 -1
  261. package/tests/unit/src/components/Layout/LayoutFactory.test.js +0 -4
  262. package/tests/unit/src/components/List/components/Cards/CardsRender.test.js +8 -1
  263. package/tests/unit/src/components/List/components/Pagination/Classic.test.js +1 -1
  264. package/tests/unit/src/components/PlaceholderIcon/index.test.js +2 -2
  265. package/tests/unit/src/components/SearchFilter/components/Range.test.js +5 -5
  266. package/tests/unit/src/components/SearchFilter/components/__snapshots__/Range.test.js.snap +175 -190
  267. package/tests/unit/src/components/SearchFilter/helpers/get-select-options.test.js +8 -2
  268. package/tests/unit/src/components/TextBlock/TextBlock.test.js +1 -1
  269. package/tests/unit/src/components/TextBlock/__snapshots__/TextBlock.test.js.snap +12 -0
  270. package/tests/unit/src/helpers/__snapshots__/parse-textBlock.test.js.snap +3 -0
  271. package/tests/unit/src/helpers/build-checkbox-filters.test.js +4 -1
  272. package/tests/unit/src/helpers/get-dictionary-match.test.js +1 -1
  273. package/tests/unit/src/helpers/parse-textBlock.test.js +3 -1
  274. package/tests/unit/src/hooks/use-check-mobile-screen.test.js +3 -2
  275. package/tests/unit/src/hooks/use-get-image-id-from-relation.test.js +3 -3
  276. package/tests/unit/src/hooks/use-get-images.test.js +16 -14
  277. package/tests/unit/src/hooks/use-get-single-entity-schema.test.js +6 -4
  278. package/tests/unit/src/hooks/use-page-builder.test.js +0 -48
@@ -4,8 +4,8 @@ const ThumbnailCarousel = {
4
4
  getSettings: componentSettings => ({
5
5
  ...componentSettings
6
6
  }),
7
- VariantComponent: dynamic(() =>
8
- import(/* webpackChunkName: "blazePbVariantThumbnailCarousel" */ './ThumbnailCarousel')
7
+ VariantComponent: dynamic(
8
+ () => import(/* webpackChunkName: "blazePbVariantThumbnailCarousel" */ './ThumbnailCarousel')
9
9
  )
10
10
  };
11
11
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import React from 'react';
5
5
  import '@testing-library/jest-dom/extend-expect';
6
- import { shallow } from 'enzyme';
6
+ import { render } from '@testing-library/react';
7
7
  import { withTitle } from '../../../../src/HOC';
8
8
 
9
9
  jest.mock('@blaze-cms/utils-handlebars', () => ({
@@ -15,36 +15,26 @@ const MockComponent = () => <div>MockedComponent</div>;
15
15
  describe('withTitle HOC', () => {
16
16
  it('should return h2 based on elementTitle prop', () => {
17
17
  const WrappedComponent = withTitle(MockComponent);
18
- const shallowWrapper = shallow(<WrappedComponent />);
19
- const children = shallowWrapper.prop('children');
20
-
21
- expect(children.length).toBe(2);
22
-
23
- const [firstChild, secondChild] = children;
24
-
25
- expect(firstChild).toBe('');
26
- expect(secondChild.type).toBe(MockComponent);
27
-
28
18
  const titleProp = 'test title';
29
- const wrapperWithTitle = shallow(<WrappedComponent elementTitle={titleProp} />);
30
- const [, secondChildWithTitle] = wrapperWithTitle.prop('children');
19
+ const { getByText } = render(<WrappedComponent elementTitle={titleProp} />);
31
20
 
32
- expect(wrapperWithTitle.text()).toContain(titleProp);
33
- expect(secondChildWithTitle.type).toBe(MockComponent);
21
+ expect(getByText('test title')).toBeInTheDocument();
22
+ expect(getByText('MockedComponent')).toBeInTheDocument();
34
23
  });
35
24
 
36
25
  it('should not display h2 if elementTitle is empty', () => {
37
26
  const WrappedComponent = withTitle(MockComponent);
38
27
  const blankTitle = '';
39
- const wrapperWithTitle = shallow(<WrappedComponent elementTitle={blankTitle} />);
40
-
41
- expect(wrapperWithTitle.find('.h2').length).toBe(0);
28
+ const { container } = render(<WrappedComponent elementTitle={blankTitle} />);
29
+ const header = container.querySelector('h2');
30
+ expect(header).toEqual(null);
42
31
  });
32
+
43
33
  it('should not display title if isHeroImg prop is true', () => {
44
34
  const WrappedComponent = withTitle(MockComponent);
45
35
  const blankTitle = '';
46
- const wrapperWithTitle = shallow(<WrappedComponent elementTitle={blankTitle} isHeroImg />);
47
-
48
- expect(wrapperWithTitle.find('.h2').length).toBe(0);
36
+ const { container } = render(<WrappedComponent elementTitle={blankTitle} isHeroImg />);
37
+ const header = container.querySelector('h2');
38
+ expect(header).toEqual(null);
49
39
  });
50
40
  });
@@ -25,7 +25,8 @@ describe('Layout component', () => {
25
25
  beforeAll(() =>
26
26
  useGetImages.mockImplementation(() => ({
27
27
  data: {}
28
- })));
28
+ }))
29
+ );
29
30
 
30
31
  beforeEach(async () => {
31
32
  component = await getMockedProvider(Layout, {
@@ -8,6 +8,7 @@ import { ROW, COLUMN } from '../../../../../src/components/Layout/constants';
8
8
 
9
9
  describe('checkIfRowHasColumns function', () => {
10
10
  const REACT_CHILDREN_WITH_COLUMN = [false, [<image id="1" component={{ type: 'column' }} />]];
11
+
11
12
  const ELEMENT_WITH_COLUMN = <element>{REACT_CHILDREN_WITH_COLUMN}</element>;
12
13
  const rowWithColumnChildren = checkIfRowHasColumns(ROW, ELEMENT_WITH_COLUMN);
13
14
 
@@ -23,7 +23,10 @@ const slotTestId = 'adslot-test';
23
23
  const sizeMapping = [
24
24
  {
25
25
  viewport: [970, 250],
26
- sizes: [[970, 250], [970, 528]]
26
+ sizes: [
27
+ [970, 250],
28
+ [970, 528]
29
+ ]
27
30
  },
28
31
  {
29
32
  viewport: [320, 100],
@@ -116,15 +116,24 @@ describe('buildBannerSizes helper', () => {
116
116
  it('should return an array of sizes based on given sizeId', () => {
117
117
  const parsedSizes = buildBannerSizes(
118
118
  'sizeId',
119
- [{ width: 300, height: 250 }, { width: 50, height: 50 }],
119
+ [
120
+ { width: 300, height: 250 },
121
+ { width: 50, height: 50 }
122
+ ],
120
123
  undefined
121
124
  );
122
- expect(parsedSizes).toEqual([[300, 250], [50, 50]]);
125
+ expect(parsedSizes).toEqual([
126
+ [300, 250],
127
+ [50, 50]
128
+ ]);
123
129
  });
124
130
 
125
131
  it('should return an array of sizes based on given sizes string', () => {
126
132
  const parsedSizes = buildBannerSizes(undefined, {}, '320x180,1x1');
127
- expect(parsedSizes).toEqual([[320, 180], [1, 1]]);
133
+ expect(parsedSizes).toEqual([
134
+ [320, 180],
135
+ [1, 1]
136
+ ]);
128
137
  });
129
138
  });
130
139
 
@@ -203,18 +212,36 @@ describe('buildSizeMapping helper', () => {
203
212
  {
204
213
  width: 300,
205
214
  height: 250,
206
- viewports: [{ width: 1024, height: 768 }, { width: 900, height: 768 }]
215
+ viewports: [
216
+ { width: 1024, height: 768 },
217
+ { width: 900, height: 768 }
218
+ ]
207
219
  },
208
220
  { width: 210, height: 60, viewports: [{ width: 900, height: 768 }] }
209
221
  ]);
210
222
  expect(sizeMappingEmpty).toEqual([
211
- { viewport: [1024, 768], sizes: [[728, 90], [300, 250]] },
212
- { viewport: [900, 768], sizes: [[300, 250], [210, 60]] }
223
+ {
224
+ viewport: [1024, 768],
225
+ sizes: [
226
+ [728, 90],
227
+ [300, 250]
228
+ ]
229
+ },
230
+ {
231
+ viewport: [900, 768],
232
+ sizes: [
233
+ [300, 250],
234
+ [210, 60]
235
+ ]
236
+ }
213
237
  ]);
214
238
  });
215
239
 
216
240
  it('should return empty size if a size dimension is falsey', () => {
217
- const viewports = [{ width: 1024, height: 768 }, { width: 768, height: null }];
241
+ const viewports = [
242
+ { width: 1024, height: 768 },
243
+ { width: 768, height: null }
244
+ ];
218
245
  const otherViewports = [{ width: 600, height: null }];
219
246
  const expectedSizes = [[300, 250]];
220
247
  const sizeMappingEmpty = buildSizeMapping('id', [
@@ -6,7 +6,7 @@ import { render, waitFor, act } from '@testing-library/react';
6
6
  import '@testing-library/jest-dom/extend-expect';
7
7
  import { MainContext } from '@blaze-cms/nextjs-components';
8
8
  import BlazeLink from '../../../../src/components/BlazeLink';
9
-
9
+ // TODO fix breaking test
10
10
  const mockedProps = {
11
11
  children: <div>child div</div>,
12
12
  href: '/test-href',
@@ -41,13 +41,10 @@ describe('BlazeLink component', () => {
41
41
  await waitFor(() => {
42
42
  expect(asFragment()).toMatchSnapshot();
43
43
  });
44
-
45
- await act(() => promise);
46
44
  });
47
45
 
48
46
  it('should use default props value when hasGTM is set to false', async () => {
49
47
  const promise = Promise.resolve();
50
-
51
48
  const { getByRole } = await renderWithContext();
52
49
 
53
50
  await waitFor(() => {
@@ -14,6 +14,9 @@ exports[`Breadcrumb component should match snapshot 1`] = `
14
14
  <a
15
15
  aria-label="Home"
16
16
  href="/"
17
+ />
18
+ <a
19
+ href="/"
17
20
  >
18
21
  Home
19
22
  </a>
@@ -21,6 +24,9 @@ exports[`Breadcrumb component should match snapshot 1`] = `
21
24
  <li
22
25
  class="breadcrumb__item"
23
26
  >
27
+ <a
28
+ href="/Resolver"
29
+ />
24
30
  <a />
25
31
  </li>
26
32
  </ul>
@@ -42,6 +48,9 @@ exports[`Breadcrumb component should not render if loading, err or no data exist
42
48
  <a
43
49
  aria-label="Home"
44
50
  href="/"
51
+ />
52
+ <a
53
+ href="/"
45
54
  >
46
55
  Home
47
56
  </a>
@@ -49,6 +58,9 @@ exports[`Breadcrumb component should not render if loading, err or no data exist
49
58
  <li
50
59
  class="breadcrumb__item"
51
60
  >
61
+ <a
62
+ href="/Resolver"
63
+ />
52
64
  <a />
53
65
  </li>
54
66
  </ul>
@@ -70,6 +82,9 @@ exports[`Breadcrumb component should render 1`] = `
70
82
  <a
71
83
  aria-label="Home"
72
84
  href="/"
85
+ />
86
+ <a
87
+ href="/"
73
88
  >
74
89
  Home
75
90
  </a>
@@ -77,6 +92,9 @@ exports[`Breadcrumb component should render 1`] = `
77
92
  <li
78
93
  class="breadcrumb__item"
79
94
  >
95
+ <a
96
+ href="/Resolver"
97
+ />
80
98
  <a />
81
99
  </li>
82
100
  </ul>
@@ -4,10 +4,16 @@
4
4
  import React from 'react';
5
5
  import { render as _render, act, waitFor, screen } from '@testing-library/react';
6
6
  import '@testing-library/jest-dom/extend-expect';
7
+ import { useRouter } from 'next/router';
7
8
  import { setEnvs, deleteEnvs } from '@blaze-cms/tools/test-helpers/test-files/test-env';
8
9
  import Card from '../../../../../src/components/Card/Card';
9
10
  import { pageBuilderComponentsMocks } from './mockData';
10
11
 
12
+ jest.mock('react', () => ({
13
+ ...jest.requireActual('react'),
14
+ useContext: () => ({ itemId: 'contextItemId', isPreview: false })
15
+ }));
16
+
11
17
  const render = async (Component, props) => {
12
18
  let renderResults;
13
19
 
@@ -27,7 +33,9 @@ const propsToDisplay = [
27
33
  htmlAttribute: 'data-testid'
28
34
  }
29
35
  ];
30
- const getMockedParsedProp = children => <>{children}</>;
36
+ const getMockedParsedProp = children => {
37
+ children;
38
+ };
31
39
  const firstPropValue = 'some description';
32
40
  const secondPropValue = 'extra props';
33
41
  const firstPropToDisplay = getMockedParsedProp(['', '', firstPropValue, '', '']);
@@ -66,11 +74,16 @@ const preHeaderName = 'Pre header';
66
74
  const alternativeHeadline = 'Alternative headline';
67
75
 
68
76
  // eslint-disable-next-line react/prop-types
69
- jest.mock('../../../../../src/components/LazyImage', () => ({ src, alt }) => (
70
- <img src={src} alt={alt} />
71
- ));
77
+ jest.mock(
78
+ '../../../../../src/components/LazyImage',
79
+ () =>
80
+ function ({ src, alt }) {
81
+ return <img src={src} alt={alt} />;
82
+ }
83
+ );
72
84
 
73
85
  describe('Card component', () => {
86
+ const router = useRouter();
74
87
  it('should render without throwing an error and match snapshot', async () => {
75
88
  const { asFragment, getByTestId } = await render(Card, componentProps);
76
89
  expect(getByTestId(encodeURIComponent(firstPropValue))).toBeDefined();
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import React from 'react';
5
5
  import { render, act, waitFor } from '@testing-library/react';
6
-
6
+ import { useRouter } from 'next/router';
7
7
  import '@testing-library/jest-dom/extend-expect';
8
8
  import CardsContainer from '../../../../../src/components/Card/CardsContainer';
9
9
  import { cardDataMockedOptions } from './mockData';
@@ -12,6 +12,11 @@ jest.mock('@blaze-cms/utils-handlebars', () => ({
12
12
  useStringTemplate: jest.fn((parent, [title]) => ({ loadig: false, data: [title] }))
13
13
  }));
14
14
 
15
+ jest.mock('react', () => ({
16
+ ...jest.requireActual('react'),
17
+ useContext: () => ({ itemId: 'contextItemId', isPreview: false })
18
+ }));
19
+
15
20
  // eslint-disable-next-line react/prop-types
16
21
  jest.mock('../../../../../src/components/LazyImage', () => () => null);
17
22
 
@@ -30,6 +35,7 @@ const renderComponent = async props => {
30
35
  };
31
36
 
32
37
  describe('CardsContainer component', () => {
38
+ useRouter();
33
39
  it('should render without throwing error and match snapshot', async () => {
34
40
  const { asFragment } = await renderComponent({
35
41
  ...cardDataMockedOptions,
@@ -38,6 +38,9 @@ exports[`Card component should not render alternative headline if alternativePre
38
38
  <a
39
39
  aria-label="mock name"
40
40
  href="/mockurl"
41
+ />
42
+ <a
43
+ href="/mockurl"
41
44
  >
42
45
  mock name
43
46
  </a>
@@ -109,6 +112,9 @@ exports[`Card component should not render alternative headline if displayCategor
109
112
  <a
110
113
  aria-label="mock name"
111
114
  href="/mockurl"
115
+ />
116
+ <a
117
+ href="/mockurl"
112
118
  >
113
119
  mock name
114
120
  </a>
@@ -187,6 +193,9 @@ exports[`Card component should not render preHeader if alternativeHeadline is no
187
193
  <a
188
194
  aria-label="mock name"
189
195
  href="/mockurl"
196
+ />
197
+ <a
198
+ href="/mockurl"
190
199
  >
191
200
  mock name
192
201
  </a>
@@ -263,6 +272,9 @@ exports[`Card component should render customPreheader and alternativeHeadline in
263
272
  <a
264
273
  aria-label="Alternative headline"
265
274
  href="/mockurl"
275
+ />
276
+ <a
277
+ href="/mockurl"
266
278
  >
267
279
  Alternative headline
268
280
  </a>
@@ -424,6 +436,9 @@ exports[`Card component should render without throwing an error and match snapsh
424
436
  <a
425
437
  aria-label="mock name"
426
438
  href="/mockurl"
439
+ />
440
+ <a
441
+ href="/mockurl"
427
442
  >
428
443
  mock name
429
444
  </a>
@@ -43,6 +43,9 @@ exports[`CardsContainer component should render with carousel if option is enabl
43
43
  <a
44
44
  aria-label="Swan 78"
45
45
  href="/nautors-swan/swan-78"
46
+ />
47
+ <a
48
+ href="/nautors-swan/swan-78"
46
49
  >
47
50
  Swan 78
48
51
  </a>
@@ -82,6 +85,9 @@ exports[`CardsContainer component should render with carousel if option is enabl
82
85
  <a
83
86
  aria-label="Swan 98"
84
87
  href="/nautors-swan/swan-98"
88
+ />
89
+ <a
90
+ href="/nautors-swan/swan-98"
85
91
  >
86
92
  Swan 98
87
93
  </a>
@@ -135,6 +141,9 @@ exports[`CardsContainer component should render without throwing error and match
135
141
  <a
136
142
  aria-label="Swan 78"
137
143
  href="/nautors-swan/swan-78"
144
+ />
145
+ <a
146
+ href="/nautors-swan/swan-78"
138
147
  >
139
148
  Swan 78
140
149
  </a>
@@ -174,6 +183,9 @@ exports[`CardsContainer component should render without throwing error and match
174
183
  <a
175
184
  aria-label="Swan 98"
176
185
  href="/nautors-swan/swan-98"
186
+ />
187
+ <a
188
+ href="/nautors-swan/swan-98"
177
189
  >
178
190
  Swan 98
179
191
  </a>
@@ -4,8 +4,7 @@ const cardDataMockedOptions = {
4
4
  name: 'Swan 78',
5
5
  url: '/nautors-swan/swan-78',
6
6
  image: {
7
- url:
8
- 'https://cdn-events.boatinternational.com/files/2020/04/2506afd0-879a-11ea-aab3-6d01477a82d7-180807_esk_0267.jpg',
7
+ url: 'https://cdn-events.boatinternational.com/files/2020/04/2506afd0-879a-11ea-aab3-6d01477a82d7-180807_esk_0267.jpg',
9
8
  data: {
10
9
  altText: 'Swan 78 | Exterior',
11
10
  caption: ''
@@ -25,8 +24,7 @@ const cardDataMockedOptions = {
25
24
  url: '/nautors-swan/swan-98',
26
25
  arrowSize: 14,
27
26
  image: {
28
- url:
29
- 'https://cdn-events.boatinternational.com/files/2020/04/2f8c4030-879c-11ea-aab3-6d01477a82d7-Swan 98 - 1.jpg',
27
+ url: 'https://cdn-events.boatinternational.com/files/2020/04/2f8c4030-879c-11ea-aab3-6d01477a82d7-Swan 98 - 1.jpg',
30
28
  data: {
31
29
  altText: 'Swan 98 | Exterior',
32
30
  caption: ''
@@ -3,71 +3,72 @@
3
3
  */
4
4
  import React from 'react';
5
5
  import '@testing-library/jest-dom/extend-expect';
6
- import { shallow } from 'enzyme';
7
- import CarouselImage from '../../../../../../src/components/Carousel/CarouselImage';
6
+ import { useRouter } from 'next/router';
7
+ import { render, waitFor } from '@testing-library/react';
8
+ import { MockedRoot } from '@blaze-cms/tools/test-helpers/test-functions';
9
+ import { MOCK_BASIC, MOCK_RELATION } from '../../Image/mocks';
8
10
  import CarouselRender from '../../../../../../src/components/Carousel/CarouselRender';
9
-
11
+ // TODO fix test breaking
10
12
  jest.mock('@blaze-cms/utils-handlebars', () => ({
11
- useStringTemplate: jest.fn((parent, [title]) => ({ loadig: false, data: [title] }))
13
+ useStringTemplate: jest.fn((_, [title]) => ({ loadig: false, data: [title] }))
14
+ }));
15
+
16
+ jest.mock('react', () => ({
17
+ ...jest.requireActual('react'),
18
+ useContext: () => ({ isPreview: false })
12
19
  }));
13
20
 
14
- const mockedProps = {
21
+ const getMockedProps = overrides => ({
15
22
  imageIds: ['test-id', 'test-altText', 'test-caption'],
16
23
  displayCount: true,
17
24
  enableLightbox: true,
18
25
  toggleModal: jest.fn(),
19
26
  handleSelectedImage: jest.fn(),
20
- shouldDisplayCount: true,
21
- shouldDisplayCaption: true,
22
- direction: {
23
- next: true,
24
- back: false
25
- },
26
- handleNavigation: jest.fn()
27
- };
27
+ ...overrides
28
+ });
28
29
 
29
30
  describe('CarouselRender component', () => {
30
- let wrapper;
31
+ const router = useRouter();
32
+ const mockedProps = getMockedProps();
31
33
 
32
- beforeAll(() => {
33
- wrapper = shallow(<CarouselRender.WrappedComponent {...mockedProps} />);
34
- });
35
-
36
- it('should be defined and render without throwing error', () => {
37
- expect(CarouselRender).toBeDefined();
38
- expect(typeof CarouselRender).toEqual('function');
39
- });
34
+ it('should render one image button if there is one image to display', async () => {
35
+ const overrides = { imageIds: ['test1'] };
36
+ const { getByText } = render(
37
+ <MockedRoot mocks={MOCK_BASIC}>
38
+ <CarouselRender {...mockedProps} {...overrides} />
39
+ </MockedRoot>
40
+ );
40
41
 
41
- it('should match snapshot', async () => {
42
- const component = shallow(<CarouselRender {...mockedProps} />);
43
- expect(component).toMatchSnapshot();
42
+ await waitFor(() => {
43
+ expect(getByText('1 image')).toBeInTheDocument();
44
+ });
44
45
  });
45
46
 
46
- it('should render number count if there are images to display and show count is enabled', () => {
47
- expect(wrapper.find('p').length).toEqual(1);
48
- });
47
+ it('should render n images button if there is more than one image to display', async () => {
48
+ const overrides = { imageIds: ['test-id', 'test-id-2'] };
49
+ const { getByText } = render(
50
+ <MockedRoot mocks={MOCK_RELATION}>
51
+ <CarouselRender {...mockedProps} {...overrides} />
52
+ </MockedRoot>
53
+ );
49
54
 
50
- it('should render the right amount of images to display', () => {
51
- expect(wrapper.find(CarouselImage).length).toEqual(3);
55
+ await waitFor(() => {
56
+ expect(getByText('2 images')).toBeInTheDocument();
57
+ });
52
58
  });
53
59
 
54
- it('should not render number count if display count is disabled', () => {
55
- const overrides = { shouldDisplayCount: false };
56
- const wrapperCountDisabled = shallow(
57
- <CarouselRender.WrappedComponent {...mockedProps} {...overrides} />
60
+ it('should not render number count if display count is disabled', async () => {
61
+ const overrides = { displayCount: false };
62
+ const { asFragment, container } = render(
63
+ <MockedRoot mocks={MOCK_BASIC}>
64
+ <CarouselRender {...mockedProps} {...overrides} />
65
+ </MockedRoot>
58
66
  );
59
- expect(wrapperCountDisabled.find('p').length).toEqual(0);
60
- });
61
-
62
- it('should not display number count after clicking previous image', () => {
63
- const wrapperPrevClick = shallow(<CarouselRender.WrappedComponent {...mockedProps} />);
64
- wrapperPrevClick.find('div.carousel__button--previous').simulate('click');
65
- expect(mockedProps.handleNavigation).toHaveBeenCalledWith(mockedProps.direction.back);
66
- });
67
67
 
68
- it('should not display number count after clicking next image', () => {
69
- const wrapperNextClick = shallow(<CarouselRender.WrappedComponent {...mockedProps} />);
70
- wrapperNextClick.find('div.carousel__button--next').simulate('click');
71
- expect(mockedProps.handleNavigation).toHaveBeenCalledWith(mockedProps.direction.next);
68
+ await waitFor(() => {
69
+ const countDisplay = container.querySelector('p');
70
+ expect(countDisplay).toBe(null);
71
+ expect(asFragment()).toMatchSnapshot();
72
+ });
72
73
  });
73
74
  });
@@ -1,3 +1,47 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`CarouselRender component should match snapshot 1`] = `ShallowWrapper {}`;
3
+ exports[`CarouselRender component should not render number count if display count is disabled 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ class="carousel"
7
+ >
8
+ <div>
9
+ <div
10
+ class="carousel__button carousel__button--previous"
11
+ role="button"
12
+ >
13
+ <div
14
+ class="arrow arrow--left"
15
+ />
16
+ </div>
17
+ <div
18
+ class="carousel__list"
19
+ >
20
+ <div
21
+ class="carousel__slide"
22
+ >
23
+ <div />
24
+ </div>
25
+ <div
26
+ class="carousel__slide"
27
+ >
28
+ <div />
29
+ </div>
30
+ <div
31
+ class="carousel__slide"
32
+ >
33
+ <div />
34
+ </div>
35
+ </div>
36
+ <div
37
+ class="carousel__button carousel__button--next"
38
+ role="button"
39
+ >
40
+ <div
41
+ class="arrow arrow--right"
42
+ />
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </DocumentFragment>
47
+ `;
@@ -21,7 +21,7 @@ exports[`Carousel component should render carousel and match snapshot 1`] = `
21
21
  <div
22
22
  class="carousel__slide"
23
23
  >
24
- <span />
24
+ <div />
25
25
  </div>
26
26
  </div>
27
27
  <div
@@ -13,7 +13,10 @@ const mockedProps = {
13
13
  name: 'testTabs',
14
14
  contentType: 'tab',
15
15
  groupSections: [<div>section one</div>, <div>section two</div>],
16
- sectionsData: [['section-one', 'sectionOne'], ['section-two', 'sectionTwo']]
16
+ sectionsData: [
17
+ ['section-one', 'sectionOne'],
18
+ ['section-two', 'sectionTwo']
19
+ ]
17
20
  };
18
21
 
19
22
  describe('ContentGroupTabs component', () => {
@@ -15,7 +15,10 @@ describe('getSectionsData helper', () => {
15
15
  it('should return section name and label', () => {
16
16
  const match = getSectionsData(mockedSections);
17
17
 
18
- expect(match).toEqual([['nameone', 'labelonne'], ['nameTwo', 'labelTwo']]);
18
+ expect(match).toEqual([
19
+ ['nameone', 'labelonne'],
20
+ ['nameTwo', 'labelTwo']
21
+ ]);
19
22
  });
20
23
 
21
24
  it('should return section name and label propertly formated when spaces are present', () => {
@@ -4,7 +4,6 @@ exports[`DataSummaryRender component should render without throwing an error 1`]
4
4
  <div
5
5
  className="stats"
6
6
  >
7
-
8
7
  <div
9
8
  className="stats__wrapper"
10
9
  >