gatsby-core-theme 2.2.4 → 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 (86) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/__mocks__/gatsby.js +16 -4
  3. package/gatsby-node.esm.js +14 -16
  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 +6 -5
  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/iframe/index.js +1 -1
  20. package/src/components/atoms/image/image.test.js +19 -6
  21. package/src/components/atoms/image/index.js +2 -4
  22. package/src/components/atoms/info-grid/index.js +10 -12
  23. package/src/components/atoms/label/index.js +2 -2
  24. package/src/components/atoms/label/label.test.js +4 -0
  25. package/src/components/atoms/menu/items/item/item.module.scss +4 -0
  26. package/src/components/atoms/module-title/index.js +9 -9
  27. package/src/components/atoms/module-title/module-title.test.js +76 -0
  28. package/src/components/atoms/open-graph/open-graph.test.js +34 -5
  29. package/src/components/atoms/operator-cta/operator-cta.test.js +26 -3
  30. package/src/components/atoms/scroll-to-top/scroll-to-top.test.js +6 -0
  31. package/src/components/atoms/search/autocomplete/operator.js +1 -1
  32. package/src/components/atoms/sitemap/index.js +1 -1
  33. package/src/components/atoms/spotlights/index.js +55 -53
  34. package/src/components/atoms/spotlights/spotlights.module.scss +25 -37
  35. package/src/components/atoms/spotlights/spotlights.test.js +13 -15
  36. package/src/components/molecules/content/content.test.js +127 -0
  37. package/src/components/molecules/content/index.js +2 -2
  38. package/src/components/molecules/header/header.test.js +6 -0
  39. package/src/components/molecules/main/main.test.js +48 -12
  40. package/src/components/molecules/menu/menu.test.js +27 -0
  41. package/src/components/molecules/module/module.test.js +134 -0
  42. package/src/components/molecules/operator-banner/operator-banner.test.js +7 -1
  43. package/src/components/molecules/pagination/pagination-with-midpoints.module.scss +48 -49
  44. package/src/components/organisms/anchor/index.js +1 -1
  45. package/src/components/organisms/cookie-consent/cookie-consent.test.js +7 -1
  46. package/src/components/organisms/form/form.test.js +21 -0
  47. package/src/components/organisms/form/index.js +5 -1
  48. package/src/components/organisms/navigation/index.js +9 -1
  49. package/src/components/organisms/search/index.js +0 -1
  50. package/src/components/organisms/toplist/list/index.js +1 -1
  51. package/src/components/organisms/toplist/list/list.test.js +30 -0
  52. package/src/components/pages/body/index.js +22 -5
  53. package/src/components/pages/tracker/index.js +1 -1
  54. package/src/constants/settings.js +1 -1
  55. package/src/helpers/getters.js +1 -6
  56. package/src/helpers/getters.test.js +1 -3
  57. package/src/helpers/processor/common.test.js +7 -1
  58. package/src/helpers/processor/index.js +2 -3
  59. package/src/helpers/processor/index.test.js +21 -0
  60. package/src/helpers/schema.js +30 -3
  61. package/src/helpers/schema.test.js +19 -10
  62. package/src/helpers/strings.js +10 -0
  63. package/src/helpers/strings.test.js +8 -0
  64. package/src/hooks/gatsby-img/index.js +1 -1
  65. package/src/hooks/lazy-image/index.js +1 -1
  66. package/src/hooks/lazy-image/lazy-image.test.js +39 -0
  67. package/src/hooks/lazy-picture/index.js +1 -1
  68. package/src/hooks/link/link.test.js +42 -1
  69. package/src/hooks/tabs/tab/tab.test.js +41 -0
  70. package/src/styles/utils/variables/_main.scss +3 -1
  71. package/tests/envVars.js +1 -1
  72. package/tests/factories/modules/content.factory.js +6 -3
  73. package/tests/factories/modules/modules.factory.js +152 -0
  74. package/tests/factories/modules/schema.factory.js +87 -0
  75. package/tests/factories/pages/list.factory.js +2 -1
  76. package/tests/factories/pages/pages.factory.js +192 -0
  77. package/tests/factories/sections/header.factory.js +8 -2
  78. package/src/components/atoms/logo/index.js +0 -36
  79. package/src/components/atoms/logo/logo.module.scss +0 -4
  80. package/src/components/atoms/logo/logo.stories.js +0 -57
  81. package/src/components/atoms/logo/logo.test.js +0 -30
  82. package/src/components/molecules/section/index.js +0 -24
  83. package/src/components/molecules/section/section.test.js +0 -16
  84. package/src/components/molecules/sidebar/index.js +0 -25
  85. package/src/components/molecules/sidebar/sidebar.module.scss +0 -3
  86. package/src/components/molecules/sidebar/sidebar.test.js +0 -30
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
+ }
@@ -0,0 +1,87 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export const schema = {
3
+ ie_en: {
4
+ 1: [
5
+ {
6
+ title: 'Test Check',
7
+ path: 'test-check',
8
+ template_id: 1,
9
+ },
10
+ {
11
+ title: 'Just Test',
12
+ path: 'just-test',
13
+ template_id: 1,
14
+ },
15
+ ],
16
+ 2: [
17
+ {
18
+ title: 'Betway Sports Ireland',
19
+ path: 'sports/betway',
20
+ template_id: 2,
21
+ },
22
+ {
23
+ title: 'Unibet Sportsbook Ireland',
24
+ path: 'sports/unibet',
25
+ template_id: 2,
26
+ },
27
+ ],
28
+ },
29
+ };
30
+
31
+ export const templatesInSchema = {
32
+ 1: {
33
+ short_name: 'default',
34
+ sections: [
35
+ 'navigation',
36
+ 'social_share_buttons',
37
+ 'breadcrumbs',
38
+ 'footer',
39
+ 'sidebar',
40
+ 'main',
41
+ 'links',
42
+ 'header',
43
+ ],
44
+ breadcrumbs: {
45
+ 25: [
46
+ {
47
+ page_id: 6236,
48
+ label: 'About us',
49
+ path: 'about-us',
50
+ },
51
+ {
52
+ page_id: 5907,
53
+ label: 'Casino Reviews',
54
+ path: 'casino-reviews',
55
+ },
56
+ {
57
+ page_id: 38434,
58
+ label: 'Casino Games',
59
+ path: 'casino-games',
60
+ },
61
+ ],
62
+ },
63
+ },
64
+ 2: {
65
+ short_name: 'operator_review',
66
+ sections: [
67
+ 'navigation',
68
+ 'social_share_buttons',
69
+ 'breadcrumbs',
70
+ 'footer',
71
+ 'sidebar',
72
+ 'main',
73
+ 'post_main_operators',
74
+ 'header',
75
+ 'links',
76
+ ],
77
+ breadcrumbs: {
78
+ 25: [
79
+ {
80
+ page_id: 5907,
81
+ label: 'Casino Reviews',
82
+ path: 'casino-reviews',
83
+ },
84
+ ],
85
+ },
86
+ },
87
+ };
@@ -26,7 +26,7 @@ export default function getPageDataList(length) {
26
26
  url: 'https://rizk.com',
27
27
  preconnect_links: ['1', '2', '3'],
28
28
  seo_json_schema: [],
29
- sections: { main: {} },
29
+ sections: { main: { extra_fields: { logos: { value: 339, type: 'default' } } } },
30
30
  breadcrumbs: [
31
31
  {
32
32
  label: 'Sport',
@@ -50,6 +50,7 @@ export default function getPageDataList(length) {
50
50
  one_liner: 'Oneliner',
51
51
  },
52
52
  },
53
+ deposit_methods: {},
53
54
  },
54
55
  extra_fields: {
55
56
  summary_background: 'fe63f69ca1618cf2e7ff810197001dec.png',
@@ -0,0 +1,192 @@
1
+ export default {
2
+ site_markets: { za_en: [] },
3
+ pages: {
4
+ en: {
5
+ page: {
6
+ 404: {
7
+ za_en: {
8
+ id: 99408,
9
+ market_id: 67,
10
+ updated_at: '2021-12-08',
11
+ created_at: '2021-12-08 16:15:50',
12
+ template_id: 97,
13
+ page_hreflang_group_id: null,
14
+ page_hreflang_combined: 0,
15
+ relation_id: 0,
16
+ relation_type: 'page',
17
+ market: 'za_en',
18
+ region_code: null,
19
+ author: null,
20
+ hard_coded_breadcrumbs: 0,
21
+ breadcrumb_ids: null,
22
+ categories: [],
23
+ author_id: null,
24
+ style_id: null,
25
+ language: 'en',
26
+ description: null,
27
+ meta_title: null,
28
+ meta_robots: null,
29
+ robot_options: {
30
+ page_index: 0,
31
+ links_followed: 0,
32
+ images_index: 0,
33
+ show_snippet: 0,
34
+ },
35
+ meta_description: null,
36
+ seo_keywords: null,
37
+ seo_raw_js: '',
38
+ seo_json_schema: null,
39
+ seo_json_schemas: [],
40
+ page_custom_hreflangs: null,
41
+ title: '404 Page',
42
+ vanity_label: null,
43
+ path: '404',
44
+ type: 'page',
45
+ template: 'default',
46
+ extra_fields: [],
47
+ banner: null,
48
+ featured_image: null,
49
+ canonical_url: null,
50
+ canonical_url_page_id: null,
51
+ status: 'active',
52
+ page_group_id: null,
53
+ page_group_combined: 0,
54
+ page_group_custom_items: null,
55
+ sections: {
56
+ navigation: null,
57
+ header: null,
58
+ main: null,
59
+ links: null,
60
+ site_markets: { za_en: [] },
61
+ pages: {
62
+ en: {
63
+ page: {
64
+ 404: {
65
+ za_en: {
66
+ id: 99408,
67
+ market_id: 67,
68
+ updated_at: '2021-12-08',
69
+ created_at: '2021-12-08 16:15:50',
70
+ template_id: 97,
71
+ page_hreflang_group_id: null,
72
+ page_hreflang_combined: 0,
73
+ relation_id: 0,
74
+ relation_type: 'page',
75
+ market: 'za_en',
76
+ region_code: null,
77
+ author: null,
78
+ hard_coded_breadcrumbs: 0,
79
+ breadcrumb_ids: null,
80
+ categories: [],
81
+ author_id: null,
82
+ style_id: null,
83
+ language: 'en',
84
+ description: null,
85
+ meta_title: null,
86
+ meta_robots: null,
87
+ robot_options: {
88
+ page_index: 0,
89
+ links_followed: 0,
90
+ images_index: 0,
91
+ show_snippet: 0,
92
+ },
93
+ meta_description: null,
94
+ seo_keywords: null,
95
+ seo_raw_js: '',
96
+ seo_json_schema: null,
97
+ seo_json_schemas: [],
98
+ page_custom_hreflangs: null,
99
+ title: '404 Page',
100
+ vanity_label: null,
101
+ path: '404',
102
+ type: 'page',
103
+ template: 'default',
104
+ extra_fields: [],
105
+ banner: null,
106
+ featured_image: null,
107
+ canonical_url: null,
108
+ canonical_url_page_id: null,
109
+ status: 'active',
110
+ page_group_id: null,
111
+ page_group_combined: 0,
112
+ page_group_custom_items: null,
113
+ sections: {
114
+ navigation: null,
115
+ header: null,
116
+ main: null,
117
+ links: null,
118
+ footer: null,
119
+ popup: null,
120
+ footer_navigation: null,
121
+ },
122
+ },
123
+ },
124
+ },
125
+ },
126
+ },
127
+ footer: null,
128
+ popup: null,
129
+ footer_navigation: null,
130
+ },
131
+ },
132
+ },
133
+ },
134
+ },
135
+ },
136
+ market_sections: {
137
+ za_en: {
138
+ footer: {
139
+ extra_fields: {
140
+ logos: {
141
+ value: '339',
142
+ type: 'menu',
143
+ },
144
+ links: {
145
+ value: '340',
146
+ type: 'menu',
147
+ },
148
+ social_icons: {
149
+ value: '341',
150
+ type: 'menu',
151
+ },
152
+ copyright_disclaimer: {
153
+ value:
154
+ '<p ><br><a href="https://www.dmca.com/Protection/Status.aspx?ID=c33e0a2a-0b14-4cba-bb31-194e23738540&amp;refurl=https://www.playcasino.co.za" target="_blank" title="DMCA Compliance information for playcasino.co.za"></a><a href="https://responsiblegambling.org.za/" target="_blank"></a>Advertising Disclosure: <a href="https://www.playcasino.co.za/">Playcasino.co.za</a> contains paid links to our partner affiliates. If a user visiting our site clicks on any of these paid links and makes a purchase from our partner, Playcasino.co.za will get paid a commission.</p><p>© PlayCasino All rights reserved</p><p>Marketing Performance Media Limited BVI Company number: 2028811 </p>',
155
+ type: 'html',
156
+ },
157
+ },
158
+ modules: [],
159
+ },
160
+ navigation: {
161
+ extra_fields: [],
162
+ modules: [
163
+ {
164
+ menu_id: 337,
165
+ menu_short_code: 'main_menu',
166
+ module_value_id: 213604,
167
+ name: 'menu',
168
+ },
169
+ {
170
+ value: '14076',
171
+ type: null,
172
+ module_value_id: 213608,
173
+ name: 'bonus',
174
+ anchored: 0,
175
+ anchor_label: null,
176
+ anchor_slug: null,
177
+ module_title: 'R500 Free No Deposit Bonus (Code: 500FM) + 500% up to R15,000',
178
+ module_title_tag: null,
179
+ background_color: null,
180
+ style: null,
181
+ style_id: null,
182
+ see_more_link: {
183
+ type: 'page',
184
+ value: null,
185
+ title: null,
186
+ },
187
+ },
188
+ ],
189
+ },
190
+ },
191
+ },
192
+ };
@@ -11,11 +11,17 @@ export default function getHeaderSection() {
11
11
  sections: {
12
12
  header: {
13
13
  extra_fields: {
14
- header_background_image: "398f163bfd5a201716fb42aa72ae48b0.jpeg",
15
- header_text: "<p><i>Hello</i> I am test text</p>",
14
+ header_background_image: '398f163bfd5a201716fb42aa72ae48b0.jpeg',
15
+ header_text: '<p><i>Hello</i> I am test text</p>',
16
16
  },
17
17
  },
18
18
  },
19
+ author: {
20
+ name: 'Cameron Murphy',
21
+ image: 'cameron-murphy.jpeg',
22
+ image_alt: null,
23
+ image_asset_id: 37728,
24
+ },
19
25
  },
20
26
  };
21
27
 
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { prettyTracker, imagePrettyUrl } from '~helpers/getters';
4
- import LazyImage from '~hooks/lazy-image';
5
-
6
- import styles from './logo.module.scss';
7
-
8
- const Logo = ({ item = {} }) => {
9
- const prettyLink = prettyTracker(item);
10
-
11
- return (
12
- <div>
13
- <a
14
- className={`${styles.operatorLogo} logo-cta`}
15
- href={prettyLink}
16
- title={item.name}
17
- target="_blank"
18
- rel="noopener noreferrer"
19
- aria-label={`${item.name} Link`}
20
- >
21
- <LazyImage alt={item.name} src={imagePrettyUrl(item.logo_url)} />
22
- </a>
23
- </div>
24
- );
25
- };
26
-
27
- Logo.propTypes = {
28
- item: PropTypes.shape({
29
- name: PropTypes.string,
30
- short_name: PropTypes.string,
31
- status: PropTypes.string,
32
- logo_url: PropTypes.string.isRequired,
33
- }).isRequired,
34
- };
35
-
36
- export default Logo;
@@ -1,4 +0,0 @@
1
- .operatorLogo {
2
- max-width: 10rem;
3
- min-height: 10rem;
4
- }
@@ -1,57 +0,0 @@
1
- import React from 'react';
2
- import {
3
- Title,
4
- Subtitle,
5
- Description,
6
- Primary,
7
- PRIMARY_STORY,
8
- ArgsTable,
9
- } from '@storybook/addon-docs/blocks';
10
-
11
- import Logo from '.';
12
-
13
- export default {
14
- title: 'Gatsby-Theme/Atoms/Logo',
15
- component: Logo,
16
- argTypes: {
17
- item: {
18
- name: 'item',
19
- type: { name: 'object', required: true },
20
- defaultValue: '',
21
- description: 'The logo item data object',
22
- table: {
23
- type: { summary: 'object' },
24
- defaultValue: { summary: '' },
25
- },
26
- },
27
- },
28
- parameters: {
29
- docs: {
30
- description: {
31
- component:
32
- 'A component that displays a linked lazy-loaded casino logo image.',
33
- },
34
- page: () => (
35
- <>
36
- <Title />
37
- <Subtitle />
38
- <Description />
39
- <Primary />
40
- <ArgsTable story={PRIMARY_STORY} />
41
- </>
42
- ),
43
- },
44
- },
45
- };
46
-
47
- const Template = (args) => <Logo {...args} />;
48
-
49
- export const Default = Template.bind({});
50
- Default.args = {
51
- item: {
52
- name: 'Rizk',
53
- short_name: 'Rizk',
54
- status : 'active',
55
- logo_url: 'rizk-logopng7ed316ac19-original.png',
56
- },
57
- };
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import { render, cleanup } from '@testing-library/react';
3
- import '@testing-library/jest-dom/extend-expect';
4
-
5
- import Logo from '.';
6
- import testImage from '../../../images/logo.svg';
7
-
8
- describe('Logo Component', () => {
9
- test('render with props', () => {
10
- const { container } = render(
11
- <Logo
12
- item={{
13
- name: 'my log name',
14
- status: 'active',
15
- logo_url: testImage,
16
- short_name: 'url',
17
- type: 'type',
18
- }}
19
- />
20
- );
21
- const logoA = container.querySelector('a.operatorLogo');
22
- expect(logoA).toHaveAttribute('title', 'my log name');
23
- expect(logoA).toHaveAttribute('target', '_blank');
24
- expect(logoA).toHaveAttribute('rel', 'noopener noreferrer');
25
- expect(logoA).toHaveAttribute('href', `/no/visit/url`);
26
- });
27
- });
28
- afterEach(() => {
29
- cleanup();
30
- });
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- import Module from '~molecules/module';
5
- import keygen from '~helpers/keygen';
6
-
7
- const Section = ({ section }) => {
8
- return (
9
- <>
10
- {section.modules &&
11
- section.modules.map((module) => {
12
- return <Module key={keygen()} module={module} />;
13
- })}
14
- </>
15
- );
16
- };
17
-
18
- Section.propTypes = {
19
- section: PropTypes.shape({
20
- modules: PropTypes.arrayOf(PropTypes.object),
21
- }).isRequired,
22
- };
23
-
24
- export default Section;
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { render, cleanup } from '@testing-library/react';
3
- import '@testing-library/jest-dom/extend-expect';
4
-
5
- import '~tests/helpers/match-media.mock';
6
- import Section from '.';
7
-
8
- describe('Section Component', () => {
9
- test('render whithout crash', () => {
10
- const { container } = render(<Section section={{ module: { name: 'content' } }} />);
11
- expect(container).toBeTruthy();
12
- });
13
- });
14
- afterEach(() => {
15
- cleanup();
16
- });
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- import Module from '~molecules/module';
5
- import keygen from '~helpers/keygen';
6
- import styles from './sidebar.module.scss';
7
-
8
- const Sidebar = ({ section }) => {
9
- return (
10
- <aside className={styles.sidebar}>
11
- {section.modules &&
12
- section.modules.map((module) => {
13
- return <Module key={keygen()} module={module} />;
14
- })}
15
- </aside>
16
- );
17
- };
18
-
19
- Sidebar.propTypes = {
20
- section: PropTypes.shape({
21
- modules: PropTypes.arrayOf(PropTypes.object),
22
- }).isRequired,
23
- };
24
-
25
- export default Sidebar;
@@ -1,3 +0,0 @@
1
- .sidebar {
2
- display: block;
3
- }