@blaze-cms/react-page-builder 0.118.0-alpha.2 → 0.119.0-alpha.2
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 +41 -0
- package/README.md +22 -0
- package/lib/application/query/index.js +12 -12
- package/lib/application/query/index.js.map +1 -1
- package/lib/components/Banner/AdSlotRender.js +104 -0
- package/lib/components/Banner/AdSlotRender.js.map +1 -0
- package/lib/components/Banner/Banner.js +2 -2
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/BannerRender.js +23 -33
- package/lib/components/Banner/BannerRender.js.map +1 -1
- package/lib/components/Button.js +2 -2
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/CardContainer.js +6 -2
- package/lib/components/Card/CardContainer.js.map +1 -1
- package/lib/components/Card/CardFactory.js +2 -2
- package/lib/components/Card/CardFactory.js.map +1 -1
- package/lib/components/Card/CardRender.js +3 -3
- package/lib/components/Card/CardRender.js.map +1 -1
- package/lib/components/Card/helpers/filter-query-setup.js +7 -7
- package/lib/components/Card/helpers/filter-query-setup.js.map +1 -1
- package/lib/components/CarouselWrapper.js +54 -14
- package/lib/components/CarouselWrapper.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryFactory.js +2 -2
- package/lib/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryRender.js +2 -2
- package/lib/components/DataSummary/DataSummaryRender.js.map +1 -1
- package/lib/components/EmailConfirm/EmailConfirm.js +2 -2
- package/lib/components/EmailConfirm/EmailConfirm.js.map +1 -1
- package/lib/components/EmailConfirm/mutation.js +2 -2
- package/lib/components/EmailConfirm/mutation.js.map +1 -1
- package/lib/components/Image/ImageFactory.js +9 -5
- package/lib/components/Image/ImageFactory.js.map +1 -1
- package/lib/components/List/ListBuilder.js +21 -21
- package/lib/components/List/ListBuilder.js.map +1 -1
- package/lib/components/List/ListFactory.js +3 -3
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/ListRender.js +2 -2
- package/lib/components/List/ListRender.js.map +1 -1
- package/lib/components/Login/LoggedInMessage.js +1 -1
- package/lib/components/Login/LoggedInMessage.js.map +1 -1
- package/lib/components/Login/Login.js +2 -2
- package/lib/components/Login/Login.js.map +1 -1
- package/lib/components/Menu/Menu.js +39 -6
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/PasswordReset/PasswordReset.js +2 -2
- package/lib/components/PasswordReset/PasswordReset.js.map +1 -1
- package/lib/components/PasswordResetRequest/PasswordResetRequest.js +2 -2
- package/lib/components/PasswordResetRequest/PasswordResetRequest.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +2 -2
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/constants/index.js +8 -2
- package/lib/constants/index.js.map +1 -1
- package/lib/helpers/build-props-query.js +2 -2
- package/lib/helpers/build-props-query.js.map +1 -1
- package/lib/hooks/use-get-entity-schema.js +3 -3
- package/lib/hooks/use-get-entity-schema.js.map +1 -1
- package/lib/hooks/use-get-entity-schemas-as-obj.js +2 -2
- package/lib/hooks/use-get-entity-schemas-as-obj.js.map +1 -1
- package/lib/hooks/use-get-image-id-from-relation.js +2 -2
- package/lib/hooks/use-get-image-id-from-relation.js.map +1 -1
- package/lib/hooks/use-get-images.js +2 -2
- package/lib/hooks/use-get-images.js.map +1 -1
- package/lib/hooks/use-get-single-entity-schema.js +2 -2
- package/lib/hooks/use-get-single-entity-schema.js.map +1 -1
- package/lib-es/application/query/index.js +1 -5
- package/lib-es/application/query/index.js.map +1 -1
- package/lib-es/components/Banner/AdSlotRender.js +54 -0
- package/lib-es/components/Banner/AdSlotRender.js.map +1 -0
- package/lib-es/components/Banner/Banner.js +1 -1
- package/lib-es/components/Banner/Banner.js.map +1 -1
- package/lib-es/components/Banner/BannerRender.js +21 -29
- package/lib-es/components/Banner/BannerRender.js.map +1 -1
- package/lib-es/components/Button.js +1 -1
- package/lib-es/components/Button.js.map +1 -1
- package/lib-es/components/Card/CardContainer.js +7 -3
- package/lib-es/components/Card/CardContainer.js.map +1 -1
- package/lib-es/components/Card/CardFactory.js +1 -1
- package/lib-es/components/Card/CardFactory.js.map +1 -1
- package/lib-es/components/Card/CardRender.js +1 -1
- package/lib-es/components/Card/CardRender.js.map +1 -1
- package/lib-es/components/Card/helpers/filter-query-setup.js +1 -1
- package/lib-es/components/Card/helpers/filter-query-setup.js.map +1 -1
- package/lib-es/components/CarouselWrapper.js +50 -14
- package/lib-es/components/CarouselWrapper.js.map +1 -1
- package/lib-es/components/DataSummary/DataSummaryFactory.js +1 -1
- package/lib-es/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib-es/components/DataSummary/DataSummaryRender.js +1 -1
- package/lib-es/components/DataSummary/DataSummaryRender.js.map +1 -1
- package/lib-es/components/EmailConfirm/EmailConfirm.js +1 -1
- package/lib-es/components/EmailConfirm/EmailConfirm.js.map +1 -1
- package/lib-es/components/EmailConfirm/mutation.js +1 -1
- package/lib-es/components/EmailConfirm/mutation.js.map +1 -1
- package/lib-es/components/Image/ImageFactory.js +8 -4
- package/lib-es/components/Image/ImageFactory.js.map +1 -1
- package/lib-es/components/List/ListBuilder.js +2 -2
- package/lib-es/components/List/ListBuilder.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +1 -1
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/ListRender.js +1 -1
- package/lib-es/components/List/ListRender.js.map +1 -1
- package/lib-es/components/Login/LoggedInMessage.js +1 -1
- package/lib-es/components/Login/LoggedInMessage.js.map +1 -1
- package/lib-es/components/Login/Login.js +1 -1
- package/lib-es/components/Login/Login.js.map +1 -1
- package/lib-es/components/Menu/Menu.js +44 -11
- package/lib-es/components/Menu/Menu.js.map +1 -1
- package/lib-es/components/PasswordReset/PasswordReset.js +1 -1
- package/lib-es/components/PasswordReset/PasswordReset.js.map +1 -1
- package/lib-es/components/PasswordResetRequest/PasswordResetRequest.js +1 -1
- package/lib-es/components/PasswordResetRequest/PasswordResetRequest.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/constants/index.js +4 -1
- package/lib-es/constants/index.js.map +1 -1
- package/lib-es/helpers/build-props-query.js +2 -2
- package/lib-es/helpers/build-props-query.js.map +1 -1
- package/lib-es/hooks/use-get-entity-schema.js +1 -1
- package/lib-es/hooks/use-get-entity-schema.js.map +1 -1
- package/lib-es/hooks/use-get-entity-schemas-as-obj.js +1 -1
- package/lib-es/hooks/use-get-entity-schemas-as-obj.js.map +1 -1
- package/lib-es/hooks/use-get-image-id-from-relation.js +1 -1
- package/lib-es/hooks/use-get-image-id-from-relation.js.map +1 -1
- package/lib-es/hooks/use-get-images.js +1 -1
- package/lib-es/hooks/use-get-images.js.map +1 -1
- package/lib-es/hooks/use-get-single-entity-schema.js +1 -1
- package/lib-es/hooks/use-get-single-entity-schema.js.map +1 -1
- package/package.json +9 -13
- package/src/application/query/index.js +1 -5
- package/src/components/Banner/AdSlotRender.js +62 -0
- package/src/components/Banner/Banner.js +1 -1
- package/src/components/Banner/BannerRender.js +22 -27
- package/src/components/Button.js +1 -1
- package/src/components/Card/CardContainer.js +5 -1
- package/src/components/Card/CardFactory.js +1 -1
- package/src/components/Card/CardRender.js +1 -1
- package/src/components/Card/helpers/filter-query-setup.js +1 -1
- package/src/components/CarouselWrapper.js +64 -19
- package/src/components/DataSummary/DataSummaryFactory.js +1 -1
- package/src/components/DataSummary/DataSummaryRender.js +1 -1
- package/src/components/EmailConfirm/EmailConfirm.js +1 -1
- package/src/components/EmailConfirm/mutation.js +1 -1
- package/src/components/Image/ImageFactory.js +10 -7
- package/src/components/List/ListBuilder.js +2 -2
- package/src/components/List/ListFactory.js +1 -1
- package/src/components/List/ListRender.js +1 -1
- package/src/components/Login/LoggedInMessage.js +1 -1
- package/src/components/Login/Login.js +1 -1
- package/src/components/Menu/Menu.js +50 -12
- package/src/components/PasswordReset/PasswordReset.js +1 -1
- package/src/components/PasswordResetRequest/PasswordResetRequest.js +1 -1
- package/src/components/SearchFilter/SearchFilterContainer.js +1 -1
- package/src/constants/index.js +6 -0
- package/src/helpers/build-props-query.js +2 -2
- package/src/hooks/use-get-entity-schema.js +1 -1
- package/src/hooks/use-get-entity-schemas-as-obj.js +1 -1
- package/src/hooks/use-get-image-id-from-relation.js +1 -1
- package/src/hooks/use-get-images.js +1 -1
- package/src/hooks/use-get-single-entity-schema.js +1 -1
- package/tests/unit/src/components/Banner/AdSlotRender.test.js +81 -0
- package/tests/unit/src/components/Banner/Banner.test.js +2 -1
- package/tests/unit/src/components/Banner/BannerRender.test.js +119 -0
- package/tests/unit/src/components/Banner/__snapshots__/AdSlotRender.test.js.snap +54 -0
- package/tests/unit/src/components/Banner/__snapshots__/BannerRender.test.js.snap +10 -0
- package/tests/unit/src/components/Button.test.js +2 -1
- package/tests/unit/src/components/Card/CardRender.test.js +1 -1
- package/tests/unit/src/components/Card/__snapshots__/CardContainer.test.js.snap +4 -4
- package/tests/unit/src/components/Carousel/Carousel.test.js +1 -1
- package/tests/unit/src/components/DataSummary/DataSummaryFactory.test.js +3 -2
- package/tests/unit/src/components/EmailConfirm/EmailConfirm.test.js +2 -1
- package/tests/unit/src/components/Image/GlobalLightbox/GlobalLightbox.test.js +10 -6
- package/tests/unit/src/components/Image/ImageFactory.test.js +11 -19
- package/tests/unit/src/components/Image/__snapshots__/ImageFactory.test.js.snap +34 -1
- package/tests/unit/src/components/Image/mocks.js +80 -24
- package/tests/unit/src/components/List/ListRender.test.js +2 -1
- package/tests/unit/src/components/Login/Login.test.js +2 -1
- package/tests/unit/src/components/PasswordReset/PasswordReset.test.js +2 -2
- package/tests/unit/src/components/PasswordResetRequest/PasswordResetRequest.test.js +2 -2
- package/tests/unit/src/components/SearchFilter/SearchFilterContainer.test.js +2 -1
- package/tests/unit/src/components/Video/providers/JWPlayer/JWPlayerProvider.test.js +1 -1
- package/tests/unit/src/components/__snapshots__/CarouselWrapper.test.js.snap +12 -12
- package/tests/unit/src/helpers/build-props-query.test.js +6 -6
- package/tests/unit/src/hooks/use-get-entity-schema-as-obj.test.js +2 -2
- package/tests/unit/src/hooks/use-get-image-id-from-relation.test.js +1 -1
- package/tests/unit/src/hooks/use-get-images.test.js +4 -14
- package/tests/unit/src/hooks/use-get-single-entity-schema.test.js +2 -4
|
@@ -1,10 +1,57 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getFiles,
|
|
3
|
+
getFileById,
|
|
4
|
+
generateSingleItemQuery
|
|
5
|
+
} from '../../../../../src/application/query';
|
|
6
|
+
import { DATA_SUMMARY_MOCK } from '../../../../helpers/mocks';
|
|
2
7
|
|
|
3
8
|
const MOCK_BASIC = [
|
|
9
|
+
{
|
|
10
|
+
request: {
|
|
11
|
+
query: getFileById,
|
|
12
|
+
variables: { id: 'test-id' }
|
|
13
|
+
},
|
|
14
|
+
result: {
|
|
15
|
+
data: {
|
|
16
|
+
getFile: {
|
|
17
|
+
id: 'test-id',
|
|
18
|
+
location: 'test-location',
|
|
19
|
+
mimetype: 'test-mimetype',
|
|
20
|
+
url: 'test-url',
|
|
21
|
+
data: null,
|
|
22
|
+
__typename: 'File'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const MOCK_RELATION = [
|
|
30
|
+
...DATA_SUMMARY_MOCK,
|
|
31
|
+
{
|
|
32
|
+
request: {
|
|
33
|
+
query: generateSingleItemQuery('getPublishedPage', 'publishedPage { otherImageIds }'),
|
|
34
|
+
variables: {
|
|
35
|
+
id: 'parentId'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
result: {
|
|
39
|
+
data: {
|
|
40
|
+
entityData: {
|
|
41
|
+
id: 'parentId',
|
|
42
|
+
publishedPage: {
|
|
43
|
+
otherImageIds: ['test-id', 'test-id-2'],
|
|
44
|
+
__typename: 'PublishedPage'
|
|
45
|
+
},
|
|
46
|
+
__typename: 'PublishedPage'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
4
51
|
{
|
|
5
52
|
request: {
|
|
6
53
|
query: getFiles,
|
|
7
|
-
variables: { where: { id: { _in: ['test-id'] } } }
|
|
54
|
+
variables: { where: { id: { _in: ['test-id', 'test-id-2'] } } }
|
|
8
55
|
},
|
|
9
56
|
result: {
|
|
10
57
|
data: {
|
|
@@ -14,7 +61,16 @@ const MOCK_BASIC = [
|
|
|
14
61
|
location: 'test-location',
|
|
15
62
|
mimetype: 'test-mimetype',
|
|
16
63
|
url: 'test-url',
|
|
17
|
-
data: null
|
|
64
|
+
data: null,
|
|
65
|
+
__typename: 'File'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 'test-id-2',
|
|
69
|
+
location: 'test-location',
|
|
70
|
+
mimetype: 'test-mimetype',
|
|
71
|
+
url: 'test-url-2',
|
|
72
|
+
data: null,
|
|
73
|
+
__typename: 'File'
|
|
18
74
|
}
|
|
19
75
|
]
|
|
20
76
|
}
|
|
@@ -25,22 +81,21 @@ const MOCK_BASIC = [
|
|
|
25
81
|
const MOCK_NO_URL = [
|
|
26
82
|
{
|
|
27
83
|
request: {
|
|
28
|
-
query:
|
|
29
|
-
variables: {
|
|
84
|
+
query: getFileById,
|
|
85
|
+
variables: { id: 'test-no-url' }
|
|
30
86
|
},
|
|
31
87
|
result: {
|
|
32
88
|
data: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
]
|
|
89
|
+
getFile: {
|
|
90
|
+
id: 'test-no-url',
|
|
91
|
+
location: 'test-location',
|
|
92
|
+
mimetype: 'test-mimetype',
|
|
93
|
+
url: null,
|
|
94
|
+
data: {
|
|
95
|
+
caption: 'image caption'
|
|
96
|
+
},
|
|
97
|
+
__typename: 'File'
|
|
98
|
+
}
|
|
44
99
|
}
|
|
45
100
|
}
|
|
46
101
|
}
|
|
@@ -49,10 +104,8 @@ const MOCK_NO_URL = [
|
|
|
49
104
|
const MOCK_WITH_ERR = [
|
|
50
105
|
{
|
|
51
106
|
request: {
|
|
52
|
-
query:
|
|
53
|
-
variables: {
|
|
54
|
-
variables: { where: { id: { _in: ['error'] } } }
|
|
55
|
-
}
|
|
107
|
+
query: getFileById,
|
|
108
|
+
variables: { id: 'error' }
|
|
56
109
|
},
|
|
57
110
|
error: new Error('this is an error')
|
|
58
111
|
}
|
|
@@ -74,7 +127,8 @@ const MOCKS = [
|
|
|
74
127
|
location: 'test-location',
|
|
75
128
|
mimetype: 'test-mimetype',
|
|
76
129
|
url: 'test-url',
|
|
77
|
-
data: null
|
|
130
|
+
data: null,
|
|
131
|
+
__typename: 'File'
|
|
78
132
|
}
|
|
79
133
|
}
|
|
80
134
|
}
|
|
@@ -95,7 +149,8 @@ const MOCKS = [
|
|
|
95
149
|
url: 'test-url',
|
|
96
150
|
data: {
|
|
97
151
|
caption: 'image caption'
|
|
98
|
-
}
|
|
152
|
+
},
|
|
153
|
+
__typename: 'File'
|
|
99
154
|
}
|
|
100
155
|
}
|
|
101
156
|
}
|
|
@@ -116,7 +171,8 @@ const MOCKS = [
|
|
|
116
171
|
url: 'test-url',
|
|
117
172
|
data: {
|
|
118
173
|
altText: 'image alt text'
|
|
119
|
-
}
|
|
174
|
+
},
|
|
175
|
+
__typename: 'File'
|
|
120
176
|
}
|
|
121
177
|
}
|
|
122
178
|
}
|
|
@@ -148,4 +204,4 @@ const MOCKS = [
|
|
|
148
204
|
]
|
|
149
205
|
];
|
|
150
206
|
|
|
151
|
-
export { MOCKS, MOCK_BASIC, MOCK_WITH_ERR, MOCK_NO_URL };
|
|
207
|
+
export { MOCKS, MOCK_BASIC, MOCK_WITH_ERR, MOCK_NO_URL, MOCK_RELATION };
|
|
@@ -2,7 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { render } from '@blaze-cms/tools/test-helpers/test-functions';
|
|
3
3
|
import ListRender from '../../../../../src/components/List/ListRender';
|
|
4
4
|
|
|
5
|
-
jest.mock('@apollo/
|
|
5
|
+
jest.mock('@apollo/client', () => ({
|
|
6
|
+
...jest.requireActual('@apollo/client'),
|
|
6
7
|
useQuery: jest.fn(({ data, loading, error, fetchMore }) => ({ data, loading, error, fetchMore }))
|
|
7
8
|
}));
|
|
8
9
|
|
|
@@ -9,7 +9,8 @@ jest.mock('@blaze-cms/core-auth-ui', () => ({
|
|
|
9
9
|
.mockImplementationOnce(() => ({ isLoggedIn: true }))
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
|
-
jest.mock('
|
|
12
|
+
jest.mock('@apollo/client', () => ({
|
|
13
|
+
...jest.requireActual('@apollo/client'),
|
|
13
14
|
useMutation: jest.fn(() => [variables => variables, { client: { resetStore: null } }])
|
|
14
15
|
}));
|
|
15
16
|
|
|
@@ -2,7 +2,7 @@ import '@testing-library/jest-dom/extend-expect';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { RESET_USER_PASSWORD_MUTATION } from '@blaze-cms/core-auth-ui';
|
|
4
4
|
import { fireEvent, render, queryByAttribute, waitFor } from '@testing-library/react';
|
|
5
|
-
import { MockedProvider } from '@apollo/
|
|
5
|
+
import { MockedProvider } from '@apollo/client/testing';
|
|
6
6
|
import PasswordReset from '../../../../../src/components/PasswordReset';
|
|
7
7
|
|
|
8
8
|
jest.mock('next/router', () => ({
|
|
@@ -31,7 +31,7 @@ const mocks = [
|
|
|
31
31
|
|
|
32
32
|
const setup = () => {
|
|
33
33
|
const resetComponent = render(
|
|
34
|
-
<MockedProvider mocks={mocks}
|
|
34
|
+
<MockedProvider mocks={mocks}>
|
|
35
35
|
<PasswordReset>
|
|
36
36
|
<div>child</div>
|
|
37
37
|
</PasswordReset>
|
|
@@ -2,7 +2,7 @@ import '@testing-library/jest-dom/extend-expect';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { REQUEST_USER_PASSWORD_RESET_MUTATION } from '@blaze-cms/core-auth-ui';
|
|
4
4
|
import { fireEvent, render, waitFor } from '@testing-library/react';
|
|
5
|
-
import { MockedProvider } from '@apollo/
|
|
5
|
+
import { MockedProvider } from '@apollo/client/testing';
|
|
6
6
|
import PasswordResetRequest from '../../../../../src/components/PasswordResetRequest';
|
|
7
7
|
|
|
8
8
|
jest.mock('next/router', () => ({
|
|
@@ -28,7 +28,7 @@ const mocks = [
|
|
|
28
28
|
|
|
29
29
|
const setup = () => {
|
|
30
30
|
const resetRequestComponent = render(
|
|
31
|
-
<MockedProvider mocks={mocks}
|
|
31
|
+
<MockedProvider mocks={mocks}>
|
|
32
32
|
<PasswordResetRequest modifier="pass-request-reset">
|
|
33
33
|
<div className="child_1">one child</div>
|
|
34
34
|
</PasswordResetRequest>
|
|
@@ -4,7 +4,8 @@ import { render } from '@blaze-cms/tools/test-helpers/test-functions';
|
|
|
4
4
|
import { MOCKED_PROPS_SEARCH_FILTER } from '../../../../helpers/mocks';
|
|
5
5
|
import SearchFilterContainer from '../../../../../src/components/SearchFilter';
|
|
6
6
|
|
|
7
|
-
jest.mock('@apollo/
|
|
7
|
+
jest.mock('@apollo/client', () => ({
|
|
8
|
+
...jest.requireActual('@apollo/client'),
|
|
8
9
|
useQuery: jest.fn(() => ({ data: {}, loading: false, error: null }))
|
|
9
10
|
}));
|
|
10
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@testing-library/jest-dom/extend-expect';
|
|
3
|
-
import { MockedProvider } from '@apollo/
|
|
3
|
+
import { MockedProvider } from '@apollo/client/testing';
|
|
4
4
|
import { render, act } from '@testing-library/react';
|
|
5
5
|
import JWPlayerProvider from '../../../../../../../src/components/Video/providers/JWPlayer/JWPlayerProvider';
|
|
6
6
|
import IMAGE_MOCKS, { getMockedJWPlayerProps } from './mocks';
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
exports[`CarouselWrapper component should add banner modifier if passed 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="
|
|
6
|
+
class="cards-carousel has-a-banner"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
class="
|
|
9
|
+
class="cards-carousel--left-button-wrapper"
|
|
10
10
|
/>
|
|
11
11
|
<div
|
|
12
|
-
class="
|
|
12
|
+
class="cards-carousel--right-button-wrapper"
|
|
13
13
|
/>
|
|
14
14
|
<div
|
|
15
|
-
class="
|
|
15
|
+
class="cards-carousel--content items-per-row-0"
|
|
16
16
|
>
|
|
17
17
|
<div>
|
|
18
18
|
<div>
|
|
@@ -39,16 +39,16 @@ exports[`CarouselWrapper component should add banner modifier if passed 1`] = `
|
|
|
39
39
|
exports[`CarouselWrapper component should add modifier bassed on itemsPerRow 1`] = `
|
|
40
40
|
<DocumentFragment>
|
|
41
41
|
<div
|
|
42
|
-
class="
|
|
42
|
+
class="cards-carousel"
|
|
43
43
|
>
|
|
44
44
|
<div
|
|
45
|
-
class="
|
|
45
|
+
class="cards-carousel--left-button-wrapper"
|
|
46
46
|
/>
|
|
47
47
|
<div
|
|
48
|
-
class="
|
|
48
|
+
class="cards-carousel--right-button-wrapper"
|
|
49
49
|
/>
|
|
50
50
|
<div
|
|
51
|
-
class="
|
|
51
|
+
class="cards-carousel--content items-per-row-3"
|
|
52
52
|
>
|
|
53
53
|
<div>
|
|
54
54
|
<div>
|
|
@@ -75,16 +75,16 @@ exports[`CarouselWrapper component should add modifier bassed on itemsPerRow 1`]
|
|
|
75
75
|
exports[`CarouselWrapper component should render without throwing an error and match snapshot 1`] = `
|
|
76
76
|
<DocumentFragment>
|
|
77
77
|
<div
|
|
78
|
-
class="
|
|
78
|
+
class="cards-carousel"
|
|
79
79
|
>
|
|
80
80
|
<div
|
|
81
|
-
class="
|
|
81
|
+
class="cards-carousel--left-button-wrapper"
|
|
82
82
|
/>
|
|
83
83
|
<div
|
|
84
|
-
class="
|
|
84
|
+
class="cards-carousel--right-button-wrapper"
|
|
85
85
|
/>
|
|
86
86
|
<div
|
|
87
|
-
class="
|
|
87
|
+
class="cards-carousel--content items-per-row-0"
|
|
88
88
|
>
|
|
89
89
|
<div>
|
|
90
90
|
<div>
|
|
@@ -55,7 +55,7 @@ describe('get card render props', () => {
|
|
|
55
55
|
};
|
|
56
56
|
const query = buildPropsQuery(_data, [], cardProps);
|
|
57
57
|
expect(query).toEqual(
|
|
58
|
-
'id,name,url,sponsored,featured,category{name,listingPageId,listingPageEntity, publishedListingPage{url}},image{url,data}'
|
|
58
|
+
'id,name,url,sponsored,featured,category{name,listingPageId,listingPageEntity, id publishedListingPage{id, url}},image{id,url,data}'
|
|
59
59
|
);
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -86,18 +86,18 @@ describe('get card render props', () => {
|
|
|
86
86
|
displayThumbnail: false
|
|
87
87
|
});
|
|
88
88
|
expect(query).toEqual(
|
|
89
|
-
'id,name,alternativePreHeader{name},alternativeHeadline,url,sponsored,featured,category{name,listingPageId,listingPageEntity, publishedListingPage{url}}'
|
|
89
|
+
'id,name,alternativePreHeader{name},alternativeHeadline,url,sponsored,featured,category{name,listingPageId,listingPageEntity, id publishedListingPage{id, url}}'
|
|
90
90
|
);
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
it('should not include category if the schema does not have a category', () => {
|
|
94
94
|
const query = buildPropsQuery(data, [], cardProps);
|
|
95
|
-
expect(query).toEqual('id,name,url,sponsored,featured,image{url,data}');
|
|
95
|
+
expect(query).toEqual('id,name,url,sponsored,featured,image{id,url,data}');
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
it('should return complex props when base includes published', () => {
|
|
99
99
|
const query = buildPropsQuery(data, ['published.date'], cardProps);
|
|
100
|
-
expect(query).toEqual('id,name,url,sponsored,featured,image{url,data},published{date,url}');
|
|
100
|
+
expect(query).toEqual('id,name,url,sponsored,featured,image{id,url,data},published{date,url}');
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
it('should return result as if isCard was false when isCard is not passed', () => {
|
|
@@ -107,7 +107,7 @@ describe('get card render props', () => {
|
|
|
107
107
|
|
|
108
108
|
it('should return result as if isCard was false when extraProps were not passed', () => {
|
|
109
109
|
const query = buildPropsQuery(data, undefined, cardProps);
|
|
110
|
-
expect(query).toEqual('id,name,url,sponsored,featured,image{url,data}');
|
|
110
|
+
expect(query).toEqual('id,name,url,sponsored,featured,image{id,url,data}');
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
it('should return a string with respective props query when isCard is passed as true', () => {
|
|
@@ -123,7 +123,7 @@ describe('get card render props', () => {
|
|
|
123
123
|
};
|
|
124
124
|
const query = buildPropsQuery(_data, [], cardProps);
|
|
125
125
|
expect(query).toEqual(
|
|
126
|
-
'id,name,category{name,listingPageId,listingPageEntity, publishedListingPage{url}}'
|
|
126
|
+
'id,name,category{name,listingPageId,listingPageEntity, id publishedListingPage{id, url}}'
|
|
127
127
|
);
|
|
128
128
|
});
|
|
129
129
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/
|
|
1
|
+
import { useQuery } from '@apollo/client';
|
|
2
2
|
import { useGetEntitySchemasAsObj } from '../../../../src/hooks';
|
|
3
3
|
|
|
4
4
|
import { getMultipleSchema } from '../../../../src/application/query';
|
|
5
5
|
|
|
6
|
-
jest.mock('@apollo/
|
|
6
|
+
jest.mock('@apollo/client', () => ({
|
|
7
7
|
useQuery: jest.fn(() => ({ data: {}, loading: false, error: null }))
|
|
8
8
|
}));
|
|
9
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { renderHook } from '@testing-library/react-hooks';
|
|
2
|
-
import { MockedProvider } from '@apollo/
|
|
2
|
+
import { MockedProvider } from '@apollo/client/testing';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import useGetImageIdFromRelation from '../../../../src/hooks/use-get-image-id-from-relation';
|
|
5
5
|
import * as query from '../../../../src/application/query';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@testing-library/jest-dom/extend-expect';
|
|
3
|
-
import { MockedProvider } from '@apollo/
|
|
3
|
+
import { MockedProvider } from '@apollo/client/testing';
|
|
4
4
|
import { renderHook, act } from '@testing-library/react-hooks';
|
|
5
5
|
import { useGetImages } from '../../../../src/hooks';
|
|
6
6
|
import { getFiles, getFileById } from '../../../../src/application/query';
|
|
@@ -10,8 +10,6 @@ const id2 = 'test-id-2';
|
|
|
10
10
|
const resultData = [
|
|
11
11
|
{
|
|
12
12
|
id: id1,
|
|
13
|
-
location: 'test-location-1',
|
|
14
|
-
mimetype: 'test-mimetype-1',
|
|
15
13
|
url: 'test-url-1',
|
|
16
14
|
data: {
|
|
17
15
|
caption: 'test-caption-1'
|
|
@@ -19,8 +17,6 @@ const resultData = [
|
|
|
19
17
|
},
|
|
20
18
|
{
|
|
21
19
|
id: id2,
|
|
22
|
-
location: 'test-location-2',
|
|
23
|
-
mimetype: 'test-mimetype-2',
|
|
24
20
|
url: 'test-url-2',
|
|
25
21
|
data: null
|
|
26
22
|
}
|
|
@@ -67,9 +63,7 @@ const STRING_MOCK = [
|
|
|
67
63
|
|
|
68
64
|
describe('UseGetImages hook', () => {
|
|
69
65
|
const arrayWrapper = ({ children }) => (
|
|
70
|
-
<MockedProvider mocks={ARRAY_MOCK}
|
|
71
|
-
{children}
|
|
72
|
-
</MockedProvider>
|
|
66
|
+
<MockedProvider mocks={ARRAY_MOCK}>{children}</MockedProvider>
|
|
73
67
|
);
|
|
74
68
|
|
|
75
69
|
it('should be a function', () => {
|
|
@@ -78,9 +72,7 @@ describe('UseGetImages hook', () => {
|
|
|
78
72
|
|
|
79
73
|
it('should return expected value (id is an array)', async () => {
|
|
80
74
|
const wrapper = ({ children }) => (
|
|
81
|
-
<MockedProvider mocks={ARRAY_MOCK}
|
|
82
|
-
{children}
|
|
83
|
-
</MockedProvider>
|
|
75
|
+
<MockedProvider mocks={ARRAY_MOCK}>{children}</MockedProvider>
|
|
84
76
|
);
|
|
85
77
|
const ids = [id1, id2];
|
|
86
78
|
const hasMultipleIds = true;
|
|
@@ -147,9 +139,7 @@ describe('UseGetImages hook', () => {
|
|
|
147
139
|
|
|
148
140
|
it('should return expected value (id is a string)', async () => {
|
|
149
141
|
const wrapper = ({ children }) => (
|
|
150
|
-
<MockedProvider mocks={STRING_MOCK}
|
|
151
|
-
{children}
|
|
152
|
-
</MockedProvider>
|
|
142
|
+
<MockedProvider mocks={STRING_MOCK}>{children}</MockedProvider>
|
|
153
143
|
);
|
|
154
144
|
|
|
155
145
|
const { result, waitForNextUpdate } = renderHook(() => useGetImages(id1), {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { renderHook, act } from '@testing-library/react-hooks';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { MockedProvider } from '@apollo/
|
|
3
|
+
import { MockedProvider } from '@apollo/client/testing';
|
|
4
4
|
import { useGetSingleEntitySchema } from '../../../../src/hooks';
|
|
5
5
|
import { getSingleEntitySchema } from '../../../../src/application/query';
|
|
6
6
|
|
|
@@ -39,9 +39,7 @@ const getSingleEntitySchemaMock = {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const wrapper = ({ children }) => (
|
|
42
|
-
<MockedProvider mocks={[getSingleEntitySchemaMock]}
|
|
43
|
-
{children}
|
|
44
|
-
</MockedProvider>
|
|
42
|
+
<MockedProvider mocks={[getSingleEntitySchemaMock]}>{children}</MockedProvider>
|
|
45
43
|
);
|
|
46
44
|
|
|
47
45
|
describe('useGetSingleEntitySchema hook', () => {
|