@blaze-cms/react-page-builder 0.141.0-core-variants.0 → 0.141.0-core-styles.10
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 +66 -9
- package/lib/components/ContentGroup/ContentGroupTabs.js +8 -10
- package/lib/components/ContentGroup/ContentGroupTabs.js.map +1 -1
- package/lib/components/Menu/Menu.js +2 -4
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.js +2 -1
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/hooks/helpers/getVariant.js.map +1 -1
- package/lib/variants/index.js +1 -13
- package/lib/variants/index.js.map +1 -1
- package/lib-es/components/ContentGroup/ContentGroupTabs.js +8 -10
- package/lib-es/components/ContentGroup/ContentGroupTabs.js.map +1 -1
- package/lib-es/components/Menu/Menu.js +2 -4
- package/lib-es/components/Menu/Menu.js.map +1 -1
- package/lib-es/components/MenuItem/MenuItem.js +2 -1
- package/lib-es/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-es/hooks/helpers/getVariant.js.map +1 -1
- package/lib-es/variants/index.js +1 -12
- package/lib-es/variants/index.js.map +1 -1
- package/package.json +10 -10
- package/src/components/ContentGroup/ContentGroupTabs.js +8 -11
- package/src/components/Menu/Menu.js +2 -4
- package/src/components/MenuItem/MenuItem.js +5 -2
- package/src/hooks/helpers/getVariant.js +0 -1
- package/src/variants/index.js +1 -13
- package/tests/unit/src/components/ContentGroup/__snapshots__/ContentGroupTabs.test.js.snap +0 -2
- package/tests/unit/src/components/MenuItem/__snapshots__/MenuItem.test.js.snap +2 -0
- package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +2 -0
- package/lib/variants/HeroImage/index.js +0 -29
- package/lib/variants/HeroImage/index.js.map +0 -1
- package/lib/variants/Infographic/Infographic.js +0 -27
- package/lib/variants/Infographic/Infographic.js.map +0 -1
- package/lib/variants/Infographic/index.js +0 -29
- package/lib/variants/Infographic/index.js.map +0 -1
- package/lib/variants/Infographic/useInfographic.js +0 -43
- package/lib/variants/Infographic/useInfographic.js.map +0 -1
- package/lib/variants/LongformGallery/LongformGallery.js +0 -51
- package/lib/variants/LongformGallery/LongformGallery.js.map +0 -1
- package/lib/variants/LongformGallery/LongformGalleryImage.js +0 -68
- package/lib/variants/LongformGallery/LongformGalleryImage.js.map +0 -1
- package/lib/variants/LongformGallery/constants.js +0 -19
- package/lib/variants/LongformGallery/constants.js.map +0 -1
- package/lib/variants/LongformGallery/helpers/index.js +0 -29
- package/lib/variants/LongformGallery/helpers/index.js.map +0 -1
- package/lib/variants/LongformGallery/helpers/parseImageData.js +0 -42
- package/lib/variants/LongformGallery/helpers/parseImageData.js.map +0 -1
- package/lib/variants/LongformGallery/helpers/separateImages.js +0 -27
- package/lib/variants/LongformGallery/helpers/separateImages.js.map +0 -1
- package/lib/variants/LongformGallery/helpers/shouldSkip.js +0 -13
- package/lib/variants/LongformGallery/helpers/shouldSkip.js.map +0 -1
- package/lib/variants/LongformGallery/index.js +0 -31
- package/lib/variants/LongformGallery/index.js.map +0 -1
- package/lib/variants/LongformGallery/useLongformGallery.js +0 -63
- package/lib/variants/LongformGallery/useLongformGallery.js.map +0 -1
- package/lib/variants/LongformRow/index.js +0 -29
- package/lib/variants/LongformRow/index.js.map +0 -1
- package/lib/variants/ParallaxImageTextRight/index.js +0 -30
- package/lib/variants/ParallaxImageTextRight/index.js.map +0 -1
- package/lib-es/variants/HeroImage/index.js +0 -10
- package/lib-es/variants/HeroImage/index.js.map +0 -1
- package/lib-es/variants/Infographic/Infographic.js +0 -20
- package/lib-es/variants/Infographic/Infographic.js.map +0 -1
- package/lib-es/variants/Infographic/index.js +0 -10
- package/lib-es/variants/Infographic/index.js.map +0 -1
- package/lib-es/variants/Infographic/useInfographic.js +0 -23
- package/lib-es/variants/Infographic/useInfographic.js.map +0 -1
- package/lib-es/variants/LongformGallery/LongformGallery.js +0 -37
- package/lib-es/variants/LongformGallery/LongformGallery.js.map +0 -1
- package/lib-es/variants/LongformGallery/LongformGalleryImage.js +0 -56
- package/lib-es/variants/LongformGallery/LongformGalleryImage.js.map +0 -1
- package/lib-es/variants/LongformGallery/constants.js +0 -18
- package/lib-es/variants/LongformGallery/constants.js.map +0 -1
- package/lib-es/variants/LongformGallery/helpers/index.js +0 -5
- package/lib-es/variants/LongformGallery/helpers/index.js.map +0 -1
- package/lib-es/variants/LongformGallery/helpers/parseImageData.js +0 -26
- package/lib-es/variants/LongformGallery/helpers/parseImageData.js.map +0 -1
- package/lib-es/variants/LongformGallery/helpers/separateImages.js +0 -13
- package/lib-es/variants/LongformGallery/helpers/separateImages.js.map +0 -1
- package/lib-es/variants/LongformGallery/helpers/shouldSkip.js +0 -3
- package/lib-es/variants/LongformGallery/helpers/shouldSkip.js.map +0 -1
- package/lib-es/variants/LongformGallery/index.js +0 -12
- package/lib-es/variants/LongformGallery/index.js.map +0 -1
- package/lib-es/variants/LongformGallery/useLongformGallery.js +0 -48
- package/lib-es/variants/LongformGallery/useLongformGallery.js.map +0 -1
- package/lib-es/variants/LongformRow/index.js +0 -10
- package/lib-es/variants/LongformRow/index.js.map +0 -1
- package/lib-es/variants/ParallaxImageTextRight/index.js +0 -11
- package/lib-es/variants/ParallaxImageTextRight/index.js.map +0 -1
- package/src/variants/HeroImage/index.js +0 -8
- package/src/variants/Infographic/Infographic.js +0 -14
- package/src/variants/Infographic/index.js +0 -10
- package/src/variants/Infographic/useInfographic.js +0 -18
- package/src/variants/LongformGallery/LongformGallery.js +0 -48
- package/src/variants/LongformGallery/LongformGalleryImage.js +0 -62
- package/src/variants/LongformGallery/constants.js +0 -21
- package/src/variants/LongformGallery/helpers/index.js +0 -5
- package/src/variants/LongformGallery/helpers/parseImageData.js +0 -25
- package/src/variants/LongformGallery/helpers/separateImages.js +0 -22
- package/src/variants/LongformGallery/helpers/shouldSkip.js +0 -3
- package/src/variants/LongformGallery/index.js +0 -11
- package/src/variants/LongformGallery/useLongformGallery.js +0 -50
- package/src/variants/LongformRow/index.js +0 -8
- package/src/variants/ParallaxImageTextRight/index.js +0 -9
- package/tests/unit/src/variants/LongFormGallery/LongformGallery.test.js +0 -41
- package/tests/unit/src/variants/LongFormGallery/LongformGalleryImage.test.js +0 -44
- package/tests/unit/src/variants/LongFormGallery/__snapshots__/LongformGallery.test.js.snap +0 -102
- package/tests/unit/src/variants/LongFormGallery/__snapshots__/LongformGalleryImage.test.js.snap +0 -51
- package/tests/unit/src/variants/LongFormGallery/constants.js +0 -37
- package/tests/unit/src/variants/LongFormGallery/helpers/parseImageData.test.js +0 -53
- package/tests/unit/src/variants/LongFormGallery/helpers/separateImages.test.js +0 -54
- package/tests/unit/src/variants/LongFormGallery/helpers/shouldSkip.test.js +0 -23
- package/tests/unit/src/variants/LongFormGallery/useLongformGallery.test.js +0 -39
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`LongformGallery renders LongformGallery with two-group modifier if images length is 4 1`] = `
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<div
|
|
6
|
-
class="longform-gallery"
|
|
7
|
-
data-testid="longform-gallery"
|
|
8
|
-
>
|
|
9
|
-
<div
|
|
10
|
-
class="longform-gallery__images main-images"
|
|
11
|
-
>
|
|
12
|
-
<div
|
|
13
|
-
class="longform-gallery__images__image main-image"
|
|
14
|
-
>
|
|
15
|
-
<div
|
|
16
|
-
class="longform-gallery__images__image__container"
|
|
17
|
-
data-testid="longform-gallery__images__image__container"
|
|
18
|
-
role="button"
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
21
|
-
<div
|
|
22
|
-
class="longform-gallery__images__image main-image"
|
|
23
|
-
>
|
|
24
|
-
<div
|
|
25
|
-
class="longform-gallery__images__image__container"
|
|
26
|
-
data-testid="longform-gallery__images__image__container"
|
|
27
|
-
role="button"
|
|
28
|
-
/>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
<div
|
|
32
|
-
class="longform-gallery__images secondary-images"
|
|
33
|
-
data-testid="secondary-images"
|
|
34
|
-
>
|
|
35
|
-
<div
|
|
36
|
-
class="longform-gallery__images__image secondary-image two-group"
|
|
37
|
-
>
|
|
38
|
-
<div
|
|
39
|
-
class="longform-gallery__images__image__container"
|
|
40
|
-
data-testid="longform-gallery__images__image__container"
|
|
41
|
-
role="button"
|
|
42
|
-
/>
|
|
43
|
-
</div>
|
|
44
|
-
<div
|
|
45
|
-
class="longform-gallery__images__image secondary-image two-group"
|
|
46
|
-
>
|
|
47
|
-
<div
|
|
48
|
-
class="longform-gallery__images__image__container"
|
|
49
|
-
data-testid="longform-gallery__images__image__container"
|
|
50
|
-
role="button"
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
</DocumentFragment>
|
|
56
|
-
`;
|
|
57
|
-
|
|
58
|
-
exports[`LongformGallery renders LongformGallery without error 1`] = `
|
|
59
|
-
<DocumentFragment>
|
|
60
|
-
<div
|
|
61
|
-
class="longform-gallery"
|
|
62
|
-
data-testid="longform-gallery"
|
|
63
|
-
>
|
|
64
|
-
<div
|
|
65
|
-
class="longform-gallery__images main-images"
|
|
66
|
-
>
|
|
67
|
-
<div
|
|
68
|
-
class="longform-gallery__images__image main-image"
|
|
69
|
-
>
|
|
70
|
-
<div
|
|
71
|
-
class="longform-gallery__images__image__container"
|
|
72
|
-
data-testid="longform-gallery__images__image__container"
|
|
73
|
-
role="button"
|
|
74
|
-
/>
|
|
75
|
-
</div>
|
|
76
|
-
<div
|
|
77
|
-
class="longform-gallery__images__image main-image"
|
|
78
|
-
>
|
|
79
|
-
<div
|
|
80
|
-
class="longform-gallery__images__image__container"
|
|
81
|
-
data-testid="longform-gallery__images__image__container"
|
|
82
|
-
role="button"
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
<div
|
|
87
|
-
class="longform-gallery__images secondary-images"
|
|
88
|
-
data-testid="secondary-images"
|
|
89
|
-
>
|
|
90
|
-
<div
|
|
91
|
-
class="longform-gallery__images__image secondary-image"
|
|
92
|
-
>
|
|
93
|
-
<div
|
|
94
|
-
class="longform-gallery__images__image__container"
|
|
95
|
-
data-testid="longform-gallery__images__image__container"
|
|
96
|
-
role="button"
|
|
97
|
-
/>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
</DocumentFragment>
|
|
102
|
-
`;
|
package/tests/unit/src/variants/LongFormGallery/__snapshots__/LongformGalleryImage.test.js.snap
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`LongformGalleryImage component renders LongformGalleryImage component 1`] = `
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<div
|
|
6
|
-
class="longform-gallery__images__image main-image"
|
|
7
|
-
>
|
|
8
|
-
<div
|
|
9
|
-
class="longform-gallery__images__image__container"
|
|
10
|
-
data-testid="longform-gallery__images__image__container"
|
|
11
|
-
role="button"
|
|
12
|
-
>
|
|
13
|
-
<img
|
|
14
|
-
alt=""
|
|
15
|
-
role="button"
|
|
16
|
-
src="https://mock-url/image-id-1.jpg"
|
|
17
|
-
/>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</DocumentFragment>
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
exports[`LongformGalleryImage component renders LongformGalleryImage component 2`] = `
|
|
24
|
-
<DocumentFragment>
|
|
25
|
-
<div
|
|
26
|
-
class="longform-gallery__images__image main-image"
|
|
27
|
-
>
|
|
28
|
-
<div
|
|
29
|
-
class="longform-gallery__images__image__container"
|
|
30
|
-
data-testid="longform-gallery__images__image__container"
|
|
31
|
-
role="button"
|
|
32
|
-
>
|
|
33
|
-
<img
|
|
34
|
-
alt=""
|
|
35
|
-
role="button"
|
|
36
|
-
src="https://mock-url/image-id-1.jpg"
|
|
37
|
-
/>
|
|
38
|
-
</div>
|
|
39
|
-
<div
|
|
40
|
-
class="longform-gallery__images__image__details"
|
|
41
|
-
data-testid="longform-gallery__images__image__details"
|
|
42
|
-
>
|
|
43
|
-
<div
|
|
44
|
-
class="longform-gallery__images__image__details__caption"
|
|
45
|
-
>
|
|
46
|
-
some image caption
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</DocumentFragment>
|
|
51
|
-
`;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { GET_IMAGES_QUERY } from '../../../../../src/variants/LongformGallery/constants';
|
|
2
|
-
|
|
3
|
-
const IMAGE_MOCKS = [
|
|
4
|
-
{
|
|
5
|
-
request: {
|
|
6
|
-
query: GET_IMAGES_QUERY,
|
|
7
|
-
variables: { where: { id: { _in: ['1', '2', '3'] } } }
|
|
8
|
-
},
|
|
9
|
-
result: {
|
|
10
|
-
data: {
|
|
11
|
-
getImages: [
|
|
12
|
-
{ id: '1', url: 'image1.jpg', caption: 'Caption 1', data: {} },
|
|
13
|
-
{ id: '2', url: 'image2.jpg', caption: 'Caption 2', data: {} },
|
|
14
|
-
{ id: '3', url: 'image3.jpg', caption: 'Caption 3', data: {} }
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
request: {
|
|
21
|
-
query: GET_IMAGES_QUERY,
|
|
22
|
-
variables: { where: { id: { _in: ['1', '2', '3', '4'] } } }
|
|
23
|
-
},
|
|
24
|
-
result: {
|
|
25
|
-
data: {
|
|
26
|
-
getImages: [
|
|
27
|
-
{ id: '1', url: 'image1.jpg', caption: 'Caption 1', data: {} },
|
|
28
|
-
{ id: '2', url: 'image2.jpg', caption: 'Caption 2', data: {} },
|
|
29
|
-
{ id: '3', url: 'image3.jpg', caption: 'Caption 3', data: {} },
|
|
30
|
-
{ id: '4', url: 'image4.jpg', caption: 'Caption 4', data: {} }
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
export { IMAGE_MOCKS };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { parseImageData } from '../../../../../../src/variants/LongformGallery/helpers';
|
|
2
|
-
|
|
3
|
-
describe('parseImageData', () => {
|
|
4
|
-
const mockImage = {
|
|
5
|
-
id: '1',
|
|
6
|
-
url: 'image.jpg',
|
|
7
|
-
data: {
|
|
8
|
-
caption: 'Image Caption'
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
it('parses image data with caption when shouldDisplayCaption is true', () => {
|
|
13
|
-
const parsedData = parseImageData(mockImage, 0, 2, true);
|
|
14
|
-
|
|
15
|
-
expect(parsedData).toEqual({
|
|
16
|
-
id: '1',
|
|
17
|
-
url: 'image.jpg',
|
|
18
|
-
caption: 'Image Caption',
|
|
19
|
-
priority: true,
|
|
20
|
-
altText: '',
|
|
21
|
-
credits: '',
|
|
22
|
-
hrefUrl: ''
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('parses image data without caption when shouldDisplayCaption is false', () => {
|
|
27
|
-
const parsedData = parseImageData(mockImage, 0, 2, false);
|
|
28
|
-
|
|
29
|
-
expect(parsedData).toEqual({
|
|
30
|
-
id: '1',
|
|
31
|
-
url: 'image.jpg',
|
|
32
|
-
caption: '',
|
|
33
|
-
priority: true,
|
|
34
|
-
altText: '',
|
|
35
|
-
credits: '',
|
|
36
|
-
hrefUrl: ''
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('parses image data with default values when data is undefined', () => {
|
|
41
|
-
const parsedData = parseImageData({ id: '1', url: 'image.jpg' }, 0, 2, true);
|
|
42
|
-
|
|
43
|
-
expect(parsedData).toEqual({
|
|
44
|
-
id: '1',
|
|
45
|
-
url: 'image.jpg',
|
|
46
|
-
caption: '',
|
|
47
|
-
priority: true,
|
|
48
|
-
altText: '',
|
|
49
|
-
credits: '',
|
|
50
|
-
hrefUrl: ''
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { separateImages } from '../../../../../../src/variants/LongformGallery/helpers';
|
|
2
|
-
|
|
3
|
-
describe('separateImages', () => {
|
|
4
|
-
const mockImages = [
|
|
5
|
-
{ id: '1', url: 'image1.jpg', data: { caption: 'Caption 1' } },
|
|
6
|
-
{ id: '2', url: 'image2.jpg', data: { caption: 'Caption 2' } },
|
|
7
|
-
{ id: '3', url: 'image3.jpg', data: { caption: 'Caption 3' } }
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
it('returns empty arrays for undefined or empty images', () => {
|
|
11
|
-
const result = separateImages(undefined, 2, true);
|
|
12
|
-
expect(result).toEqual([[], []]);
|
|
13
|
-
|
|
14
|
-
const resultEmptyArray = separateImages([], 2, true);
|
|
15
|
-
expect(resultEmptyArray).toEqual([[], []]);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('returns mainImages and secondaryImages arrays', () => {
|
|
19
|
-
const [mainImages, secondaryImages] = separateImages(mockImages, 2, true);
|
|
20
|
-
|
|
21
|
-
expect(mainImages).toHaveLength(2);
|
|
22
|
-
expect(mainImages[0]).toEqual({
|
|
23
|
-
id: '1',
|
|
24
|
-
url: 'image1.jpg',
|
|
25
|
-
caption: 'Caption 1',
|
|
26
|
-
priority: true,
|
|
27
|
-
altText: '',
|
|
28
|
-
credits: '',
|
|
29
|
-
hrefUrl: ''
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
expect(mainImages[1]).toEqual({
|
|
33
|
-
id: '2',
|
|
34
|
-
url: 'image2.jpg',
|
|
35
|
-
caption: 'Caption 2',
|
|
36
|
-
priority: true,
|
|
37
|
-
altText: '',
|
|
38
|
-
credits: '',
|
|
39
|
-
hrefUrl: ''
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
expect(secondaryImages).toHaveLength(1);
|
|
43
|
-
expect(secondaryImages[0]).toHaveLength(1);
|
|
44
|
-
expect(secondaryImages[0][0]).toEqual({
|
|
45
|
-
id: '3',
|
|
46
|
-
url: 'image3.jpg',
|
|
47
|
-
caption: 'Caption 3',
|
|
48
|
-
priority: true,
|
|
49
|
-
altText: '',
|
|
50
|
-
credits: '',
|
|
51
|
-
hrefUrl: ''
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { shouldSkip } from '../../../../../../src/variants/LongformGallery/helpers';
|
|
2
|
-
|
|
3
|
-
describe('shouldSkip', () => {
|
|
4
|
-
it('returns true when ids is undefined', () => {
|
|
5
|
-
const result = shouldSkip(undefined);
|
|
6
|
-
expect(result).toBe(true);
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it('returns true when ids is an empty array', () => {
|
|
10
|
-
const result = shouldSkip([]);
|
|
11
|
-
expect(result).toBe(true);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('returns false when ids is a non-empty array', () => {
|
|
15
|
-
const result = shouldSkip(['1', '2', '3']);
|
|
16
|
-
expect(result).toBe(false);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('returns false when ids is a non-array value', () => {
|
|
20
|
-
const result = shouldSkip('not an array');
|
|
21
|
-
expect(result).toBe(false);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { renderHook } from '@testing-library/react-hooks';
|
|
6
|
-
import { MockedProvider } from '@apollo/client/testing';
|
|
7
|
-
import useLongformGallery from '../../../../../src/variants/LongformGallery/useLongformGallery';
|
|
8
|
-
import { IMAGE_MOCKS } from './constants';
|
|
9
|
-
|
|
10
|
-
describe('useLongformGallery', () => {
|
|
11
|
-
it('returns data, loading, error, mainImages, secondaryImages, and handleImageOnClick', async () => {
|
|
12
|
-
const { result, waitForNextUpdate } = renderHook(
|
|
13
|
-
() =>
|
|
14
|
-
useLongformGallery({
|
|
15
|
-
imageIds: ['1', '2', '3'],
|
|
16
|
-
enableLightbox: true,
|
|
17
|
-
toggleModal: jest.fn(),
|
|
18
|
-
handleSelectedImage: jest.fn()
|
|
19
|
-
}),
|
|
20
|
-
{
|
|
21
|
-
wrapper: ({ children }) => <MockedProvider mocks={IMAGE_MOCKS}>{children}</MockedProvider>
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
expect(result.current.data).toBeUndefined();
|
|
26
|
-
expect(result.current.loading).toBe(true);
|
|
27
|
-
expect(result.current.error).toBeUndefined();
|
|
28
|
-
expect(result.current.mainImages).toEqual([]);
|
|
29
|
-
expect(result.current.secondaryImages).toEqual([]);
|
|
30
|
-
|
|
31
|
-
await waitForNextUpdate();
|
|
32
|
-
|
|
33
|
-
expect(result.current.data).toBeDefined();
|
|
34
|
-
expect(result.current.loading).toBe(false);
|
|
35
|
-
expect(result.current.error).toBeUndefined();
|
|
36
|
-
expect(result.current.mainImages).toHaveLength(2);
|
|
37
|
-
expect(result.current.secondaryImages).toHaveLength(1);
|
|
38
|
-
});
|
|
39
|
-
});
|