@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.
- package/CHANGELOG.md +31 -197
- package/lib/HOC/recreateOnNavigation.js.map +1 -1
- package/lib/HOC/withTitle.js.map +1 -1
- package/lib/application/query/index.js +1 -0
- package/lib/application/query/index.js.map +1 -1
- package/lib/components/BackToTop/BackToTop.js.map +1 -1
- package/lib/components/Banner/AdSlotRender.js +1 -1
- package/lib/components/Banner/Banner.js +1 -1
- package/lib/components/Banner/BannerRender.js.map +1 -1
- package/lib/components/Breadcrumb/Breadcrumb.js +1 -1
- package/lib/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/CardsContainer.js +1 -1
- package/lib/components/Card/CardsFactory.js.map +1 -1
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Carousel/CarouselRender/CarouselRender.js +1 -0
- package/lib/components/Carousel/CarouselRender/CarouselRender.js.map +1 -1
- package/lib/components/CarouselWrapper/DefaultCarousel.js.map +1 -1
- package/lib/components/ContentGroup/ContentGroupTabs.js +1 -1
- package/lib/components/ContentGroup/ContentGroupTabs.js.map +1 -1
- package/lib/components/ContentGroup/helpers/get-sections-data.js +1 -0
- package/lib/components/ContentGroup/helpers/get-sections-data.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryRender.js +1 -0
- package/lib/components/DataSummary/DataSummaryRender.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummaryContent.js +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummaryContent.js +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummaryContent.js +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummaryContent.js +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
- package/lib/components/DateTime/DateTime.js +4 -4
- package/lib/components/DateTime/DateTime.js.map +1 -1
- package/lib/components/EmailConfirm/EmailConfirm.js +3 -3
- package/lib/components/EmailConfirm/EmailConfirm.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/GlobalLightbox.js +2 -2
- package/lib/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/index.js.map +1 -1
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Image/ImageFactory.js +1 -1
- package/lib/components/Image/ImageFactory.js.map +1 -1
- package/lib/components/ItemList/helpers/get-item-list-ids.js +1 -0
- package/lib/components/ItemList/helpers/get-item-list-ids.js.map +1 -1
- package/lib/components/ItemList/hooks/use-item-list-id.js.map +1 -1
- package/lib/components/Layout/LayoutFactory.js.map +1 -1
- package/lib/components/Layout/LayoutWithStickyTimer.js.map +1 -1
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/ListRender.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRenderWrapper.js +1 -1
- package/lib/components/List/components/Full/FullRender.js +1 -1
- package/lib/components/List/components/Full/FullRenderItem.js +1 -1
- package/lib/components/List/components/Header/ListHeader.js +1 -0
- package/lib/components/List/components/Header/ListHeader.js.map +1 -1
- package/lib/components/List/components/Pagination/ListPagination.js.map +1 -1
- package/lib/components/List/components/Pagination/LoadMore.js +2 -2
- package/lib/components/List/components/Pagination/LoadMore.js.map +1 -1
- package/lib/components/List/helpers/build-query-booster.js +1 -1
- package/lib/components/List/helpers/sort-aggs.js.map +1 -1
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/MenuItem/MenuItemRender.js.map +1 -1
- package/lib/components/ModalAdapter/index.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchContent/SearchContentItems.js +1 -0
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js +1 -0
- package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-select-options.js +1 -0
- package/lib/components/SearchFilter/helpers/get-select-options.js.map +1 -1
- package/lib/components/SearchFilter/helpers/parse-filter-value.js +1 -0
- package/lib/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
- package/lib/components/SearchFilterSort/SearchFilterSort.js +1 -0
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SocialFollow/SocialFollowRender.js +1 -0
- package/lib/components/SocialFollow/SocialFollowRender.js.map +1 -1
- package/lib/components/Video/providers/Vimeo/VimeoProvider.js.map +1 -1
- package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
- package/lib/components/Video/providers/get-provider.js.map +1 -1
- package/lib/components/Wrapper.js +2 -2
- package/lib/components/Wrapper.js.map +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/constants/index.js.map +1 -1
- package/lib/helpers/build-query-fields.js +1 -0
- package/lib/helpers/build-query-fields.js.map +1 -1
- package/lib/helpers/build-search-values-checkbox-select.js +1 -1
- package/lib/helpers/build-search-values-checkbox-select.js.map +1 -1
- package/lib/helpers/check-props-to-use.js +1 -0
- package/lib/helpers/check-props-to-use.js.map +1 -1
- package/lib/helpers/get-current-offset.js +4 -5
- package/lib/helpers/get-current-offset.js.map +1 -1
- package/lib/helpers/get-entities-with-banner.js +1 -1
- package/lib/helpers/get-wrapped-value-with-link.js +1 -0
- package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-entities/get-banners-for-entities.js +1 -0
- package/lib/helpers/inject-multiple-banners/get-banners-for-entities/get-banners-for-entities.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js +1 -1
- package/lib/helpers/process-data-summary-value.js +1 -1
- package/lib/helpers/remove-unwanted-characters.js +1 -1
- package/lib/helpers/remove-unwanted-characters.js.map +1 -1
- package/lib/hooks/helpers/buildPBComponents.js.map +1 -1
- package/lib/hooks/helpers/get-components-to-insert-by-type.js.map +1 -1
- package/lib/hooks/helpers/get-lightbox-images.js +1 -1
- package/lib/hooks/helpers/inject-textblock-banners.js.map +1 -1
- package/lib/hooks/use-check-mobile-screen.js.map +1 -1
- package/lib/hooks/use-get-entity-schema.js.map +1 -1
- package/lib/hooks/use-get-image-id-from-relation.js.map +1 -1
- package/lib/hooks/use-page-builder.js +1 -1
- package/lib/hooks/use-page-builder.js.map +1 -1
- package/lib/utils/get-props-to-display-modifiers.js +1 -0
- package/lib/utils/get-props-to-display-modifiers.js.map +1 -1
- package/lib/variants/Infographic/index.js.map +1 -1
- package/lib/variants/LongformGallery/LongformGallery.js +1 -0
- package/lib/variants/LongformGallery/LongformGallery.js.map +1 -1
- package/lib/variants/LongformGallery/index.js.map +1 -1
- package/lib/variants/SlideSummary/index.js.map +1 -1
- package/lib/variants/ThumbnailCarousel/ThumbnailCarousel.js +1 -0
- package/lib/variants/ThumbnailCarousel/ThumbnailCarousel.js.map +1 -1
- package/lib/variants/ThumbnailCarousel/ThumbnailImage/ThumbnailImage.js.map +1 -1
- package/lib/variants/ThumbnailCarousel/index.js.map +1 -1
- package/lib-es/HOC/recreateOnNavigation.js.map +1 -1
- package/lib-es/HOC/withTitle.js.map +1 -1
- package/lib-es/components/BackToTop/BackToTop.js.map +1 -1
- package/lib-es/components/Banner/BannerRender.js.map +1 -1
- package/lib-es/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/lib-es/components/Button.js.map +1 -1
- package/lib-es/components/Card/CardsFactory.js.map +1 -1
- package/lib-es/components/Card/CardsRender.js.map +1 -1
- package/lib-es/components/CarouselWrapper/DefaultCarousel.js.map +1 -1
- package/lib-es/components/ContentGroup/ContentGroupTabs.js.map +1 -1
- package/lib-es/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
- package/lib-es/components/DateTime/DateTime.js +4 -4
- package/lib-es/components/DateTime/DateTime.js.map +1 -1
- package/lib-es/components/EmailConfirm/EmailConfirm.js +4 -4
- package/lib-es/components/EmailConfirm/EmailConfirm.js.map +1 -1
- package/lib-es/components/Image/GlobalLightbox/GlobalLightbox.js +3 -3
- package/lib-es/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
- package/lib-es/components/Image/GlobalLightbox/index.js.map +1 -1
- package/lib-es/components/Image/Image.js.map +1 -1
- package/lib-es/components/Image/ImageFactory.js.map +1 -1
- package/lib-es/components/ItemList/hooks/use-item-list-id.js.map +1 -1
- package/lib-es/components/Layout/LayoutFactory.js.map +1 -1
- package/lib-es/components/Layout/LayoutWithStickyTimer.js.map +1 -1
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/ListRender.js.map +1 -1
- package/lib-es/components/List/components/Pagination/ListPagination.js.map +1 -1
- package/lib-es/components/List/components/Pagination/LoadMore.js +2 -2
- package/lib-es/components/List/components/Pagination/LoadMore.js.map +1 -1
- package/lib-es/components/List/helpers/sort-aggs.js.map +1 -1
- package/lib-es/components/Menu/Menu.js.map +1 -1
- package/lib-es/components/MenuItem/MenuItemRender.js.map +1 -1
- package/lib-es/components/ModalAdapter/index.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/Video/providers/Vimeo/VimeoProvider.js.map +1 -1
- package/lib-es/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
- package/lib-es/components/Video/providers/get-provider.js.map +1 -1
- package/lib-es/components/Wrapper.js +2 -2
- package/lib-es/components/Wrapper.js.map +1 -1
- package/lib-es/components/index.js.map +1 -1
- package/lib-es/constants/index.js.map +1 -1
- package/lib-es/helpers/build-search-values-checkbox-select.js +1 -1
- package/lib-es/helpers/build-search-values-checkbox-select.js.map +1 -1
- package/lib-es/helpers/get-current-offset.js +1 -1
- package/lib-es/helpers/get-current-offset.js.map +1 -1
- package/lib-es/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib-es/helpers/remove-unwanted-characters.js.map +1 -1
- package/lib-es/hooks/helpers/buildPBComponents.js.map +1 -1
- package/lib-es/hooks/helpers/get-components-to-insert-by-type.js.map +1 -1
- package/lib-es/hooks/helpers/inject-textblock-banners.js.map +1 -1
- package/lib-es/hooks/use-check-mobile-screen.js.map +1 -1
- package/lib-es/hooks/use-get-entity-schema.js.map +1 -1
- package/lib-es/hooks/use-get-image-id-from-relation.js.map +1 -1
- package/lib-es/hooks/use-page-builder.js +1 -1
- package/lib-es/hooks/use-page-builder.js.map +1 -1
- package/lib-es/variants/Infographic/index.js.map +1 -1
- package/lib-es/variants/LongformGallery/LongformGallery.js.map +1 -1
- package/lib-es/variants/LongformGallery/index.js.map +1 -1
- package/lib-es/variants/SlideSummary/index.js.map +1 -1
- package/lib-es/variants/ThumbnailCarousel/ThumbnailImage/ThumbnailImage.js.map +1 -1
- package/lib-es/variants/ThumbnailCarousel/index.js.map +1 -1
- package/package.json +20 -19
- package/src/HOC/recreateOnNavigation.js +3 -3
- package/src/HOC/withTitle.js +3 -3
- package/src/components/BackToTop/BackToTop.js +5 -8
- package/src/components/Banner/BannerRender.js +0 -2
- package/src/components/Breadcrumb/Breadcrumb.js +5 -1
- package/src/components/Button.js +3 -6
- package/src/components/Card/CardsFactory.js +8 -7
- package/src/components/Card/CardsRender.js +5 -3
- package/src/components/CarouselWrapper/DefaultCarousel.js +20 -26
- package/src/components/ContentGroup/ContentGroupTabs.js +4 -7
- package/src/components/DataSummary/DataSummaryTypes/index.js +14 -10
- package/src/components/DateTime/DateTime.js +4 -4
- package/src/components/EmailConfirm/EmailConfirm.js +9 -11
- package/src/components/Image/GlobalLightbox/GlobalLightbox.js +7 -9
- package/src/components/Image/GlobalLightbox/index.js +2 -2
- package/src/components/Image/Image.js +6 -4
- package/src/components/Image/ImageFactory.js +5 -5
- package/src/components/ItemList/hooks/use-item-list-id.js +10 -13
- package/src/components/Layout/LayoutFactory.js +2 -2
- package/src/components/Layout/LayoutWithStickyTimer.js +11 -14
- package/src/components/List/ListFactory.js +10 -11
- package/src/components/List/ListRender.js +6 -1
- package/src/components/List/components/Pagination/ListPagination.js +3 -6
- package/src/components/List/components/Pagination/LoadMore.js +7 -9
- package/src/components/List/helpers/sort-aggs.js +1 -2
- package/src/components/Menu/Menu.js +12 -16
- package/src/components/MenuItem/MenuItemRender.js +3 -6
- package/src/components/ModalAdapter/index.js +2 -2
- package/src/components/SearchContent/SearchContent.js +26 -32
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +15 -19
- package/src/components/Video/providers/Vimeo/VimeoProvider.js +19 -22
- package/src/components/Video/providers/YouTube/YoutubeEmbeded.js +58 -64
- package/src/components/Video/providers/get-provider.js +4 -4
- package/src/components/Wrapper.js +5 -7
- package/src/components/index.js +20 -20
- package/src/constants/index.js +2 -1
- package/src/helpers/build-search-values-checkbox-select.js +1 -1
- package/src/helpers/get-current-offset.js +1 -1
- package/src/helpers/get-wrapped-value-with-link.js +1 -1
- package/src/helpers/remove-unwanted-characters.js +1 -4
- package/src/hooks/helpers/buildPBComponents.js +2 -4
- package/src/hooks/helpers/get-components-to-insert-by-type.js +3 -1
- package/src/hooks/helpers/inject-textblock-banners.js +2 -8
- package/src/hooks/use-check-mobile-screen.js +5 -8
- package/src/hooks/use-get-entity-schema.js +5 -1
- package/src/hooks/use-get-image-id-from-relation.js +5 -1
- package/src/hooks/use-page-builder.js +9 -12
- package/src/variants/Infographic/index.js +2 -2
- package/src/variants/LongformGallery/LongformGallery.js +2 -8
- package/src/variants/LongformGallery/index.js +2 -2
- package/src/variants/SlideSummary/index.js +2 -2
- package/src/variants/ThumbnailCarousel/ThumbnailImage/ThumbnailImage.js +2 -3
- package/src/variants/ThumbnailCarousel/index.js +2 -2
- package/tests/unit/src/HOC/withTitle.test.js +11 -21
- package/tests/unit/src/Layout/Layout.test.js +2 -1
- package/tests/unit/src/Layout/helpers/check-if-row-has-columns.test.js +1 -0
- package/tests/unit/src/components/Banner/AdSlotRender.test.js +4 -1
- package/tests/unit/src/components/Banner/helpers.test.js +34 -7
- package/tests/unit/src/components/BlazeLink.test.js +1 -4
- package/tests/unit/src/components/Breadcrumb/__snapshots__/Breadcrumb.test.js.snap +18 -0
- package/tests/unit/src/components/Card/Card.test.js +17 -4
- package/tests/unit/src/components/Card/CardContainer.test.js +7 -1
- package/tests/unit/src/components/Card/__snapshots__/Card.test.js.snap +15 -0
- package/tests/unit/src/components/Card/__snapshots__/CardContainer.test.js.snap +12 -0
- package/tests/unit/src/components/Card/mockData.js +2 -4
- package/tests/unit/src/components/Carousel/CarouselRender/CarouselRender.test.js +47 -46
- package/tests/unit/src/components/Carousel/CarouselRender/__snapshots__/CarouselRender.test.js.snap +45 -1
- package/tests/unit/src/components/Carousel/CarouselRender/mocks.js +0 -0
- package/tests/unit/src/components/Carousel/__snapshots__/Carousel.test.js.snap +1 -1
- package/tests/unit/src/components/ContentGroup/ContentGroupTabs.test.js +4 -1
- package/tests/unit/src/components/ContentGroup/helpers/get-sections-data.test.js +4 -1
- package/tests/unit/src/components/DataSummary/__snapshots__/DataSummaryRender.test.js.snap +0 -1
- package/tests/unit/src/components/DataSummary/helpers/build-props-to-display-with-content.test.js +5 -1
- package/tests/unit/src/components/DataSummary/helpers/get-value-from-array.test.js +4 -1
- package/tests/unit/src/components/DataSummary/helpers/strip-summary-props-content.test.js +8 -2
- package/tests/unit/src/components/DataSummary/mockData.js +4 -1
- package/tests/unit/src/components/Image/ImageFactory.test.js +4 -3
- package/tests/unit/src/components/ItemList/ItemListCounter.test.js +2 -1
- package/tests/unit/src/components/ItemList/hooks/use-item-list-id.test.js +1 -1
- package/tests/unit/src/components/Layout/LayoutFactory.test.js +0 -4
- package/tests/unit/src/components/List/components/Cards/CardsRender.test.js +8 -1
- package/tests/unit/src/components/List/components/Pagination/Classic.test.js +1 -1
- package/tests/unit/src/components/PlaceholderIcon/index.test.js +2 -2
- package/tests/unit/src/components/SearchFilter/components/Range.test.js +5 -5
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/Range.test.js.snap +175 -190
- package/tests/unit/src/components/SearchFilter/helpers/get-select-options.test.js +8 -2
- package/tests/unit/src/components/TextBlock/TextBlock.test.js +1 -1
- package/tests/unit/src/components/TextBlock/__snapshots__/TextBlock.test.js.snap +12 -0
- package/tests/unit/src/helpers/__snapshots__/parse-textBlock.test.js.snap +3 -0
- package/tests/unit/src/helpers/build-checkbox-filters.test.js +4 -1
- package/tests/unit/src/helpers/get-dictionary-match.test.js +1 -1
- package/tests/unit/src/helpers/parse-textBlock.test.js +3 -1
- package/tests/unit/src/hooks/use-check-mobile-screen.test.js +3 -2
- package/tests/unit/src/hooks/use-get-image-id-from-relation.test.js +3 -3
- package/tests/unit/src/hooks/use-get-images.test.js +16 -14
- package/tests/unit/src/hooks/use-get-single-entity-schema.test.js +6 -4
- package/tests/unit/src/hooks/use-page-builder.test.js +0 -48
|
@@ -14,6 +14,9 @@ exports[`TextBlock component With wrapper flag should render with wrapper and le
|
|
|
14
14
|
<a
|
|
15
15
|
aria-label="link"
|
|
16
16
|
href="/"
|
|
17
|
+
/>
|
|
18
|
+
<a
|
|
19
|
+
href="/"
|
|
17
20
|
>
|
|
18
21
|
link
|
|
19
22
|
</a>
|
|
@@ -37,6 +40,9 @@ exports[`TextBlock component With wrapper flag should render with wrapper and le
|
|
|
37
40
|
<a
|
|
38
41
|
aria-label="link"
|
|
39
42
|
href="/"
|
|
43
|
+
/>
|
|
44
|
+
<a
|
|
45
|
+
href="/"
|
|
40
46
|
>
|
|
41
47
|
link
|
|
42
48
|
</a>
|
|
@@ -60,6 +66,9 @@ exports[`TextBlock component should match snapshot 1`] = `
|
|
|
60
66
|
<a
|
|
61
67
|
aria-label="link"
|
|
62
68
|
href="/"
|
|
69
|
+
/>
|
|
70
|
+
<a
|
|
71
|
+
href="/"
|
|
63
72
|
>
|
|
64
73
|
link
|
|
65
74
|
</a>
|
|
@@ -80,6 +89,9 @@ exports[`TextBlock component should not render wrapper if no modifier 1`] = `
|
|
|
80
89
|
<a
|
|
81
90
|
aria-label="link"
|
|
82
91
|
href="/"
|
|
92
|
+
/>
|
|
93
|
+
<a
|
|
94
|
+
href="/"
|
|
83
95
|
>
|
|
84
96
|
link
|
|
85
97
|
</a>
|
|
@@ -8,7 +8,10 @@ describe('buildCheckboxFilters helper', () => {
|
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
it('should handle new array filters', () => {
|
|
11
|
-
const checkboxFilters = [
|
|
11
|
+
const checkboxFilters = [
|
|
12
|
+
['filterName', 'not'],
|
|
13
|
+
['secondFilter', 'on']
|
|
14
|
+
];
|
|
12
15
|
const result = buildCheckboxFilters(checkboxFilters);
|
|
13
16
|
expect(result).toEqual([{ match: { filterName: false } }, { match: { secondFilter: true } }]);
|
|
14
17
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@testing-library/jest-dom/extend-expect';
|
|
2
|
-
import getDictionaryMatch from '
|
|
2
|
+
import getDictionaryMatch from '../../../../src/helpers/get-dictionary-match';
|
|
3
3
|
|
|
4
4
|
describe('get dictionary match', () => {
|
|
5
5
|
const gridStringMock = getDictionaryMatch(3);
|
|
@@ -14,7 +14,9 @@ describe('Parse textBlock', () => {
|
|
|
14
14
|
|
|
15
15
|
beforeAll(() => {
|
|
16
16
|
const parsedTextBlock = parseTextBlock({ html, LinkWrapper: BlazeLink });
|
|
17
|
-
expectedMarkup = () =>
|
|
17
|
+
expectedMarkup = () => {
|
|
18
|
+
parsedTextBlock;
|
|
19
|
+
};
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
test('it should match snapshot', () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
|
-
import { renderHook } from '@testing-library/react
|
|
4
|
+
import { renderHook } from '@testing-library/react';
|
|
5
5
|
import { useCheckMobileScreen } from '../../../../src/hooks';
|
|
6
|
-
|
|
6
|
+
// TODO fix breaking test
|
|
7
7
|
describe('Check Mobile Screen hook', () => {
|
|
8
8
|
it('should server render will always be mobile', () => {
|
|
9
9
|
global.innerWidth = undefined;
|
|
@@ -29,6 +29,7 @@ describe('Check Mobile Screen hook', () => {
|
|
|
29
29
|
resizeCheck(screenSize, isMobile);
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
+
|
|
32
33
|
function resizeCheck(screenSize, isMobile) {
|
|
33
34
|
const { result, rerender } = renderHook(() => useCheckMobileScreen());
|
|
34
35
|
rerender();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { renderHook } from '@testing-library/react
|
|
5
|
+
import { renderHook } from '@testing-library/react';
|
|
6
6
|
import { MockedProvider } from '@apollo/client/testing';
|
|
7
7
|
|
|
8
8
|
import useGetImageIdFromRelation from '../../../../src/hooks/use-get-image-id-from-relation';
|
|
@@ -76,7 +76,7 @@ describe('useGetImageIdFromRelation', () => {
|
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
function renderCustomHook() {
|
|
79
|
-
const { result
|
|
79
|
+
const { result } = renderHook(
|
|
80
80
|
() =>
|
|
81
81
|
useGetImageIdFromRelation(
|
|
82
82
|
mockProps.id,
|
|
@@ -88,5 +88,5 @@ function renderCustomHook() {
|
|
|
88
88
|
{ wrapper }
|
|
89
89
|
);
|
|
90
90
|
|
|
91
|
-
return { result
|
|
91
|
+
return { result };
|
|
92
92
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import '@testing-library/jest-dom/extend-expect';
|
|
6
6
|
import { MockedProvider } from '@apollo/client/testing';
|
|
7
|
-
import { renderHook,
|
|
7
|
+
import { renderHook, waitFor } from '@testing-library/react';
|
|
8
8
|
import { useGetImages } from '../../../../src/hooks';
|
|
9
9
|
import { getFiles, getFileById } from '../../../../src/application/query';
|
|
10
10
|
|
|
@@ -69,25 +69,23 @@ describe('UseGetImages hook', () => {
|
|
|
69
69
|
<MockedProvider mocks={ARRAY_MOCK}>{children}</MockedProvider>
|
|
70
70
|
);
|
|
71
71
|
|
|
72
|
-
it('should be a function', () => {
|
|
73
|
-
expect(typeof useGetImages).toEqual('function');
|
|
74
|
-
});
|
|
75
|
-
|
|
76
72
|
it('should return expected value (id is an array)', async () => {
|
|
77
73
|
const wrapper = ({ children }) => (
|
|
78
74
|
<MockedProvider mocks={ARRAY_MOCK}>{children}</MockedProvider>
|
|
79
75
|
);
|
|
80
76
|
const ids = [id1, id2];
|
|
81
77
|
const hasMultipleIds = true;
|
|
82
|
-
const { result
|
|
78
|
+
const { result } = renderHook(() => useGetImages(ids, hasMultipleIds), {
|
|
83
79
|
wrapper
|
|
84
80
|
});
|
|
85
81
|
|
|
86
82
|
expect(result.current.loading).toEqual(true);
|
|
87
83
|
|
|
88
|
-
await
|
|
84
|
+
await waitFor(() => {
|
|
85
|
+
const { loading } = result.current;
|
|
86
|
+
expect(loading).toBe(false);
|
|
87
|
+
});
|
|
89
88
|
|
|
90
|
-
expect(result.current.loading).toEqual(false);
|
|
91
89
|
expect(result.current).toEqual({
|
|
92
90
|
data: {
|
|
93
91
|
getFiles: resultData
|
|
@@ -98,15 +96,17 @@ describe('UseGetImages hook', () => {
|
|
|
98
96
|
});
|
|
99
97
|
|
|
100
98
|
it('should return expected value (id is an array) when id is string', async () => {
|
|
101
|
-
const { result
|
|
99
|
+
const { result } = renderHook(() => useGetImages(id1, true), {
|
|
102
100
|
wrapper: arrayWrapper
|
|
103
101
|
});
|
|
104
102
|
|
|
105
103
|
expect(result.current.loading).toEqual(true);
|
|
106
104
|
|
|
107
|
-
await
|
|
105
|
+
await waitFor(() => {
|
|
106
|
+
const { loading } = result.current;
|
|
107
|
+
expect(loading).toBe(false);
|
|
108
|
+
});
|
|
108
109
|
|
|
109
|
-
expect(result.current.loading).toEqual(false);
|
|
110
110
|
expect(result.current).toEqual({
|
|
111
111
|
data: {
|
|
112
112
|
getFiles: [resultData[0]]
|
|
@@ -145,15 +145,17 @@ describe('UseGetImages hook', () => {
|
|
|
145
145
|
<MockedProvider mocks={STRING_MOCK}>{children}</MockedProvider>
|
|
146
146
|
);
|
|
147
147
|
|
|
148
|
-
const { result
|
|
148
|
+
const { result } = renderHook(() => useGetImages(id1), {
|
|
149
149
|
wrapper
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
expect(result.current.loading).toEqual(true);
|
|
153
153
|
|
|
154
|
-
await
|
|
154
|
+
await waitFor(() => {
|
|
155
|
+
const { loading } = result.current;
|
|
156
|
+
expect(loading).toBe(false);
|
|
157
|
+
});
|
|
155
158
|
|
|
156
|
-
expect(result.current.loading).toEqual(false);
|
|
157
159
|
expect(result.current).toEqual({
|
|
158
160
|
data: {
|
|
159
161
|
getFile: resultData[0]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { renderHook,
|
|
5
|
+
import { renderHook, waitFor } from '@testing-library/react';
|
|
6
6
|
import { MockedProvider } from '@apollo/client/testing';
|
|
7
7
|
import { useGetSingleEntitySchema } from '../../../../src/hooks';
|
|
8
8
|
import { getSingleEntitySchema } from '../../../../src/application/query';
|
|
@@ -47,13 +47,15 @@ const wrapper = ({ children }) => (
|
|
|
47
47
|
|
|
48
48
|
describe('useGetSingleEntitySchema hook', () => {
|
|
49
49
|
it('should return a single schema object', async () => {
|
|
50
|
-
const { result
|
|
50
|
+
const { result } = renderHook(() => useGetSingleEntitySchema('page'), {
|
|
51
51
|
wrapper
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
await
|
|
54
|
+
await waitFor(() => {
|
|
55
|
+
const { loading } = result.current;
|
|
56
|
+
expect(loading).toBe(false);
|
|
57
|
+
});
|
|
55
58
|
|
|
56
|
-
expect(result.current.loading).toEqual(false);
|
|
57
59
|
expect(result.current).toEqual({
|
|
58
60
|
data: {
|
|
59
61
|
getEntitySchema: mockQueryResults
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import { shallow } from 'enzyme';
|
|
8
|
-
import { usePageBuilder } from '../../../../src/hooks';
|
|
9
|
-
import { PAGE_BUILDER_MOCK } from '../../../helpers/mocks';
|
|
10
|
-
|
|
11
|
-
const Mock = ({ data = null }) => {
|
|
12
|
-
const child = usePageBuilder(data);
|
|
13
|
-
|
|
14
|
-
return <div>{child}</div>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
Mock.propTypes = {
|
|
18
|
-
data: PropTypes.array
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
Mock.defaultProps = {
|
|
22
|
-
data: null
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
describe('Build Page hook', () => {
|
|
26
|
-
const defaultPage = shallow(<Mock data={PAGE_BUILDER_MOCK} />);
|
|
27
|
-
|
|
28
|
-
it('should be defined', () => {
|
|
29
|
-
expect(usePageBuilder).toBeDefined();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('should always return an Array', () => {
|
|
33
|
-
const isArray = data => Array.isArray(data);
|
|
34
|
-
|
|
35
|
-
it('should return an Array with data', () => {
|
|
36
|
-
const hasChild = defaultPage.props().children;
|
|
37
|
-
|
|
38
|
-
expect(isArray(hasChild)).toBeTruthy();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should return Array with empty data', () => {
|
|
42
|
-
const pageWithoutData = shallow(<Mock />);
|
|
43
|
-
const hasNoChild = pageWithoutData.props().children;
|
|
44
|
-
|
|
45
|
-
expect(isArray(hasNoChild)).toBeTruthy();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|