gatsby-core-theme 44.10.0 → 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.
Files changed (47) hide show
  1. package/.ci.yml +1 -0
  2. package/CHANGELOG.md +97 -0
  3. package/gatsby-config.js +3 -3
  4. package/gatsby-node.mjs +1 -0
  5. package/package.json +1 -1
  6. package/src/components/app-ssr.js +16 -18
  7. package/src/components/atoms/admin/bar/index.js +6 -2
  8. package/src/components/atoms/admin/button/index.js +4 -3
  9. package/src/components/atoms/contact-form/index.js +2 -2
  10. package/src/components/atoms/market-dropdown/index.js +7 -9
  11. package/src/components/atoms/notifications/index.js +2 -3
  12. package/src/components/atoms/ratings/index.js +7 -6
  13. package/src/components/atoms/review-link/index.js +16 -11
  14. package/src/components/atoms/search/autocomplete/article/index.js +13 -9
  15. package/src/components/atoms/search/autocomplete/default/index.js +13 -9
  16. package/src/components/atoms/search/autocomplete/game/index.js +22 -12
  17. package/src/components/atoms/search/autocomplete/operator/index.js +26 -18
  18. package/src/components/molecules/bonus/template-one/index.js +15 -2
  19. package/src/components/molecules/bonus/template-two/index.js +7 -1
  20. package/src/components/molecules/cookie-modal/index.js +1 -1
  21. package/src/components/molecules/floating-area/index.js +6 -12
  22. package/src/components/molecules/footer/index.js +35 -27
  23. package/src/components/molecules/footer/variants/template-one/template-one.stories.js +70 -67
  24. package/src/components/molecules/footer/variants/template-one/template-one.test.js +92 -69
  25. package/src/components/molecules/footer/variants/template-three/template-three.stories.js +4 -4
  26. package/src/components/molecules/footer/variants/template-three/template-three.test.js +98 -73
  27. package/src/components/molecules/footer/variants/template-two/template-two.stories.js +3 -3
  28. package/src/components/molecules/footer/variants/template-two/template-two.test.js +96 -73
  29. package/src/components/molecules/header/variants/default/template-one/index.js +15 -13
  30. package/src/components/molecules/header/variants/default/template-one/template-one.test.js +37 -29
  31. package/src/components/molecules/header/variants/slot/template-one/templateone.test.js +32 -29
  32. package/src/components/molecules/leave-comment-form/index.js +90 -79
  33. package/src/components/molecules/main/index.js +5 -7
  34. package/src/components/molecules/menu/index.js +28 -30
  35. package/src/components/molecules/newsletter/form/index.js +2 -2
  36. package/src/components/molecules/newsletter/index.js +23 -19
  37. package/src/components/molecules/tnc/index.js +4 -2
  38. package/src/components/organisms/anchor/template-two/index.js +33 -18
  39. package/src/components/organisms/footer-navigation/index.js +10 -9
  40. package/src/components/organisms/navigation/index.js +12 -19
  41. package/src/constants/ratings-constant.js +7 -9
  42. package/src/helpers/getters.mjs +3 -3
  43. package/src/helpers/processImageNode.js +38 -30
  44. package/src/helpers/processImageNode.test.js +33 -24
  45. package/src/helpers/replaceMedia.js +2 -2
  46. package/src/resolver/games.mjs +1 -1
  47. package/src/resolver/operators.mjs +23 -13
@@ -1,15 +1,15 @@
1
1
  /* eslint-disable no-restricted-syntax */
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 'gatsby-core-theme/src/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 '.';
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: 'We only list 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 = '- 89 241 5401';
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, '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(data.extra_fields, 'copyright_disclaimer');
64
- footerLogos = getExtraField(data?.extra_fields, 'logos');
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: 'default',
71
+ template: "default",
69
72
  hasFooterLinks: false,
70
- footerTemplate: 'template_one',
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: '/images/logo.svg',
83
+ logo: "/images/logo.svg",
81
84
  securityIcon: <Security />,
82
85
  helpText,
83
86
  phoneNum,
