gatsby-core-theme 44.10.1 → 44.10.12-beta.1
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 +101 -0
- package/gatsby-browser.js +3 -145
- package/gatsby-config.js +3 -3
- package/gatsby-node.mjs +7 -1
- package/gatsby-ssr.js +142 -0
- package/package.json +2 -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/components/organisms/navigation/navigationContext.js +28 -4
- package/src/components/organisms/search/index.js +17 -4
- 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,16 +1,16 @@
|
|
|
1
1
|
/* eslint-disable no-restricted-syntax */
|
|
2
|
-
import React from
|
|
3
|
-
import { render, cleanup, waitFor } from
|
|
4
|
-
import
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render, cleanup, waitFor } from "@testing-library/react";
|
|
4
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
5
5
|
|
|
6
|
-
import { getExtraField, copyrightText } from
|
|
7
|
-
import MainProvider from
|
|
8
|
-
import getFooterData from
|
|
9
|
-
import Security from
|
|
10
|
-
import TemplateOne from
|
|
6
|
+
import { getExtraField, copyrightText } from "~helpers/getters";
|
|
7
|
+
import MainProvider from "~context/MainProvider";
|
|
8
|
+
import getFooterData from "../../../../../../tests/factories/modules/footer.factory";
|
|
9
|
+
import Security from "~images/icons/security";
|
|
10
|
+
import TemplateOne from ".";
|
|
11
11
|
|
|
12
12
|
const translations = {
|
|
13
|
-
licensed_casinos:
|
|
13
|
+
licensed_casinos: "We only list licensed casinos",
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const helpText = `
|
|
@@ -23,7 +23,7 @@ const helpText = `
|
|
|
23
23
|
</a>
|
|
24
24
|
in order to get help.
|
|
25
25
|
</p>`;
|
|
26
|
-
const phoneNum =
|
|
26
|
+
const phoneNum = "- 89 241 5401";
|
|
27
27
|
|
|
28
28
|
const dmcaImg = (
|
|
29
29
|
<img
|
|
@@ -57,18 +57,21 @@ let footerLogos;
|
|
|
57
57
|
|
|
58
58
|
beforeEach(() => {
|
|
59
59
|
data = getFooterData();
|
|
60
|
-
footerMenu = getExtraField(data?.extra_fields,
|
|
61
|
-
asSeenOn = getExtraField(data?.extra_fields,
|
|
62
|
-
gamblingText = getExtraField(data?.extra_fields,
|
|
63
|
-
socialIcons = getExtraField(data?.extra_fields,
|
|
64
|
-
copyrightDisclaimer = getExtraField(
|
|
65
|
-
|
|
60
|
+
footerMenu = getExtraField(data?.extra_fields, "links");
|
|
61
|
+
asSeenOn = getExtraField(data?.extra_fields, "as_seen_on");
|
|
62
|
+
gamblingText = getExtraField(data?.extra_fields, "gambling_text");
|
|
63
|
+
socialIcons = getExtraField(data?.extra_fields, "social_icons");
|
|
64
|
+
copyrightDisclaimer = getExtraField(
|
|
65
|
+
data.extra_fields,
|
|
66
|
+
"copyright_disclaimer"
|
|
67
|
+
);
|
|
68
|
+
footerLogos = getExtraField(data?.extra_fields, "logos");
|
|
66
69
|
|
|
67
70
|
props = {
|
|
68
71
|
section: data,
|
|
69
|
-
template:
|
|
72
|
+
template: "default",
|
|
70
73
|
hasFooterLinks: false,
|
|
71
|
-
footerTemplate:
|
|
74
|
+
footerTemplate: "template_one",
|
|
72
75
|
showLinks: true,
|
|
73
76
|
copyrightDisclaimer,
|
|
74
77
|
footerLogos,
|
|
@@ -78,88 +81,100 @@ beforeEach(() => {
|
|
|
78
81
|
socialIcons,
|
|
79
82
|
hasDisclaimer: true,
|
|
80
83
|
showCopyright: true,
|
|
81
|
-
logo:
|
|
84
|
+
logo: "/images/logo.svg",
|
|
82
85
|
securityIcon: <Security />,
|
|
83
86
|
helpText,
|
|
84
87
|
phoneNum,
|
|
85
88
|
dmcaImg,
|
|
86
89
|
};
|
|
87
90
|
});
|
|
88
|
-
describe(
|
|
89
|
-
test(
|
|
91
|
+
describe("Show template one", () => {
|
|
92
|
+
test("render with props", () => {
|
|
90
93
|
const { container } = renderComponent(props);
|
|
91
94
|
expect(container).toBeTruthy();
|
|
92
95
|
});
|
|
93
|
-
test(
|
|
96
|
+
test("show correct template ", async () => {
|
|
94
97
|
const { container } = renderComponent(props);
|
|
95
98
|
await waitFor(() => {
|
|
96
|
-
expect(container.querySelectorAll(
|
|
99
|
+
expect(container.querySelectorAll(".footer.templateThree").length).toBe(
|
|
100
|
+
1
|
|
101
|
+
);
|
|
97
102
|
});
|
|
98
103
|
});
|
|
99
|
-
test(
|
|
104
|
+
test("show as seen on", async () => {
|
|
100
105
|
const { container, getByText } = renderComponent(props);
|
|
101
106
|
await waitFor(() => {
|
|
102
|
-
expect(container.querySelectorAll(
|
|
103
|
-
expect(container.querySelectorAll(
|
|
107
|
+
expect(container.querySelectorAll("footer > div")).toHaveLength(2);
|
|
108
|
+
expect(container.querySelectorAll(".asSeenOn")).toHaveLength(1);
|
|
104
109
|
|
|
105
110
|
// show correct title
|
|
106
|
-
expect(getByText(
|
|
111
|
+
expect(getByText("As Seen On:")).toHaveTextContent(`${asSeenOn.title}:`);
|
|
107
112
|
|
|
108
113
|
// show correct number of logos
|
|
109
|
-
expect(container.querySelectorAll(
|
|
114
|
+
expect(container.querySelectorAll(".asSeenOn li")).toHaveLength(3);
|
|
110
115
|
});
|
|
111
116
|
});
|
|
112
|
-
test(
|
|
117
|
+
test("hide as seen on", async () => {
|
|
113
118
|
props = {
|
|
114
119
|
...props,
|
|
115
120
|
asSeenOn: null,
|
|
116
121
|
};
|
|
117
122
|
const { container } = renderComponent(props);
|
|
118
123
|
await waitFor(() => {
|
|
119
|
-
expect(container.querySelectorAll(
|
|
124
|
+
expect(container.querySelectorAll("footer > div")).toHaveLength(1);
|
|
120
125
|
});
|
|
121
126
|
});
|
|
122
|
-
test(
|
|
127
|
+
test("render menu list", async () => {
|
|
123
128
|
const { container, getByText } = renderComponent(props);
|
|
124
129
|
|
|
125
130
|
await waitFor(() => {
|
|
126
|
-
expect(container.querySelectorAll(
|
|
127
|
-
expect(container.querySelectorAll(
|
|
128
|
-
expect(container.querySelectorAll(
|
|
131
|
+
expect(container.querySelectorAll(".topPart")).toHaveLength(1);
|
|
132
|
+
expect(container.querySelectorAll(".links")).toHaveLength(1);
|
|
133
|
+
expect(container.querySelectorAll(".links ul")).toHaveLength(
|
|
134
|
+
footerMenu.children.length
|
|
135
|
+
);
|
|
129
136
|
|
|
130
137
|
// show correct title
|
|
131
138
|
expect(getByText(footerMenu.children[0].title)).toBeTruthy();
|
|
132
139
|
expect(getByText(footerMenu.children[2].title)).toBeTruthy();
|
|
133
140
|
|
|
134
141
|
// show correct number of child lists
|
|
135
|
-
expect(
|
|
136
|
-
|
|
142
|
+
expect(
|
|
143
|
+
getByText(footerMenu.children[1].title).closest("ul").children
|
|
144
|
+
).toHaveLength(7);
|
|
145
|
+
expect(
|
|
146
|
+
getByText(footerMenu.children[2].title).closest("ul").children
|
|
147
|
+
).toHaveLength(6);
|
|
137
148
|
|
|
138
149
|
// show correct url
|
|
139
150
|
expect(
|
|
140
|
-
getByText(footerMenu.children[1].children[0].title)
|
|
151
|
+
getByText(footerMenu.children[1].children[0].title)
|
|
152
|
+
.closest("a")
|
|
153
|
+
.getAttribute("href")
|
|
141
154
|
).toEqual(`/${footerMenu.children[1].children[0].value}`);
|
|
142
155
|
expect(
|
|
143
|
-
getByText(footerMenu.children[2].children[2].title)
|
|
156
|
+
getByText(footerMenu.children[2].children[2].title)
|
|
157
|
+
.closest("a")
|
|
158
|
+
.getAttribute("href")
|
|
144
159
|
).toEqual(`/${footerMenu.children[2].children[2].value}`);
|
|
145
160
|
});
|
|
146
161
|
});
|
|
147
|
-
test(
|
|
162
|
+
test("hide menu list", async () => {
|
|
148
163
|
props = {
|
|
149
164
|
...props,
|
|
150
165
|
showLinks: null,
|
|
151
166
|
};
|
|
152
167
|
const { container } = renderComponent(props);
|
|
153
168
|
await waitFor(() => {
|
|
154
|
-
expect(container.querySelectorAll(
|
|
155
|
-
expect(container.querySelectorAll(
|
|
169
|
+
expect(container.querySelectorAll(".links")).toHaveLength(0);
|
|
170
|
+
expect(container.querySelectorAll(".links ul")).toHaveLength(0);
|
|
156
171
|
});
|
|
157
172
|
});
|
|
158
|
-
test(
|
|
173
|
+
test("hide gambling text", async () => {
|
|
159
174
|
const { container } = renderComponent(props);
|
|
160
175
|
await waitFor(() => {
|
|
161
|
-
expect(container.querySelectorAll(
|
|
162
|
-
expect(container.querySelectorAll(
|
|
176
|
+
expect(container.querySelectorAll(".license > div")).toHaveLength(4);
|
|
177
|
+
expect(container.querySelectorAll(".gamblingText")).toHaveLength(1);
|
|
163
178
|
});
|
|
164
179
|
});
|
|
165
180
|
// test('correct security text', async () => {
|
|
@@ -172,79 +187,89 @@ describe('Show template one', () => {
|
|
|
172
187
|
// ).toContain('securityText');
|
|
173
188
|
// });
|
|
174
189
|
// });
|
|
175
|
-
test(
|
|
190
|
+
test("footer middle part does not show another as seen on", async () => {
|
|
176
191
|
const { container } = renderComponent(props);
|
|
177
192
|
await waitFor(() => {
|
|
178
|
-
expect(container.querySelectorAll(
|
|
179
|
-
|
|
193
|
+
expect(container.querySelectorAll(".footerHotline > div")).toHaveLength(
|
|
194
|
+
1
|
|
195
|
+
);
|
|
196
|
+
expect(
|
|
197
|
+
container.querySelectorAll(".footerHotline .asSeenOn")
|
|
198
|
+
).toHaveLength(0);
|
|
180
199
|
});
|
|
181
200
|
});
|
|
182
|
-
test(
|
|
201
|
+
test("correct help text", async () => {
|
|
183
202
|
const { container } = renderComponent(props);
|
|
184
203
|
await waitFor(() => {
|
|
185
|
-
expect(container.querySelector(
|
|
186
|
-
expect(container.querySelector(
|
|
204
|
+
expect(container.querySelector(".helpText")).toBeTruthy();
|
|
205
|
+
expect(container.querySelector(".helpText").innerHTML).toBe(helpText);
|
|
187
206
|
});
|
|
188
207
|
});
|
|
189
|
-
test(
|
|
208
|
+
test("correct phone number", async () => {
|
|
190
209
|
const { getByText, container } = renderComponent(props);
|
|
191
210
|
await waitFor(() => {
|
|
192
211
|
expect(getByText(phoneNum)).toBeTruthy();
|
|
193
|
-
expect(
|
|
212
|
+
expect(
|
|
213
|
+
container.querySelector(".phoneNum").innerHTML.split("</svg>")[1]
|
|
214
|
+
).toBe(phoneNum);
|
|
194
215
|
});
|
|
195
216
|
});
|
|
196
|
-
test(
|
|
217
|
+
test("show copyright disclaimer", async () => {
|
|
197
218
|
const { container } = renderComponent(props);
|
|
198
219
|
await waitFor(() => {
|
|
199
|
-
expect(container.querySelectorAll(
|
|
220
|
+
expect(container.querySelectorAll(".copyrightDisclaimer")).toBeTruthy();
|
|
200
221
|
|
|
201
|
-
expect(container.querySelector(
|
|
222
|
+
expect(container.querySelector(".copyrightDisclaimer").innerHTML).toBe(
|
|
223
|
+
copyrightDisclaimer
|
|
224
|
+
);
|
|
202
225
|
});
|
|
203
226
|
});
|
|
204
|
-
test(
|
|
227
|
+
test("show copyright", async () => {
|
|
205
228
|
const { container } = renderComponent(props);
|
|
206
229
|
await waitFor(() => {
|
|
207
|
-
expect(container.querySelector(
|
|
230
|
+
expect(container.querySelector(".copyrightText")).toHaveTextContent(
|
|
231
|
+
copyrightText()
|
|
232
|
+
);
|
|
208
233
|
});
|
|
209
234
|
});
|
|
210
|
-
test(
|
|
235
|
+
test("hide copyright", async () => {
|
|
211
236
|
props = {
|
|
212
237
|
...props,
|
|
213
238
|
showCopyright: false,
|
|
214
239
|
};
|
|
215
240
|
const { container } = renderComponent(props);
|
|
216
241
|
await waitFor(() => {
|
|
217
|
-
expect(container.querySelector(
|
|
242
|
+
expect(container.querySelector(".copyrightText")).toBeFalsy();
|
|
218
243
|
});
|
|
219
244
|
});
|
|
220
|
-
test(
|
|
245
|
+
test("show dmca image", async () => {
|
|
221
246
|
// eslint-disable-next-line global-require
|
|
222
|
-
const func = require(
|
|
247
|
+
const func = require("~helpers/device-detect");
|
|
223
248
|
func.isNativeImageLazyLoadingSupported = jest.fn(() => true);
|
|
224
249
|
props = {
|
|
225
250
|
...props,
|
|
226
251
|
showCopyright: false,
|
|
227
|
-
dmcaImage:
|
|
252
|
+
dmcaImage: "/images/dmca.png",
|
|
228
253
|
};
|
|
229
254
|
const { container } = renderComponent(props);
|
|
230
|
-
expect(
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
);
|
|
255
|
+
expect(
|
|
256
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
257
|
+
).toBeTruthy();
|
|
258
|
+
expect(
|
|
259
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
260
|
+
).toHaveAttribute("src", "/images/dmca.png");
|
|
261
|
+
expect(
|
|
262
|
+
container.querySelector(".logos > a").querySelector("img")
|
|
263
|
+
).toHaveAttribute("loading", "lazy");
|
|
239
264
|
});
|
|
240
|
-
test(
|
|
265
|
+
test("hide dmca image", async () => {
|
|
241
266
|
props = {
|
|
242
267
|
...props,
|
|
243
268
|
hasDisclaimer: false,
|
|
244
269
|
};
|
|
245
270
|
const { container } = renderComponent(props);
|
|
246
271
|
await waitFor(() => {
|
|
247
|
-
expect(container.querySelector(
|
|
272
|
+
expect(container.querySelector(".logos > a")).toBeFalsy();
|
|
248
273
|
});
|
|
249
274
|
});
|
|
250
275
|
});
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
PRIMARY_STORY,
|
|
8
8
|
ArgsTable,
|
|
9
9
|
} from "@storybook/addon-docs/blocks";
|
|
10
|
-
import { getExtraField } from "
|
|
10
|
+
import { getExtraField } from "~helpers/getters";
|
|
11
11
|
import getFooterData from "../../../../../../tests/factories/modules/footer.factory";
|
|
12
|
-
import dmca from
|
|
12
|
+
import dmca from "../../../../../../static/images/dmca.png";
|
|
13
13
|
import logo from "../../../../../../static/images/logo.svg";
|
|
14
|
-
import Security from
|
|
14
|
+
import Security from "~images/icons/security";
|
|
15
15
|
import TemplateTwo from ".";
|
|
16
16
|
|
|
17
17
|
const footerData = getFooterData();
|
|
@@ -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
|
});
|