gatsby-core-theme 3.0.0 → 4.0.0

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 (81) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/__mocks__/gatsby.js +16 -4
  3. package/gatsby-node.esm.js +7 -1
  4. package/jest.config.js +8 -1
  5. package/package.json +1 -1
  6. package/src/components/app.js +1 -17
  7. package/src/components/atoms/author/author.test.js +12 -5
  8. package/src/components/atoms/author-box/index.js +9 -11
  9. package/src/components/atoms/breadcrumbs/breadcrumbs.test.js +8 -0
  10. package/src/components/atoms/carousel/pagination-item/pagination-item.test.js +18 -3
  11. package/src/components/atoms/collapse/collapse.test.js +10 -0
  12. package/src/components/atoms/collapse/index.js +3 -1
  13. package/src/components/atoms/content-box/content-box.test.js +9 -6
  14. package/src/components/atoms/content-box/index.js +13 -12
  15. package/src/components/atoms/custom-select/index.js +31 -30
  16. package/src/components/atoms/disclaimer/disclaimer.test.js +16 -1
  17. package/src/components/atoms/iframe/iframe.module.scss +3 -0
  18. package/src/components/atoms/iframe/iframe.test.js +6 -0
  19. package/src/components/atoms/image/image.test.js +19 -6
  20. package/src/components/atoms/image/index.js +2 -4
  21. package/src/components/atoms/info-grid/index.js +10 -12
  22. package/src/components/atoms/label/index.js +2 -2
  23. package/src/components/atoms/label/label.test.js +4 -0
  24. package/src/components/atoms/module-title/index.js +9 -9
  25. package/src/components/atoms/module-title/module-title.test.js +76 -0
  26. package/src/components/atoms/open-graph/open-graph.test.js +34 -5
  27. package/src/components/atoms/operator-cta/operator-cta.test.js +26 -3
  28. package/src/components/atoms/scroll-to-top/scroll-to-top.test.js +6 -0
  29. package/src/components/atoms/search/autocomplete/operator.js +1 -1
  30. package/src/components/atoms/sitemap/index.js +1 -1
  31. package/src/components/atoms/spotlights/index.js +55 -53
  32. package/src/components/atoms/spotlights/spotlights.module.scss +25 -37
  33. package/src/components/atoms/spotlights/spotlights.test.js +13 -15
  34. package/src/components/molecules/content/content.test.js +127 -0
  35. package/src/components/molecules/content/index.js +0 -1
  36. package/src/components/molecules/header/header.test.js +6 -0
  37. package/src/components/molecules/main/main.test.js +48 -12
  38. package/src/components/molecules/menu/menu.test.js +27 -0
  39. package/src/components/molecules/module/module.test.js +134 -0
  40. package/src/components/molecules/operator-banner/operator-banner.test.js +7 -1
  41. package/src/components/molecules/pagination/pagination-with-midpoints.module.scss +48 -49
  42. package/src/components/organisms/cookie-consent/cookie-consent.test.js +7 -1
  43. package/src/components/organisms/form/form.test.js +21 -0
  44. package/src/components/organisms/form/index.js +5 -1
  45. package/src/components/organisms/navigation/index.js +9 -1
  46. package/src/components/organisms/search/index.js +0 -1
  47. package/src/components/organisms/toplist/list/index.js +1 -1
  48. package/src/components/organisms/toplist/list/list.test.js +30 -0
  49. package/src/components/pages/body/index.js +4 -6
  50. package/src/components/pages/tracker/index.js +1 -1
  51. package/src/constants/settings.js +1 -1
  52. package/src/helpers/getters.js +1 -6
  53. package/src/helpers/getters.test.js +1 -3
  54. package/src/helpers/processor/common.test.js +7 -1
  55. package/src/helpers/processor/index.js +2 -3
  56. package/src/helpers/processor/index.test.js +21 -0
  57. package/src/helpers/schema.js +1 -1
  58. package/src/helpers/schema.test.js +4 -4
  59. package/src/hooks/gatsby-img/index.js +1 -1
  60. package/src/hooks/lazy-image/index.js +1 -1
  61. package/src/hooks/lazy-image/lazy-image.test.js +39 -0
  62. package/src/hooks/lazy-picture/index.js +1 -1
  63. package/src/hooks/link/link.test.js +42 -1
  64. package/src/hooks/tabs/tab/tab.test.js +41 -0
  65. package/src/styles/utils/variables/_main.scss +3 -1
  66. package/tests/envVars.js +1 -1
  67. package/tests/factories/modules/content.factory.js +6 -3
  68. package/tests/factories/modules/modules.factory.js +152 -0
  69. package/tests/factories/modules/schema.factory.js +87 -0
  70. package/tests/factories/pages/list.factory.js +2 -1
  71. package/tests/factories/pages/pages.factory.js +192 -0
  72. package/tests/factories/sections/header.factory.js +8 -2
  73. package/src/components/atoms/logo/index.js +0 -36
  74. package/src/components/atoms/logo/logo.module.scss +0 -4
  75. package/src/components/atoms/logo/logo.stories.js +0 -57
  76. package/src/components/atoms/logo/logo.test.js +0 -30
  77. package/src/components/molecules/section/index.js +0 -24
  78. package/src/components/molecules/section/section.test.js +0 -16
  79. package/src/components/molecules/sidebar/index.js +0 -25
  80. package/src/components/molecules/sidebar/sidebar.module.scss +0 -3
  81. package/src/components/molecules/sidebar/sidebar.test.js +0 -30