84
87
  dmcaImg,
85
88
  };
86
89
  });
87
- describe('Show template one', () => {
88
- test('render with props', () => {
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('show correct template ', async () => {
95
+ test("show correct template ", async () => {
93
96
  const { container } = renderComponent(props);
94
97
  await waitFor(() => {
95
- expect(container.querySelectorAll('.footer.templateTwo').length).toBe(1);
98
+ expect(container.querySelectorAll(".footer.templateTwo").length).toBe(1);
96
99
  });
97
100
  });
98
- test('show as seen on in the middle, not top', async () => {
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('footer > div')).toHaveLength(1);
102
- expect(container.querySelectorAll('.asSeenOn')).toHaveLength(1);
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('As Seen On:')).toHaveTextContent(`${asSeenOn.title}:`);
108
+ expect(getByText("As Seen On:")).toHaveTextContent(`${asSeenOn.title}:`);
106
109
 
107
110
  // show correct number of logos
108
- expect(container.querySelectorAll('.asSeenOn li')).toHaveLength(3);
111
+ expect(container.querySelectorAll(".asSeenOn li")).toHaveLength(3);
109
112
  });
110
113
  });
111
- test('footer middle part shows as seen on', async () => {
114
+ test("footer middle part shows as seen on", async () => {
112
115
  const { container } = renderComponent(props);
113
116
  await waitFor(() => {
114
- expect(container.querySelectorAll('.footerHotline > div')).toHaveLength(2);
115
- expect(container.querySelectorAll('.footerHotline .asSeenOn')).toHaveLength(1);
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('hide as seen on', async () => {
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('.asSeenOn')).toHaveLength(0);
132
+ expect(container.querySelectorAll(".asSeenOn")).toHaveLength(0);
126
133
  });
127
134
  });
128
- test('render menu list', async () => {
135
+ test("render menu list", async () => {
129
136
  const { container, getByText } = renderComponent(props);
130
137
 
131
138
  await waitFor(() => {
132
- expect(container.querySelectorAll('.topPart')).toHaveLength(1);
133
- expect(container.querySelectorAll('.links')).toHaveLength(1);
134
- expect(container.querySelectorAll('.links ul')).toHaveLength(footerMenu.children.length);
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(getByText(footerMenu.children[1].title).closest('ul').children).toHaveLength(7);
142
- expect(getByText(footerMenu.children[2].title).closest('ul').children).toHaveLength(6);
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).closest('a').getAttribute('href')
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).closest('a').getAttribute('href')
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('hide menu list', async () => {
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('.links')).toHaveLength(0);
161
- expect(container.querySelectorAll('.links ul')).toHaveLength(0);
177
+ expect(container.querySelectorAll(".links")).toHaveLength(0);
178
+ expect(container.querySelectorAll(".links ul")).toHaveLength(0);
162
179
  });
163
180
  });
164
- test('show gambling text', async () => {
181
+ test("show gambling text", async () => {
165
182
  const { container } = renderComponent(props);
166
183
  await waitFor(() => {
167
- expect(container.querySelectorAll('.license > div')).toHaveLength(4);
168
- expect(container.querySelectorAll('.gamblingText')).toHaveLength(1);
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('correct help text', async () => {
198
+ test("correct help text", async () => {
182
199
  const { container } = renderComponent(props);
183
200
  await waitFor(() => {
184
- expect(container.querySelector('.helpText')).toBeTruthy();
185
- expect(container.querySelector('.helpText').innerHTML).toBe(helpText);
201
+ expect(container.querySelector(".helpText")).toBeTruthy();
202
+ expect(container.querySelector(".helpText").innerHTML).toBe(helpText);
186
203
  });
187
204
  });
188
- test('correct phone number', async () => {
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(container.querySelector('.phoneNum').innerHTML.split('</svg>')[1]).toBe(phoneNum);
209
+ expect(
210
+ container.querySelector(".phoneNum").innerHTML.split("</svg>")[1]
211
+ ).toBe(phoneNum);
193
212
  });
194
213
  });
195
- test('show copyright disclaimer', async () => {
214
+ test("show copyright disclaimer", async () => {
196
215
  const { container } = renderComponent(props);
197
216
  await waitFor(() => {
198
- expect(container.querySelectorAll('.copyrightDisclaimer')).toBeTruthy();
217
+ expect(container.querySelectorAll(".copyrightDisclaimer")).toBeTruthy();
199
218
 
200
- expect(container.querySelector('.copyrightDisclaimer').innerHTML).toBe(copyrightDisclaimer);
219
+ expect(container.querySelector(".copyrightDisclaimer").innerHTML).toBe(
220
+ copyrightDisclaimer
221
+ );
201
222
  });
202
223
  });
203
- test('show copyright', async () => {
224
+ test("show copyright", async () => {
204
225
  const { container } = renderComponent(props);
205
226
  await waitFor(() => {
206
- expect(container.querySelector('.copyrightText')).toHaveTextContent(copyrightText());
227
+ expect(container.querySelector(".copyrightText")).toHaveTextContent(
228
+ copyrightText()
229
+ );
207
230
  });
208
231
  });
209
- test('hide copyright', async () => {
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('.copyrightText')).toBeFalsy();
239
+ expect(container.querySelector(".copyrightText")).toBeFalsy();
217
240
  });
218
241
  });
219
- test('show dmca image', async () => {
242
+ test("show dmca image", async () => {
220
243
  // eslint-disable-next-line global-require
221
- const func = require('gatsby-core-theme/src/helpers/device-detect');
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: '/images/dmca.png',
249
+ dmcaImage: "/images/dmca.png",
227
250
  };
228
251
  const { container } = renderComponent(props);
229
- expect(container.querySelector('.logos > a').querySelector('img')).toBeTruthy();
230
- expect(container.querySelector('.logos > a').querySelector('img')).toHaveAttribute(
231
- 'src',
232
- '/images/dmca.png'
233
- );
234
- expect(container.querySelector('.logos > a').querySelector('img')).toHaveAttribute(
235
- 'loading',
236
- 'lazy'
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('hide dmca image', async () => {
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('.logos > a')).toBeFalsy();
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 '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';
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, 'link');
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 && <VariableComponent page={page} className={styles.variable} />}
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 'react';
2
- import { render, cleanup } from '@testing-library/react';
3
- import '@testing-library/jest-dom/extend-expect';
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 'gatsby-core-theme/src/helpers/getters';
6
- import MainProvider from '~context/MainProvider';
7
- import getPageData from '../../../../../../../tests/factories/pages/default.factory';
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: '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('Show template one', () => {
39
- test('render with props', () => {
38
+ describe("Show template one", () => {
39
+ test("render with props", () => {
40
40
  const { container } = renderComponent(data);
41
- expect(container.querySelector('.templateOne')).toBeTruthy();
41
+ // eslint-disable-next-line no-restricted-syntax
42
+ expect(container.querySelector(".templateOne")).toBeTruthy();
42
43
  });
43
- test('show correct title', () => {
44
+ test("show correct title", () => {
44
45
  const { container } = renderComponent(data);
45
- expect(container.querySelector('.headerContainer').querySelector('h1')).toBeTruthy();
46
- expect(container.querySelector('.headerContainer').querySelector('h1').innerHTML).toEqual(
47
- data.title
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('show correct description', () => {
54
+ test("show correct description", () => {
51
55
  const { container } = renderComponent(data);
52
- expect(container.querySelector('.headerContainer').querySelector('div').innerHTML).toEqual(
53
- data.description
54
- );
56
+ expect(
57
+ container.querySelector(".headerContainer").querySelector("div").innerHTML
58
+ ).toEqual(data.description);
55
59
  });
56
- test('show correct url', () => {
60
+ test("show correct url", () => {
57
61
  const { container } = renderComponent(data);
58
62
  expect(
59
- container.querySelector('.headerContainer').querySelector('a').innerHTML.split('<svg')[0]
60
- ).toEqual(getExtraField(data?.extra_fields, 'link'));
63
+ container
64
+ .querySelector(".headerContainer")
65
+ .querySelector("a")
66
+ .innerHTML.split("<svg")[0]
67
+ ).toEqual(getExtraField(data?.extra_fields, "link"));
61
68
  });
62
- test('show correct image', () => {
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('gatsby-core-theme/src/helpers/device-detect');
73
+ const func = require("~helpers/device-detect");
67
74
  func.isNativeImageLazyLoadingSupported = jest.fn(() => true);
68
75
  const { container } = renderComponent(data);
69
76
 
70
- expect(container.querySelector('img')).toBeTruthy();
71
- expect(container.querySelector('img')).toHaveAttribute(
72
- 'src',
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('img')).toHaveAttribute('loading', 'eager');
83
+ expect(container.querySelector("img")).toHaveAttribute("loading", "eager");
76
84
  });
77
85
  });
78
86
  afterEach(() => {
@@ -1,47 +1,50 @@
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 'gatsby-core-theme/src/helpers/getters';
5
- import getPageData from '../../../../../../../tests/factories/pages/slot';
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('summary component', () => {
9
- test('render', () => {
10
- const { container, getByText, getByRole } = render(<TemplateOne page={getPageData()} />);
8
+ describe("summary component", () => {
9
+ test("render", () => {
10
+ const { container, getByText, getByRole } = render(
11
+ <TemplateOne page={getPageData()} />
12
+ );
11
13
 
12
- expect(container.querySelectorAll('div.parentContainer')).toHaveLength(1);
14
+ expect(container.querySelectorAll("div.parentContainer")).toHaveLength(1);
13
15
 
14
- const div = getByText('The Slot Title');
16
+ const div = getByText("The Slot Title");
15
17
  expect(div).toBeInTheDocument();
16
18
 
17
- const h1 = getByRole('heading', { level: 1 });
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: 'Halloween',
25
+ name: "Halloween",
24
26
  thumbnail_filename_object: {
25
- filename: 'image.jpg',
26
- alt: 'Halloween',
27
+ filename: "image.jpg",
28
+ alt: "Halloween",
27
29
  },
28
30
  },
29
31
  sections: {
30
32
  header: {
31
33
  modules: [
32
34
  {
33
- name: 'bonus',
35
+ name: "bonus",
34
36
  value: {
35
37
  bonuses: {
36
38
  main: {
37
- one_liner: '20 Free Spins No Deposit Bonus + 300% & 555 Spins Welcome Bonus',
39
+ one_liner:
40
+ "20 Free Spins No Deposit Bonus + 300% & 555 Spins Welcome Bonus",
38
41
  },
39
42
  },
40
43
  logo: {
41
- filename: '1651670485/davincis-gold-casino-logo.png',
44
+ filename: "1651670485/davincis-gold-casino-logo.png",
42
45
  },
43
- links: { main: 'test' },
44
- status: 'active',
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('SlotHeader', () => {
53
- it('should render the image', async () => {
55
+ describe("SlotHeader", () => {
56
+ it("should render the image", async () => {
54
57
  render(<TemplateOne page={page} />);
55
- const img = screen.getByAltText('Halloween');
58
+ const img = screen.getByAltText("Halloween");
56
59
  await waitFor(() => expect(img).toBeVisible());
57
60
  expect(img).toHaveAttribute(
58
- 'src',
61
+ "src",
59
62
  imagePrettyUrl(page.relation?.logo?.filename, 170, 170)
60
63
  );
61
- expect(img).toHaveAttribute('width', '170');
62
- expect(img).toHaveAttribute('height', '170');
64
+ expect(img).toHaveAttribute("width", "170");
65
+ expect(img).toHaveAttribute("height", "170");
63
66
  });
64
67
 
65
- it('should render the headerBonus logo', async () => {
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('Welcome Bonus');
72
+ const bonusText = screen.getByText("Welcome Bonus");
70
73
  expect(bonusText).toBeInTheDocument();
71
74
  });
72
75
  });
73
76
 
74
- it('should render the headerBonus one-liner', () => {
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();