gatsby-core-theme 44.10.1 → 44.10.11
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/.ci.yml +1 -0
- package/CHANGELOG.md +87 -0
- package/gatsby-config.js +3 -3
- package/gatsby-node.mjs +1 -0
- package/package.json +1 -1
- package/src/components/app-ssr.js +16 -18
- package/src/components/atoms/admin/bar/index.js +6 -2
- package/src/components/atoms/admin/button/index.js +4 -3
- package/src/components/atoms/contact-form/index.js +2 -2
- package/src/components/atoms/market-dropdown/index.js +7 -9
- package/src/components/atoms/notifications/index.js +2 -3
- package/src/components/atoms/ratings/index.js +7 -6
- package/src/components/atoms/review-link/index.js +16 -11
- package/src/components/atoms/search/autocomplete/article/index.js +13 -9
- package/src/components/atoms/search/autocomplete/default/index.js +13 -9
- package/src/components/atoms/search/autocomplete/game/index.js +22 -12
- package/src/components/atoms/search/autocomplete/operator/index.js +26 -18
- package/src/components/molecules/bonus/template-one/index.js +15 -2
- package/src/components/molecules/bonus/template-two/index.js +7 -1
- package/src/components/molecules/cookie-modal/index.js +1 -1
- package/src/components/molecules/floating-area/index.js +6 -12
- package/src/components/molecules/footer/index.js +35 -27
- package/src/components/molecules/footer/variants/template-one/template-one.stories.js +70 -67
- package/src/components/molecules/footer/variants/template-one/template-one.test.js +92 -69
- package/src/components/molecules/footer/variants/template-three/template-three.stories.js +4 -4
- package/src/components/molecules/footer/variants/template-three/template-three.test.js +98 -73
- package/src/components/molecules/footer/variants/template-two/template-two.stories.js +3 -3
- package/src/components/molecules/footer/variants/template-two/template-two.test.js +96 -73
- package/src/components/molecules/header/variants/default/template-one/index.js +15 -13
- package/src/components/molecules/header/variants/default/template-one/template-one.test.js +37 -29
- package/src/components/molecules/header/variants/slot/template-one/templateone.test.js +32 -29
- package/src/components/molecules/leave-comment-form/index.js +90 -79
- package/src/components/molecules/main/index.js +5 -7
- package/src/components/molecules/menu/index.js +28 -30
- package/src/components/molecules/newsletter/form/index.js +2 -2
- package/src/components/molecules/newsletter/index.js +23 -19
- package/src/components/molecules/tnc/index.js +4 -2
- package/src/components/organisms/anchor/template-two/index.js +33 -18
- package/src/components/organisms/footer-navigation/index.js +10 -9
- package/src/constants/ratings-constant.js +7 -9
- package/src/helpers/getters.mjs +3 -3
- package/src/helpers/processImageNode.js +38 -30
- package/src/helpers/processImageNode.test.js +33 -24
- package/src/helpers/replaceMedia.js +2 -2
- package/src/resolver/games.mjs +1 -1
- package/src/resolver/operators.mjs +23 -13
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/* eslint-disable no-restricted-syntax */
|
|
2
|
-
import React from
|
|
3
|
-
import { render, cleanup, waitFor } from
|
|
4
|
-
import
|
|
5
|
-
import { getExtraField, copyrightText } from
|
|
6
|
-
import MainProvider from
|
|
7
|
-
import Security from
|
|
8
|
-
import getFooterData from
|
|
9
|
-
import TemplateOne from
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render, cleanup, waitFor } from "@testing-library/react";
|
|
4
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
5
|
+
import { getExtraField, copyrightText } from "~helpers/getters";
|
|
6
|
+
import MainProvider from "~context/MainProvider";
|
|
7
|
+
import Security from "~images/icons/security";
|
|
8
|
+
import getFooterData from "../../../../../../tests/factories/modules/footer.factory";
|
|
9
|
+
import TemplateOne from ".";
|
|
10
10
|
|
|
11
11
|
const translations = {
|
|
12
|
-
licensed_casinos:
|
|
12
|
+
licensed_casinos: "We only list licensed casinos",
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const helpText = `
|
|
@@ -22,7 +22,7 @@ const helpText = `
|
|
|
22
22
|
</a>
|
|
23
23
|
in order to get help.
|
|
24
24
|
</p>`;
|
|
25
|
-
const phoneNum =
|
|
25
|
+
const phoneNum = "- 89 241 5401";
|
|
26
26
|
|
|
27
27
|
const dmcaImg = (
|
|
28
28
|
<img
|
|
@@ -56,18 +56,21 @@ let footerLogos;
|
|
|
56
56
|
|
|
57
57
|
beforeEach(() => {
|
|
58
58
|
data = getFooterData();
|
|
59
|
-
footerMenu = getExtraField(data?.extra_fields,
|
|
60
|
-
asSeenOn = getExtraField(data?.extra_fields,
|
|
61
|
-
gamblingText = getExtraField(data?.extra_fields,
|
|
62
|
-
socialIcons = getExtraField(data?.extra_fields,
|
|
63
|
-
copyrightDisclaimer = getExtraField(
|
|
64
|
-
|
|
59
|
+
footerMenu = getExtraField(data?.extra_fields, "links");
|
|
60
|
+
asSeenOn = getExtraField(data?.extra_fields, "as_seen_on");
|
|
61
|
+
gamblingText = getExtraField(data?.extra_fields, "gambling_text");
|
|
62
|
+
socialIcons = getExtraField(data?.extra_fields, "social_icons");
|
|
63
|
+
copyrightDisclaimer = getExtraField(
|
|
64
|
+
data.extra_fields,
|
|
65
|
+
"copyright_disclaimer"
|
|
66
|
+
);
|
|
67
|
+
footerLogos = getExtraField(data?.extra_fields, "logos");
|
|
65
68
|
|
|
66
69
|
props = {
|
|
67
70
|
section: data,
|
|
68
|
-
template:
|
|
71
|
+
template: "default",
|
|
69
72
|
hasFooterLinks: false,
|
|
70
|
-
footerTemplate:
|
|
73
|
+
footerTemplate: "template_one",
|
|
71
74
|
showLinks: true,
|
|
72
75
|
copyrightDisclaimer,
|
|
73
76
|
footerLogos,
|
|
@@ -77,95 +80,109 @@ beforeEach(() => {
|
|
|
77
80
|
socialIcons,
|
|
78
81
|
hasDisclaimer: true,
|
|
79
82
|
showCopyright: true,
|
|
80
|
-
logo:
|
|
83
|
+
logo: "/images/logo.svg",
|
|
81
84
|
securityIcon: <Security />,
|
|
82
85
|
helpText,
|
|
83
86
|
phoneNum,
|
|
84
87
|
dmcaImg,
|
|
85
88
|
};
|
|
86
89
|
});
|
|
87
|
-
describe(
|
|
88
|
-
test(
|
|
90
|
+
describe("Show template one", () => {
|
|
91
|
+
test("render with props", () => {
|
|
89
92
|
const { container } = renderComponent(props);
|
|
90
93
|
expect(container).toBeTruthy();
|
|
91
94
|
});
|
|
92
|
-
test(
|
|
95
|
+
test("show correct template ", async () => {
|
|
93
96
|
const { container } = renderComponent(props);
|
|
94
97
|
await waitFor(() => {
|
|
95
|
-
expect(container.querySelectorAll(
|
|
98
|
+
expect(container.querySelectorAll(".footer.templateTwo").length).toBe(1);
|
|
96
99
|
});
|
|
97
100
|
});
|
|
98
|
-
test(
|
|
101
|
+
test("show as seen on in the middle, not top", async () => {
|
|
99
102
|
const { container, getByText } = renderComponent(props);
|
|
100
103
|
await waitFor(() => {
|
|
101
|
-
expect(container.querySelectorAll(
|
|
102
|
-
expect(container.querySelectorAll(
|
|
104
|
+
expect(container.querySelectorAll("footer > div")).toHaveLength(1);
|
|
105
|
+
expect(container.querySelectorAll(".asSeenOn")).toHaveLength(1);
|
|
103
106
|
|
|
104
107
|
// show correct title
|
|
105
|
-
expect(getByText(
|
|
108
|
+
expect(getByText("As Seen On:")).toHaveTextContent(`${asSeenOn.title}:`);
|
|
106
109
|
|
|
107
110
|
// show correct number of logos
|
|
108
|
-
expect(container.querySelectorAll(
|
|
111
|
+
expect(container.querySelectorAll(".asSeenOn li")).toHaveLength(3);
|
|
109
112
|
});
|
|
110
113
|
});
|
|
111
|
-
test(
|
|
114
|
+
test("footer middle part shows as seen on", async () => {
|
|
112
115
|
const { container } = renderComponent(props);
|
|
113
116
|
await waitFor(() => {
|
|
114
|
-
expect(container.querySelectorAll(
|
|
115
|
-
|
|
117
|
+
expect(container.querySelectorAll(".footerHotline > div")).toHaveLength(
|
|
118
|
+
2
|
|
119
|
+
);
|
|
120
|
+
expect(
|
|
121
|
+
container.querySelectorAll(".footerHotline .asSeenOn")
|
|
122
|
+
).toHaveLength(1);
|
|
116
123
|
});
|
|
117
124
|
});
|
|
118
|
-
test(
|
|
125
|
+
test("hide as seen on", async () => {
|
|
119
126
|
props = {
|
|
120
127
|
...props,
|
|
121
128
|
asSeenOn: null,
|
|
122
129
|
};
|
|
123
130
|
const { container } = renderComponent(props);
|
|
124
131
|
await waitFor(() => {
|
|
125
|
-
expect(container.querySelectorAll(
|
|
132
|
+
expect(container.querySelectorAll(".asSeenOn")).toHaveLength(0);
|
|
126
133
|
});
|
|
127
134
|
});
|
|
128
|
-
test(
|
|
135
|
+
test("render menu list", async () => {
|
|
129
136
|
const { container, getByText } = renderComponent(props);
|
|
130
137
|
|
|
131
138
|
await waitFor(() => {
|
|
132
|
-
expect(container.querySelectorAll(
|
|
133
|
-
expect(container.querySelectorAll(
|
|
134
|
-
expect(container.querySelectorAll(
|
|
139
|
+
expect(container.querySelectorAll(".topPart")).toHaveLength(1);
|
|
140
|
+
expect(container.querySelectorAll(".links")).toHaveLength(1);
|
|
141
|
+
expect(container.querySelectorAll(".links ul")).toHaveLength(
|
|
142
|
+
footerMenu.children.length
|
|
143
|
+
);
|
|
135
144
|
|
|
136
145
|
// show correct title
|
|
137
146
|
expect(getByText(footerMenu.children[0].title)).toBeTruthy();
|
|
138
147
|
expect(getByText(footerMenu.children[2].title)).toBeTruthy();
|
|
139
148
|
|
|
140
149
|
// show correct number of child lists
|
|
141
|
-
expect(
|
|
142
|
-
|
|
150
|
+
expect(
|
|
151
|
+
getByText(footerMenu.children[1].title).closest("ul").children
|
|
152
|
+
).toHaveLength(7);
|
|
153
|
+
expect(
|
|
154
|
+
getByText(footerMenu.children[2].title).closest("ul").children
|
|
155
|
+
).toHaveLength(6);
|
|
143
156
|
|
|
144
157
|
// show correct url
|
|
145
158
|
expect(
|
|
146
|
-
getByText(footerMenu.children[1].children[0].title)
|
|
159
|
+
getByText(footerMenu.children[1].children[0].title)
|
|
160
|
+
.closest("a")
|
|
161
|
+
.getAttribute("href")
|
|
147
162
|
).toEqual(`/${footerMenu.children[1].children[0].value}`);
|
|
148
163
|
expect(
|
|
149
|
-
getByText(footerMenu.children[2].children[2].title)
|
|
164
|
+
getByText(footerMenu.children[2].children[2].title)
|
|
165
|
+
.closest("a")
|
|
166
|
+
.getAttribute("href")
|
|
150
167
|
).toEqual(`/${footerMenu.children[2].children[2].value}`);
|
|
151
168
|
});
|
|
152
169
|
});
|
|
153
|
-
test(
|
|
170
|
+
test("hide menu list", async () => {
|
|
154
171
|
props = {
|
|
155
172
|
...props,
|
|
156
173
|
showLinks: null,
|
|
157
174
|
};
|
|
158
175
|
const { container } = renderComponent(props);
|
|
159
176
|
await waitFor(() => {
|
|
160
|
-
expect(container.querySelectorAll(
|
|
161
|
-
expect(container.querySelectorAll(
|
|
177
|
+
expect(container.querySelectorAll(".links")).toHaveLength(0);
|
|
178
|
+
expect(container.querySelectorAll(".links ul")).toHaveLength(0);
|
|
162
179
|
});
|
|
163
180
|
});
|
|
164
|
-
test(
|
|
181
|
+
test("show gambling text", async () => {
|
|
165
182
|
const { container } = renderComponent(props);
|
|
166
183
|
await waitFor(() => {
|
|
167
|
-
expect(container.querySelectorAll(
|
|
168
|
-
expect(container.querySelectorAll(
|
|
184
|
+
expect(container.querySelectorAll(".license > div")).toHaveLength(4);
|
|
185
|
+
expect(container.querySelectorAll(".gamblingText")).toHaveLength(1);
|
|
169
186
|
});
|
|
170
187
|
});
|
|
171
188
|
// test('correct security text', async () => {
|
|
@@ -178,72 +195,78 @@ describe('Show template one', () => {
|
|
|
178
195
|
// ).toContain('securityText');
|
|
179
196
|
// });
|
|
180
197
|
// });
|
|
181
|
-
test(
|
|
198
|
+
test("correct help text", async () => {
|
|
182
199
|
const { container } = renderComponent(props);
|
|
183
200
|
await waitFor(() => {
|
|
184
|
-
expect(container.querySelector(
|
|
185
|
-
expect(container.querySelector(
|
|
201
|
+
expect(container.querySelector(".helpText")).toBeTruthy();
|
|
202
|
+
expect(container.querySelector(".helpText").innerHTML).toBe(helpText);
|
|
186
203
|
});
|
|
187
204
|
});
|
|
188
|
-
test(
|
|
205
|
+
test("correct phone number", async () => {
|
|
189
206
|
const { getByText, container } = renderComponent(props);
|
|
190
207
|
await waitFor(() => {
|
|
191
208
|
expect(getByText(phoneNum)).toBeTruthy();
|
|
192
|
-
expect(
|
|
209
|
+
expect(
|
|
210
|
+
container.querySelector(".phoneNum").innerHTML.split("</svg>")[1]
|
|
211
|
+
).toBe(phoneNum);
|
|
193
212
|
});
|
|
194
213
|
});
|
|
195
|
-
test(
|
|
214
|
+
test("show copyright disclaimer", async () => {
|
|
196
215
|
const { container } = renderComponent(props);
|
|
197
216
|
await waitFor(() => {
|
|
198
|
-
expect(container.querySelectorAll(
|
|
217
|
+
expect(container.querySelectorAll(".copyrightDisclaimer")).toBeTruthy();
|
|
199
218
|
|
|
200
|
-
expect(container.querySelector(
|
|
219
|
+
expect(container.querySelector(".copyrightDisclaimer").innerHTML).toBe(
|
|
220
|
+
copyrightDisclaimer
|
|
221
|
+
);
|
|
201
222
|
});
|
|
202
223
|
});
|
|
203
|
-
test(
|
|
224
|
+
test("show copyright", async () => {
|
|
204
225
|
const { container } = renderComponent(props);
|
|
205
226
|
await waitFor(() => {
|
|
206
|
-
expect(container.querySelector(
|
|
227
|
+
expect(container.querySelector(".copyrightText")).toHaveTextContent(
|
|
228
|
+
copyrightText()
|
|
229
|
+
);
|
|
207
230
|
});
|
|
208
231
|
});
|
|
209
|
-
test(
|
|
232
|
+
test("hide copyright", async () => {
|
|
210
233
|
props = {
|
|
211
234
|
...props,
|
|
212
235
|
showCopyright: false,
|
|
213
236
|
};
|
|
214
237
|
const { container } = renderComponent(props);
|
|
215
238
|
await waitFor(() => {
|
|
216
|
-
expect(container.querySelector(
|
|
239
|
+
expect(container.querySelector(".copyrightText")).toBeFalsy();
|
|
217
240
|
});
|
|
218
241
|
});
|
|
219
|
-
test(
|
|
242
|
+
test("show dmca image", async () => {
|
|
220
243
|
// eslint-disable-next-line global-require
|
|
221
|
-
const func = require(
|
|
244
|
+
const func = require("~helpers/device-detect");
|
|
222
245
|
func.isNativeImageLazyLoadingSupported = jest.fn(() => true);
|
|
223
246
|
props = {
|
|
224
247
|
...props,
|
|
225
248
|
showCopyright: false,
|
|
226
|
-
dmcaImage:
|
|
249
|
+
dmcaImage: "/images/dmca.png",
|
|
227
250
|
};
|
|
228
251
|
const { container } = renderComponent(props);
|
|
229
|
-
expect(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
);
|
|
252
|
+
expect(
|
|
253
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
254
|
+
).toBeTruthy();
|
|
255
|
+
expect(
|
|
256
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
257
|
+
).toHaveAttribute("src", "/images/dmca.png");
|
|
258
|
+
expect(
|
|
259
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
260
|
+
).toHaveAttribute("loading", "lazy");
|
|
238
261
|
});
|
|
239
|
-
test(
|
|
262
|
+
test("hide dmca image", async () => {
|
|
240
263
|
props = {
|
|
241
264
|
...props,
|
|
242
265
|
hasDisclaimer: false,
|
|
243
266
|
};
|
|
244
267
|
const { container } = renderComponent(props);
|
|
245
268
|
await waitFor(() => {
|
|
246
|
-
expect(container.querySelector(
|
|
269
|
+
expect(container.querySelector(".logos > a")).toBeFalsy();
|
|
247
270
|
});
|
|
248
271
|
});
|
|
249
272
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
|
-
import React from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import { FaArrowRight } from
|
|
5
|
-
import LazyImage from
|
|
6
|
-
import { getAltText } from
|
|
7
|
-
import Button from
|
|
8
|
-
import { imagePrettyUrl, getExtraField } from
|
|
9
|
-
import VariableComponent from
|
|
10
|
-
import styles from
|
|
2
|
+
import React from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { FaArrowRight } from "@react-icons/all-files/fa/FaArrowRight";
|
|
5
|
+
import LazyImage from "~hooks/lazy-image";
|
|
6
|
+
import { getAltText } from "~helpers/image";
|
|
7
|
+
import Button from "~atoms/button/button";
|
|
8
|
+
import { imagePrettyUrl, getExtraField } from "~helpers/getters";
|
|
9
|
+
import VariableComponent from "~molecules/header/variants/default/variables";
|
|
10
|
+
import styles from "./template-one.module.scss";
|
|
11
11
|
|
|
12
12
|
export default function TemplateOne({
|
|
13
13
|
page,
|
|
@@ -17,11 +17,11 @@ export default function TemplateOne({
|
|
|
17
17
|
imageObj,
|
|
18
18
|
width = 356,
|
|
19
19
|
height = 343,
|
|
20
|
-
buttonType="secondary",
|
|
21
|
-
buttonSize="m",
|
|
20
|
+
buttonType = "secondary",
|
|
21
|
+
buttonSize = "m",
|
|
22
22
|
hasVariableComponent = false,
|
|
23
23
|
}) {
|
|
24
|
-
const link = getExtraField(extraFields,
|
|
24
|
+
const link = getExtraField(extraFields, "link");
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<div className={styles.templateOne}>
|
|
@@ -55,7 +55,9 @@ export default function TemplateOne({
|
|
|
55
55
|
className={styles.image}
|
|
56
56
|
/>
|
|
57
57
|
)}
|
|
58
|
-
{hasVariableComponent &&
|
|
58
|
+
{hasVariableComponent && (
|
|
59
|
+
<VariableComponent page={page} className={styles.variable} />
|
|
60
|
+
)}
|
|
59
61
|
</div>
|
|
60
62
|
);
|
|
61
63
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render, cleanup } from
|
|
3
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, cleanup } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
4
4
|
|
|
5
|
-
import { getExtraField, imagePrettyUrl } from
|
|
6
|
-
import MainProvider from
|
|
7
|
-
import getPageData from
|
|
8
|
-
import TemplateOne from
|
|
5
|
+
import { getExtraField, imagePrettyUrl } from "~helpers/getters";
|
|
6
|
+
import MainProvider from "~context/MainProvider";
|
|
7
|
+
import getPageData from "../../../../../../../tests/factories/pages/default.factory";
|
|
8
|
+
import TemplateOne from ".";
|
|
9
9
|
|
|
10
10
|
const translations = {
|
|
11
|
-
online_casino:
|
|
11
|
+
online_casino: "Online Casino",
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
function renderComponent(pageData) {
|
|
@@ -35,44 +35,52 @@ let data;
|
|
|
35
35
|
beforeEach(() => {
|
|
36
36
|
data = getPageData();
|
|
37
37
|
});
|
|
38
|
-
describe(
|
|
39
|
-
test(
|
|
38
|
+
describe("Show template one", () => {
|
|
39
|
+
test("render with props", () => {
|
|
40
40
|
const { container } = renderComponent(data);
|
|
41
|
-
|
|
41
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
42
|
+
expect(container.querySelector(".templateOne")).toBeTruthy();
|
|
42
43
|
});
|
|
43
|
-
test(
|
|
44
|
+
test("show correct title", () => {
|
|
44
45
|
const { container } = renderComponent(data);
|
|
45
|
-
expect(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
46
|
+
expect(
|
|
47
|
+
container.querySelector(".headerContainer").querySelector("h1")
|
|
48
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
49
|
+
).toBeTruthy();
|
|
50
|
+
expect(
|
|
51
|
+
container.querySelector(".headerContainer").querySelector("h1").innerHTML
|
|
52
|
+
).toEqual(data.title);
|
|
49
53
|
});
|
|
50
|
-
test(
|
|
54
|
+
test("show correct description", () => {
|
|
51
55
|
const { container } = renderComponent(data);
|
|
52
|
-
expect(
|
|
53
|
-
|
|
54
|
-
);
|
|
56
|
+
expect(
|
|
57
|
+
container.querySelector(".headerContainer").querySelector("div").innerHTML
|
|
58
|
+
).toEqual(data.description);
|
|
55
59
|
});
|
|
56
|
-
test(
|
|
60
|
+
test("show correct url", () => {
|
|
57
61
|
const { container } = renderComponent(data);
|
|
58
62
|
expect(
|
|
59
|
-
container
|
|
60
|
-
|
|
63
|
+
container
|
|
64
|
+
.querySelector(".headerContainer")
|
|
65
|
+
.querySelector("a")
|
|
66
|
+
.innerHTML.split("<svg")[0]
|
|
67
|
+
).toEqual(getExtraField(data?.extra_fields, "link"));
|
|
61
68
|
});
|
|
62
|
-
test(
|
|
69
|
+
test("show correct image", () => {
|
|
63
70
|
const imgObj = data.featured_image_object;
|
|
64
71
|
|
|
65
72
|
// eslint-disable-next-line global-require
|
|
66
|
-
const func = require(
|
|
73
|
+
const func = require("~helpers/device-detect");
|
|
67
74
|
func.isNativeImageLazyLoadingSupported = jest.fn(() => true);
|
|
68
75
|
const { container } = renderComponent(data);
|
|
69
76
|
|
|
70
|
-
|
|
71
|
-
expect(container.querySelector(
|
|
72
|
-
|
|
77
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
78
|
+
expect(container.querySelector("img")).toBeTruthy();
|
|
79
|
+
expect(container.querySelector("img")).toHaveAttribute(
|
|
80
|
+
"src",
|
|
73
81
|
imagePrettyUrl(imgObj.filename, 356, 343)
|
|
74
82
|
);
|
|
75
|
-
expect(container.querySelector(
|
|
83
|
+
expect(container.querySelector("img")).toHaveAttribute("loading", "eager");
|
|
76
84
|
});
|
|
77
85
|
});
|
|
78
86
|
afterEach(() => {
|
|
@@ -1,47 +1,50 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render, cleanup, screen, waitFor } from
|
|
3
|
-
import
|
|
4
|
-
import { imagePrettyUrl } from
|
|
5
|
-
import getPageData from
|
|
6
|
-
import TemplateOne from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, cleanup, screen, waitFor } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
4
|
+
import { imagePrettyUrl } from "~helpers/getters";
|
|
5
|
+
import getPageData from "../../../../../../../tests/factories/pages/slot";
|
|
6
|
+
import TemplateOne from ".";
|
|
7
7
|
|
|
8
|
-
describe(
|
|
9
|
-
test(
|
|
10
|
-
const { container, getByText, getByRole } = render(
|
|
8
|
+
describe("summary component", () => {
|
|
9
|
+
test("render", () => {
|
|
10
|
+
const { container, getByText, getByRole } = render(
|
|
11
|
+
<TemplateOne page={getPageData()} />
|
|
12
|
+
);
|
|
11
13
|
|
|
12
|
-
expect(container.querySelectorAll(
|
|
14
|
+
expect(container.querySelectorAll("div.parentContainer")).toHaveLength(1);
|
|
13
15
|
|
|
14
|
-
const div = getByText(
|
|
16
|
+
const div = getByText("The Slot Title");
|
|
15
17
|
expect(div).toBeInTheDocument();
|
|
16
18
|
|
|
17
|
-
const h1 = getByRole(
|
|
19
|
+
const h1 = getByRole("heading", { level: 1 });
|
|
18
20
|
expect(h1).toBeInTheDocument();
|
|
19
21
|
});
|
|
20
22
|
|
|
21
23
|
const page = {
|
|
22
24
|
relation: {
|
|
23
|
-
name:
|
|
25
|
+
name: "Halloween",
|
|
24
26
|
thumbnail_filename_object: {
|
|
25
|
-
filename:
|
|
26
|
-
alt:
|
|
27
|
+
filename: "image.jpg",
|
|
28
|
+
alt: "Halloween",
|
|
27
29
|
},
|
|
28
30
|
},
|
|
29
31
|
sections: {
|
|
30
32
|
header: {
|
|
31
33
|
modules: [
|
|
32
34
|
{
|
|
33
|
-
name:
|
|
35
|
+
name: "bonus",
|
|
34
36
|
value: {
|
|
35
37
|
bonuses: {
|
|
36
38
|
main: {
|
|
37
|
-
one_liner:
|
|
39
|
+
one_liner:
|
|
40
|
+
"20 Free Spins No Deposit Bonus + 300% & 555 Spins Welcome Bonus",
|
|
38
41
|
},
|
|
39
42
|
},
|
|
40
43
|
logo: {
|
|
41
|
-
filename:
|
|
44
|
+
filename: "1651670485/davincis-gold-casino-logo.png",
|
|
42
45
|
},
|
|
43
|
-
links: { main:
|
|
44
|
-
status:
|
|
46
|
+
links: { main: "test" },
|
|
47
|
+
status: "active",
|
|
45
48
|
},
|
|
46
49
|
},
|
|
47
50
|
],
|
|
@@ -49,29 +52,29 @@ describe('summary component', () => {
|
|
|
49
52
|
},
|
|
50
53
|
};
|
|
51
54
|
|
|
52
|
-
describe(
|
|
53
|
-
it(
|
|
55
|
+
describe("SlotHeader", () => {
|
|
56
|
+
it("should render the image", async () => {
|
|
54
57
|
render(<TemplateOne page={page} />);
|
|
55
|
-
const img = screen.getByAltText(
|
|
58
|
+
const img = screen.getByAltText("Halloween");
|
|
56
59
|
await waitFor(() => expect(img).toBeVisible());
|
|
57
60
|
expect(img).toHaveAttribute(
|
|
58
|
-
|
|
61
|
+
"src",
|
|
59
62
|
imagePrettyUrl(page.relation?.logo?.filename, 170, 170)
|
|
60
63
|
);
|
|
61
|
-
expect(img).toHaveAttribute(
|
|
62
|
-
expect(img).toHaveAttribute(
|
|
64
|
+
expect(img).toHaveAttribute("width", "170");
|
|
65
|
+
expect(img).toHaveAttribute("height", "170");
|
|
63
66
|
});
|
|
64
67
|
|
|
65
|
-
it(
|
|
68
|
+
it("should render the headerBonus logo", async () => {
|
|
66
69
|
render(<TemplateOne page={page} />);
|
|
67
70
|
|
|
68
71
|
await waitFor(() => {
|
|
69
|
-
const bonusText = screen.getByText(
|
|
72
|
+
const bonusText = screen.getByText("Welcome Bonus");
|
|
70
73
|
expect(bonusText).toBeInTheDocument();
|
|
71
74
|
});
|
|
72
75
|
});
|
|
73
76
|
|
|
74
|
-
it(
|
|
77
|
+
it("should render the headerBonus one-liner", () => {
|
|
75
78
|
render(<TemplateOne page={page} />);
|
|
76
79
|
const oneLiner = screen.getByText(/20 Free Spins No Deposit Bonus/);
|
|
77
80
|
expect(oneLiner).toBeInTheDocument();
|