@@ -33,6 +33,7 @@ const Navigation = ({
33
33
  },
34
34
  sticky = true,
35
35
  template,
36
+ children,
36
37
  customStyles,
37
38
  }) => {
38
39
  const navRef = useRef(React.createRef());
@@ -69,7 +70,12 @@ const Navigation = ({
69
70
  to="/"
70
71
  onClick={onClickHandler}
71
72
  >
72
- <img alt="logo" src={logo} width={logoWidth} height={logoHeight} />
73
+ <img
74
+ alt={process.env.GATSBY_SITE_NAME}
75
+ src={logo}
76
+ width={logoWidth}
77
+ height={logoHeight}
78
+ />
73
79
  </Link>
74
80
  {showMenu && (
75
81
  <>
@@ -85,6 +91,7 @@ const Navigation = ({
85
91
  )}
86
92
  </NavigationProvider>
87
93
  </nav>
94
+ {children}
88
95
  </ConditionalWrapper>
89
96
  );
90
97
  };
@@ -110,6 +117,7 @@ Navigation.propTypes = {
110
117
  searchIcon: PropTypes.string,
111
118
  hasSearch: PropTypes.bool,
112
119
  menu: PropTypes.string,
120
+ children: PropTypes.node,
113
121
  options: PropTypes.shape({
114
122
  mobile: PropTypes.shape({
115
123
  animation: PropTypes.string,
@@ -11,7 +11,6 @@ import styles from './search.module.scss';
11
11
 
12
12
  const SearchForm = ({ className, searchIcon, iconWidth = 24, iconHeight = 24 }) => {
13
13
  const { showSearch, setShowSearch, setShowMenu, showMenu } = useContext(NavigationContext);
14
-
15
14
  const Search = showSearch ? loadable(() => import('~molecules/search')) : <></>;
16
15
  const Operator = showSearch ? (
17
16
  loadable(() => import('~atoms/search/autocomplete/operator'))
@@ -88,7 +88,7 @@ List.propTypes = {
88
88
  one_liner: PropTypes.string,
89
89
  }),
90
90
  CustomRow: PropTypes.func,
91
- hasLoadMoreButton: PropTypes.bool,
91
+ hasLoadMoreButton: PropTypes.string,
92
92
  initItemsCount: PropTypes.string,
93
93
  loadItemsCount: PropTypes.string,
94
94
  pageTemplate: PropTypes.string,
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { render, cleanup, fireEvent } from '@testing-library/react';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+ import { getListToplistItem } from '~tests/factories/modules/toplist.factory';
5
+
6
+ import List from '.';
7
+
8
+ describe('List', () => {
9
+ test('render list with Load more', () => {
10
+ const { container, getByText } = render(
11
+ <List
12
+ toplist={{ items: getListToplistItem(15) }}
13
+ loadItemsCount="5"
14
+ initItemsCount="5"
15
+ hasLoadMoreButton="1"
16
+ />
17
+ );
18
+ expect(getByText('Load More')).toBeTruthy();
19
+ const button = container.querySelector('button');
20
+ fireEvent.click(button);
21
+ });
22
+
23
+ test('render list without Load more', () => {
24
+ const { container } = render(<List toplist={{ items: getListToplistItem(5) }} />);
25
+ expect(container.querySelector('button')).toBeFalsy();
26
+ });
27
+ });
28
+ afterEach(() => {
29
+ cleanup();
30
+ });
@@ -1,7 +1,7 @@
1
+ /* eslint-disable no-useless-concat */
1
2
  /* eslint-disable no-restricted-globals */
2
3
  import React, { useEffect } from 'react';
3
4
  import PropTypes from 'prop-types';
4
- import loadable from '@loadable/component';
5
5
  import { getSection } from '~helpers/getters';
6
6
  import Header from '~molecules/header';
7
7
  import Main from '~molecules/main';
@@ -18,7 +18,6 @@ function Body({ pageContext, children }) {
18
18
  const main = getBodySection('main');
19
19
  const navigation = getBodySection('navigation');
20
20
  const footer = getBodySection('footer');
21
- const sidebar = getBodySection('sidebar');
22
21
 
23
22
  useEffect(() => {
24
23
  if (!process.env.CANARY_TOKEN) {
@@ -26,8 +25,9 @@ function Body({ pageContext, children }) {
26
25
  }
27
26
 
28
27
  if (
29
- !document.domain.includes(process.env.GATSBY_SITE_NAME) ||
30
- !document.domain.includes(`www.${process.env.GATSBY_SITE_NAME}`)
28
+ document.domain !== `prelive.${process.env.GATSBY_SITE_NAME}` ||
29
+ document.domain !== process.env.GATSBY_SITE_NAME ||
30
+ document.domain !== `www.${process.env.GATSBY_SITE_NAME}`
31
31
  ) {
32
32
  const l = location.href;
33
33
  const r = document.referrer;
@@ -38,14 +38,12 @@ function Body({ pageContext, children }) {
38
38
  }
39
39
  }, []);
40
40
 
41
- const Sidebar = sidebar ? loadable(() => import(`~molecules/sidebar`)) : null;
42
41
  return (
43
42
  <>
44
43
  {navigation && <Navigation template={template} section={navigation} />}
45
44
  {!is404 && <Header section={pageContext} />}
46
45
  {main && !children && <Main section={main} pageContext={pageContext} />}
47
46
  {children && <main>{children}</main>}
48
- {Sidebar && <Sidebar section={sidebar} />}
49
47
  <ScrollToTop />
50
48
  <Footer template={template} section={footer} />
51
49
  <CookieConsent />
@@ -83,7 +83,7 @@ const Tracker = ({
83
83
  </video>
84
84
  );
85
85
  } else if (bgImage) {
86
- background = <LazyImage className={styles.background} src={bgImage} />;
86
+ background = <LazyImage className={styles.background} src={bgImage} alt="background image" />;
87
87
  }
88
88
 
89
89
  return (
@@ -6,8 +6,8 @@ export default {
6
6
  },
7
7
  keep_page_extra_fields: {
8
8
  operator: {
9
- 'Irishluck.ie': true, // needed for card background image
10
9
  'norskespilleautomater.com': true, // needed for inoperative / placeholder fields
10
+ 'Irishluck.ie': true, // needed for card background image
11
11
  'playcasino.co.za': true,
12
12
  },
13
13
  article: {
@@ -126,12 +126,7 @@ export function getPageImage(page) {
126
126
  return page.relation.thumbnail_filename;
127
127
  }
128
128
  }
129
- if (page.type === 'article') {
130
- if (page.banner) {
131
- return imagePrettyUrl(page.banner);
132
- }
133
- }
134
- if (['operator', 'software_provider'].includes(page.type) && page.relation.logo) {
129
+ if (page.type === 'software_provider' && page.relation.logo) {
135
130
  return imagePrettyUrl(page.relation.logo);
136
131
  }
137
132
  if (page.banner) {
@@ -20,9 +20,7 @@ describe('Getters Helper', () => {
20
20
 
21
21
  test('getPageTitle()', () => {
22
22
  window.location.search = 's=hello';
23
- expect(Getters.getPageTitle({ path: 's' })).toEqual(
24
- 'You searched for hello - norskespilleautomater.com'
25
- );
23
+ expect(Getters.getPageTitle({ path: 's' })).toEqual('You searched for hello - Irishluck.ie');
26
24
  });
27
25
 
28
26
  test('getExtraField()', () => {
@@ -1,4 +1,4 @@
1
- import { groupBy, removeDuplicates } from './common';
1
+ import { groupBy, removeDuplicates, clonePageForCards } from './common';
2
2
  import getPageDataList from '~tests/factories/pages/list.factory';
3
3
 
4
4
  describe('Common Helper', () => {
@@ -18,4 +18,10 @@ describe('Common Helper', () => {
18
18
  const filtered = removeDuplicates(array, 'id');
19
19
  expect(filtered).toHaveLength(2);
20
20
  });
21
+
22
+ test('ClonePageForCards', () => {
23
+ const data = getPageDataList(2);
24
+ const result = clonePageForCards(data, 'comparison_table');
25
+ expect(result?.relation?.bonus?.deposit_methods).toBeFalsy();
26
+ });
21
27
  });
@@ -55,7 +55,7 @@ export function processSitemapPages(pages, markets) {
55
55
  return pageListByMarket;
56
56
  }
57
57
 
58
- function transform(response) {
58
+ export function transform(response) {
59
59
  const transformed = {};
60
60
  Object.keys(response.site_markets).forEach((siteMarket) => {
61
61
  const language = siteMarket.split('_')[1];
@@ -74,7 +74,7 @@ function transform(response) {
74
74
  return transformed;
75
75
  }
76
76
 
77
- function processSections(sections, skipPost = false) {
77
+ export function processSections(sections, skipPost = false) {
78
78
  Object.keys(sections).forEach((sectionKey) => {
79
79
  if (skipPost && sectionKey.includes('post_main')) {
80
80
  return;
@@ -96,7 +96,6 @@ function processSections(sections, skipPost = false) {
96
96
  });
97
97
  }
98
98
  });
99
-
100
99
  return sections;
101
100
  }
102
101
 
@@ -0,0 +1,21 @@
1
+ import { transform, processExtraFields } from './index';
2
+ import pages from '~tests/factories/pages/pages.factory.js';
3
+
4
+ describe('Index Processor', () => {
5
+ test('Transform', () => {
6
+ const results = transform(pages);
7
+ expect(results?.za_en?.page).toBeTruthy();
8
+ });
9
+
10
+ test('processExtraFields', () => {
11
+ const extraFields = {
12
+ logos: { value: 339, type: 'default' },
13
+ };
14
+ processExtraFields(extraFields);
15
+ expect(extraFields?.logos).toBe(339);
16
+ });
17
+ test('processExtraFields null', () => {
18
+ const result = processExtraFields(false);
19
+ expect(result).toBeFalsy();
20
+ });
21
+ });
@@ -233,7 +233,7 @@ export function templateSchemas(page, pageImage) {
233
233
  page.siteInfo?.site_name ||
234
234
  process.env.GATSBY_SITE_NAME,
235
235
  logo:
236
- `${process.env.IMAGE_CDN_URL}/${page.siteInfo?.site_logo}` ||
236
+ (page.siteInfo?.site_logo && `${process.env.IMAGE_CDN_URL}/${page.siteInfo.site_logo}`) ||
237
237
  page.featured_image_object?.url ||
238
238
  pageImage,
239
239
  },
@@ -99,12 +99,12 @@ describe('Schema Helper', () => {
99
99
  expect(json.author.foundingDate).toEqual('01/02/03');
100
100
  if (isIL || isNSA) {
101
101
  expect(json.author.publishingPrinciples).toEqual(
102
- isIL
103
- ? 'https://www.irishluck.ie/editorial-principles'
104
- : 'https://www.norskespilleautomater.com/om-oss/prinsipper'
102
+ isNSA
103
+ ? 'https://www.norskespilleautomater.com/om-oss/prinsipper'
104
+ : 'https://www.irishluck.ie/editorial-principles'
105
105
  );
106
106
  } else {
107
- expect(json.author.publishingPrinciples).toEqual(undefined);
107
+ expect(json.author.publishingPrinciples).toEqual(null);
108
108
  }
109
109
 
110
110
  expect(Object.prototype.toString.call(json.author.logo)).toEqual('[object Object]');
@@ -6,7 +6,7 @@ import { GatsbyImage } from 'gatsby-plugin-image';
6
6
  export const PureImage = ({
7
7
  filename,
8
8
  className = '',
9
- alt = '',
9
+ alt = 'missing alt',
10
10
  height = '100%',
11
11
  width = '100%',
12
12
  data,
@@ -10,7 +10,7 @@ export default function LazyImage({
10
10
  style = {},
11
11
  className,
12
12
  src = '#',
13
- alt = '',
13
+ alt = 'missing alt',
14
14
  defaultImg,
15
15
  loading = 'lazy',
16
16
  }) {
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+ import LazyImage from '.';
5
+
6
+ describe('LazyImage function', () => {
7
+ test('LazyImage defaultImg', () => {
8
+ const { container } = render(
9
+ <LazyImage
10
+ src={null}
11
+ defaultImg={<img src="https://cdn.irishluck.ie/jackpot-village-logo-9.png" alt="test" />}
12
+ />
13
+ );
14
+ expect(container.querySelector('img')).toBeTruthy();
15
+ expect(container.querySelector('img')).toHaveAttribute(
16
+ 'src',
17
+ 'https://cdn.irishluck.ie/jackpot-village-logo-9.png'
18
+ );
19
+ });
20
+
21
+ test('LazyImage mock function inisNativeImageLazyLoadingSupported', () => {
22
+ // eslint-disable-next-line global-require
23
+ const func = require('../../helpers/device-detect');
24
+ func.isNativeImageLazyLoadingSupported = jest.fn(() => true);
25
+ const { container } = render(
26
+ <LazyImage src="https://cdn.irishluck.ie/jackpot-village-logo-9.png" />
27
+ );
28
+ expect(container.querySelector('img')).toBeTruthy();
29
+ expect(container.querySelector('img')).toHaveAttribute(
30
+ 'src',
31
+ 'https://cdn.irishluck.ie/jackpot-village-logo-9.png'
32
+ );
33
+ expect(container.querySelector('img')).toHaveAttribute('loading', 'lazy');
34
+ });
35
+ });
36
+
37
+ afterEach(() => {
38
+ cleanup();
39
+ });
@@ -11,7 +11,7 @@ export default function LazyPicture({
11
11
  offset = 200,
12
12
  style = {},
13
13
  className,
14
- alt = '',
14
+ alt = 'missing alt',
15
15
  webp = '',
16
16
  mobileSrc = '',
17
17
  desktopSrc = '',
@@ -1,5 +1,7 @@
1
+ /* eslint-disable jsx-a11y/anchor-is-valid */
2
+ /* eslint-disable no-unused-expressions */
1
3
  import React from 'react';
2
- import { render, cleanup } from '@testing-library/react';
4
+ import { render, cleanup, fireEvent } from '@testing-library/react';
3
5
  import '@testing-library/jest-dom/extend-expect';
4
6
  import Link from '.';
5
7
 
@@ -32,6 +34,45 @@ describe('Link Component', () => {
32
34
  );
33
35
  expect(getByText('Test Content').closest('a').classList.contains('test-gtm')).toBe(true);
34
36
  });
37
+ test('with window.location.pathname: /preview', () => {
38
+ delete global.window.location;
39
+ global.window = Object.create(window);
40
+ global.window.location = {
41
+ pathname: '/preview',
42
+ };
43
+
44
+ const { container } = render(
45
+ <Link to="test/link">
46
+ <span>Just Test</span>
47
+ </Link>
48
+ );
49
+
50
+ expect(container.querySelectorAll('a')).toHaveLength(1);
51
+ expect(container.querySelectorAll('a')[0]).toHaveAttribute('href', 'test/link');
52
+ const ahref = container.querySelector('a');
53
+ // eslint-disable-next-line no-lone-blocks
54
+ {
55
+ ahref && fireEvent.click(ahref);
56
+ }
57
+ });
58
+
59
+ test('Without to false ', () => {
60
+ const { getByText } = render(
61
+ <Link to="">
62
+ <span>Just Test</span>
63
+ </Link>
64
+ );
65
+ expect(getByText('Just Test')).toBeTruthy();
66
+ });
67
+
68
+ test('Without to ', () => {
69
+ const { getByText } = render(
70
+ <Link to="">
71
+ <span>Just Test 2</span>
72
+ </Link>
73
+ );
74
+ expect(getByText('Just Test 2')).toBeTruthy();
75
+ });
35
76
  });
36
77
  afterEach(() => {
37
78
  cleanup();
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+
4
+ import Tab from './tab';
5
+
6
+ describe('Tab component', () => {
7
+ test(' activeTab and tabId have not same props', () => {
8
+ const { container, getByText } = render(<Tab label="test" activeTab="2" tabId="3" />);
9
+ expect(getByText('test')).toBeTruthy();
10
+ expect(container.querySelectorAll('li')).toHaveLength(1);
11
+ expect(container.querySelectorAll('button')).toHaveLength(1);
12
+ });
13
+
14
+ test('activeTab and tabId have same props', () => {
15
+ const { container, getByText } = render(<Tab label="test2" activeTab="2" tabId="2" />);
16
+ expect(getByText('test2'));
17
+ expect(container.querySelector('button')).toHaveAttribute(
18
+ 'class',
19
+ ' active tabs-menu-gtm btn-cta'
20
+ );
21
+ expect(container.querySelectorAll('li')).toHaveLength(1);
22
+ expect(container.querySelectorAll('button')).toHaveLength(1);
23
+ });
24
+
25
+ test('activeTab and tabId have same props and active class name', () => {
26
+ const { container, getByText } = render(
27
+ <Tab label="test3" activeTab="2" tabId="2" activeTabClass="activeTabClassTest" />
28
+ );
29
+ expect(getByText('test3'));
30
+ expect(container.querySelector('button')).toHaveAttribute(
31
+ 'class',
32
+ ' activeTabClassTest tabs-menu-gtm btn-cta'
33
+ );
34
+ expect(container.querySelectorAll('li')).toHaveLength(1);
35
+ expect(container.querySelectorAll('button')).toHaveLength(1);
36
+ });
37
+ });
38
+
39
+ afterEach(() => {
40
+ cleanup();
41
+ });
@@ -9,7 +9,7 @@
9
9
  --secondary-text-color: var(--color-4);
10
10
  --heading-base-color: var(--color-12);
11
11
  --text-link-color: var(--color-13);
12
- --full-star-fill-color: #fba62f;
12
+ --full-star-fill-color: #fba62f;
13
13
  --full-star-border-color: #fba62f;
14
14
  --halfFull-star-fill-color: #fba62f;
15
15
  --halfEmpty-star-fill-color: white;
@@ -85,6 +85,8 @@
85
85
  --second-table-background: var(--color-17);
86
86
  --secondary-module-background: var(--color-42);
87
87
 
88
+ --pagination-with-midpoints-color: #ccc;
89
+
88
90
  // HTML Sitemap
89
91
  --template-name-icon-background: #ff893f;
90
92
  --page-number-background: #393939;
package/tests/envVars.js CHANGED
@@ -1,4 +1,4 @@
1
- process.env.GATSBY_SITE_NAME = 'norskespilleautomater.com';
1
+ process.env.GATSBY_SITE_NAME = 'Irishluck.ie';
2
2
  process.env.GATSBY_SITE_URL = 'http://urltest.com/';
3
3
  process.env.IMAGE_CDN_URL = 'https://cdn.images.com';
4
4
  process.env.TRACKER_LINK_FORMAT_MAIN = '[no],[visit],short_name';
@@ -1,11 +1,14 @@
1
1
  /**
2
2
  * @description Factory to retrieve data related to content (Main, Sidebar and Body) those contents can be everywhere
3
3
  */
4
-
5
- export function getSingleContentData(module_title_tag = 'h2', contentIndex = 1) {
4
+ export function getSingleContentData(
5
+ module_title_tag = 'h2',
6
+ contentIndex = 1,
7
+ moduleTitle = 'Test Content '
8
+ ) {
6
9
  const contentData = {
7
10
  module_title_tag,
8
- module_title: `Test Content ${contentIndex}`,
11
+ module_title: `${moduleTitle} ${contentIndex}`,
9
12
  value: `<p><i>Hello</i> I am content ${contentIndex}</p><img src="#" alt="test image">`,
10
13
  };
11
14
 
@@ -0,0 +1,152 @@
1
+ /* eslint-disable no-console */
2
+ import { getListContentData } from '~tests/factories/modules/content.factory';
3
+ // import { sampleGameCards } from '~tests/factories/modules/card.factory.js';
4
+ import { getSpotlightItems } from '~tests/factories/modules/spotlights.factory.js';
5
+ import { multiToplistData } from '~tests/factories/modules/toplist.factory.js';
6
+
7
+ const BonusProps = {
8
+ value: {
9
+ review_link: 'https://www.irishluck.ie/leovegas-casino/',
10
+ rating: '4.8',
11
+ status: 'active',
12
+ logo_url: 'image-38.png',
13
+ url: 'https://www.leovegas.com',
14
+ short_name: 'leovegas',
15
+ name: 'LeoVegas Casino',
16
+ },
17
+ type: 'Bonus',
18
+ module_value_id: 245478,
19
+ name: 'bonus',
20
+ };
21
+
22
+ const archivesProp = {
23
+ items: [
24
+ {
25
+ title: 'title 1',
26
+ content: 'content 1',
27
+ label: 'label-1',
28
+ primary_action: '/primary_action',
29
+ secondary_action: '/secondary_action',
30
+ },
31
+ {
32
+ title: 'title 2',
33
+ content: 'content 2',
34
+ label: 'label-2',
35
+ primary_action: '/primary_action',
36
+ secondary_action: '/secondary_action',
37
+ },
38
+ {
39
+ title: 'title 3',
40
+ content: 'content 3',
41
+ label: 'label-3',
42
+ primary_action: '/primary_action',
43
+ secondary_action: '/secondary_action',
44
+ },
45
+ ],
46
+ };
47
+
48
+ const ProsAndCons = {
49
+ pros: ['TestPro'],
50
+ cons: ['TestCons'],
51
+ module_value_id: 245475,
52
+ name: 'pros_and_cons',
53
+ anchored: 0,
54
+ anchor_label: null,
55
+ anchor_slug: null,
56
+ module_title: null,
57
+ module_title_tag: null,
58
+ background_color: null,
59
+ style: null,
60
+ style_id: null,
61
+ see_more_link: {
62
+ type: 'page',
63
+ value: null,
64
+ title: null,
65
+ },
66
+ };
67
+
68
+ const accordionProps = {
69
+ items: [
70
+ {
71
+ title: 'Test Test',
72
+ content: '<p>This is just a jest</p>',
73
+ },
74
+ ],
75
+ module_value_id: 245476,
76
+ name: 'accordion',
77
+ anchored: 0,
78
+ anchor_label: null,
79
+ anchor_slug: null,
80
+ module_title: null,
81
+ module_title_tag: null,
82
+ background_color: null,
83
+ style: null,
84
+ style_id: null,
85
+ see_more_link: {
86
+ type: 'page',
87
+ value: null,
88
+ title: null,
89
+ },
90
+ };
91
+
92
+ const anchorProps = {
93
+ name: 'anchor',
94
+ module_title: 'Page Contents',
95
+ module_title_tag: 'h2',
96
+ items: [
97
+ {
98
+ label: 'Game Selection',
99
+ type: 'module',
100
+ slug: 'game-selection',
101
+ },
102
+ ],
103
+ module_value_id: 91620,
104
+ };
105
+
106
+ const imageProps = {
107
+ value: 'jumanji-slot-thumbnail.jpg',
108
+ value_object: {
109
+ width: '576',
110
+ height: '576',
111
+ url: 'https://assets-srv.s3.eu-west-1.amazonaws.com/jumanji-slot-thumbnail.jpg',
112
+ filename: 'jumanji-slot-thumbnail.jpg',
113
+ },
114
+ title: 'Tets',
115
+ alignment: 'align_left',
116
+ alt: null,
117
+ module_value_id: 245479,
118
+ name: 'image',
119
+ anchored: 0,
120
+ anchor_label: null,
121
+ anchor_slug: null,
122
+ module_title: null,
123
+ module_title_tag: null,
124
+ background_color: null,
125
+ style: null,
126
+ style_id: null,
127
+ see_more_link: {
128
+ type: 'page',
129
+ value: null,
130
+ title: null,
131
+ },
132
+ };
133
+
134
+ // eslint-disable-next-line import/prefer-default-export
135
+ export function objectsHolder(elm) {
136
+ if (!elm || elm == null || undefined) {
137
+ return null;
138
+ }
139
+ const data = {
140
+ content: getListContentData(3),
141
+ top_list: multiToplistData,
142
+ archive: archivesProp,
143
+ counter: [],
144
+ pros_and_cons: ProsAndCons,
145
+ accordion: accordionProps,
146
+ anchor: anchorProps,
147
+ bonus: BonusProps,
148
+ image: imageProps,
149
+ spotlights: getSpotlightItems(2),
150
+ };
151
+ return data[elm];
152
+ }