gatsby-core-theme 6.1.9 → 7.0.2
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/CHANGELOG.md +65 -0
- package/gatsby-node.esm.js +7 -3
- package/package.json +1 -1
- package/src/components/app.js +8 -0
- package/src/components/atoms/author/author.module.scss +14 -2
- package/src/components/atoms/author/author.test.js +1 -1
- package/src/components/atoms/author/index.js +58 -32
- package/src/components/atoms/author-box/index.js +3 -2
- package/src/components/atoms/spotlights/index.js +3 -4
- package/src/components/atoms/spotlights/spotlights.module.scss +5 -1
- package/src/components/molecules/carousel/default-slide/index.js +2 -2
- package/src/components/molecules/header/header.module.scss +16 -3
- package/src/components/molecules/header/header.test.js +1 -1
- package/src/components/molecules/header/index.js +4 -3
- package/src/components/molecules/link-list/index.js +2 -2
- package/src/components/molecules/star-rating/one-star.js +17 -7
- package/src/components/molecules/star-rating/one-star.module.scss +14 -13
- package/src/components/molecules/toplist/default-row/index.js +15 -7
- package/src/components/organisms/head/index.js +1 -4
- package/src/constants/pick-keys.js +7 -2
- package/src/helpers/getters.js +4 -0
- package/src/helpers/getters.test.js +13 -0
- package/src/helpers/processor/index.js +5 -0
- package/src/helpers/schema.js +3 -43
- package/src/helpers/schema.test.js +18 -21
- package/tests/factories/sections/header.factory.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,68 @@
|
|
|
1
|
+
## [7.0.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v7.0.1...v7.0.2) (2022-05-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* page reviewer ([9da597d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9da597d06663be779246df5980d253de69d23c73))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Code Refactoring
|
|
10
|
+
|
|
11
|
+
* responsive ([42584ab](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/42584ab72bd1c21f3281f883b30944a6d96823fa))
|
|
12
|
+
* update preview page schema ([dad9e57](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/dad9e57f66cc415fdece510ae9e345095075f269))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
* Merge branch 'tm-2708-update-preview-page-schema' into 'master' ([f35aaef](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f35aaef331cc2dc039624d34c97a7b86531a7660))
|
|
16
|
+
|
|
17
|
+
## [7.0.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v7.0.0...v7.0.1) (2022-05-05)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* add alt from image_object ([c1e7c23](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c1e7c232bbc41b250d99104feaa7ec248408bf50))
|
|
23
|
+
* add alt text, and also for operator added object logo_url_object ([64b0313](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/64b0313acc9e505191395b36896bf1886992b4f4))
|
|
24
|
+
* add image_object for payment and software ([f848229](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f84822911c11c053f92e5a16cf80542a13781ffb))
|
|
25
|
+
* add tests ([467919e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/467919e5b0f2b0ead4bdfb122d4c8278c9c2b0df))
|
|
26
|
+
* added standardized logo attribute and added label in rating component ([7bf1cbe](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7bf1cbe9e15e91e210840bd32237f07bb90f7453))
|
|
27
|
+
* fix error ([77e329d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/77e329d348be706dc040f28985e579cb4f29ff9b))
|
|
28
|
+
* fix error ([736f9ec](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/736f9ec86df1f2d09a0597002551efb198138538))
|
|
29
|
+
* tests fixes ([0972b4d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0972b4d37d368c5eef1d77b891b9ec531fa61254))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Code Refactoring
|
|
33
|
+
|
|
34
|
+
* remove archive robot_options and update head meta robots ([b0f5e6c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b0f5e6ce03fa7bc07d5966351f7a40b41eee922a))
|
|
35
|
+
* reorder author component ([282243f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/282243fdd41f2e1e70d2c04b76a3f1901a1a0d9b))
|
|
36
|
+
* update archive robot_options ([9adf990](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9adf990fca081bed88eea6c2444fb39ed5fd36b2))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
* Merge branch 'tm-2834-logos-rating' into 'master' ([34e951b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/34e951b45c41cf37bd3acd99d0171819c40875ed))
|
|
40
|
+
* Merge branch 'tm-2801-fact-checker' into 'master' ([55eda9f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/55eda9f01ef37f388168fcd7abab21fdd82fbc71))
|
|
41
|
+
* Merge branch 'tm-2829-image-alt-text' into 'master' ([47ca5e5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/47ca5e5aa7d45df9ee7922aecc8ee05ef73f5d68))
|
|
42
|
+
* Merge branch 'tm-2831-update-archive-noindex-nofollow' into 'master' ([c5a42f2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c5a42f21ab694af4c3d27c779fe1fc247bd2bdcb))
|
|
43
|
+
* Merge branch 'tm-2829-image-alt-text' into 'master' ([9297107](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9297107e6e2667529c812d798ebbd99841be969f))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Tests
|
|
47
|
+
|
|
48
|
+
* changes to test scripts ([8a7d401](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8a7d401eeda89e344fa8d54663fa759e80cb1cba))
|
|
49
|
+
|
|
50
|
+
# [7.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.9...v7.0.0) (2022-05-03)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Code Refactoring
|
|
54
|
+
|
|
55
|
+
* add factor checker ([cdc5192](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cdc519230240daf883b1de48ccd7297a88cb81eb))
|
|
56
|
+
* add reviewer object to page and change test script to reflect ([ac16823](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ac16823efc52a33fa3a6e2c613929eb590c1a909))
|
|
57
|
+
* align spotlight links ([235cb3e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/235cb3e8dbdcea6459b23ddaa21ef29b6eaccaf6))
|
|
58
|
+
* remove matrix specific schema and update tests ([4401079](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4401079658c2cb922b0d7a909331c39039667f8e))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
* Merge branch 'tm-2801-fact-checker' into 'master' ([03be105](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/03be105386f4462e6b367cb50a858831729f44ba))
|
|
62
|
+
* Merge branch 'tm-2880-spotlight-links' into 'master' ([4f89cfb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4f89cfb955dc9e906f7285835776d8db185d93ec))
|
|
63
|
+
* Merge branch 'master' into tm-2801-fact-checker ([2b769fd](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2b769fd65099798d4edf621dc262db154707e698))
|
|
64
|
+
* Merge branch 'tm-2708-remove-matrix-specific-schema' into 'master' ([cb883ed](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cb883ed7504aaddc24bf25e33d7aef4698097818))
|
|
65
|
+
|
|
1
66
|
## [6.1.9](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.8...v6.1.9) (2022-04-28)
|
|
2
67
|
|
|
3
68
|
|
package/gatsby-node.esm.js
CHANGED
|
@@ -72,6 +72,7 @@ function createArchivePage(pageObject, marketSections, prefilledModules, createP
|
|
|
72
72
|
? pageObject.path
|
|
73
73
|
: `${pageObject.path}/page/${archive.currentPage}`;
|
|
74
74
|
page.sections.main.modules[archiveModuleIndex] = archive;
|
|
75
|
+
|
|
75
76
|
createPage({
|
|
76
77
|
path: page.path,
|
|
77
78
|
component: require.resolve(appName),
|
|
@@ -196,7 +197,10 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
196
197
|
const processedPage = page;
|
|
197
198
|
processedPage.preconnect_links = preconnectLinks;
|
|
198
199
|
|
|
199
|
-
siteSchema =
|
|
200
|
+
siteSchema =
|
|
201
|
+
page.path === 'preview'
|
|
202
|
+
? (page.siteSchema = Object.values(response.schema || {})[0])
|
|
203
|
+
: response.schema[page['market_id']];
|
|
200
204
|
authors = response.authors;
|
|
201
205
|
|
|
202
206
|
page.translations = {};
|
|
@@ -221,6 +225,7 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
221
225
|
marketSections,
|
|
222
226
|
prefilledModules,
|
|
223
227
|
siteInfo,
|
|
228
|
+
siteSchema,
|
|
224
229
|
translations,
|
|
225
230
|
authors,
|
|
226
231
|
...themeOptions,
|
|
@@ -240,7 +245,6 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
240
245
|
component: require.resolve('./src/components/app.js'),
|
|
241
246
|
context: {
|
|
242
247
|
...contextData,
|
|
243
|
-
siteSchema,
|
|
244
248
|
isPreview: page.path === 'preview',
|
|
245
249
|
},
|
|
246
250
|
});
|
|
@@ -254,7 +258,7 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
254
258
|
(processed.relations &&
|
|
255
259
|
processed.relations.sports_data &&
|
|
256
260
|
processed.relations.sports_data.providers) ||
|
|
257
|
-
|
|
261
|
+
{}
|
|
258
262
|
).forEach((providerId) => {
|
|
259
263
|
const provider = processed.relations.sports_data.providers[providerId];
|
|
260
264
|
const tracker = generateTrackerLink(provider, 'main');
|
package/package.json
CHANGED
package/src/components/app.js
CHANGED
|
@@ -19,6 +19,11 @@ const App = ({ pageContext }) => {
|
|
|
19
19
|
!staticPath ? searchParams.get('path') || '/' : staticPath,
|
|
20
20
|
pageContext
|
|
21
21
|
).then((previewResponse) => {
|
|
22
|
+
if (previewResponse.page) {
|
|
23
|
+
// siteInfo and siteSchema are added to page for schemaGenerator()
|
|
24
|
+
previewResponse.page.siteInfo = pageContext.siteInfo;
|
|
25
|
+
previewResponse.page.siteSchema = pageContext.siteSchema;
|
|
26
|
+
}
|
|
22
27
|
setPreviewContext(previewResponse);
|
|
23
28
|
setIsLoading(false);
|
|
24
29
|
});
|
|
@@ -85,6 +90,9 @@ App.propTypes = {
|
|
|
85
90
|
site_logo: PropTypes.string,
|
|
86
91
|
site_name: PropTypes.string,
|
|
87
92
|
}),
|
|
93
|
+
siteSchema: PropTypes.shape({
|
|
94
|
+
site_name: PropTypes.string,
|
|
95
|
+
}),
|
|
88
96
|
}),
|
|
89
97
|
};
|
|
90
98
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
.authorInfo {
|
|
2
2
|
font-size: 1.5rem;
|
|
3
|
-
margin-right: 2rem;
|
|
4
3
|
}
|
|
5
4
|
.date {
|
|
6
5
|
font-size: 1.5rem;
|
|
@@ -10,7 +9,7 @@
|
|
|
10
9
|
font-size: 1.8rem;
|
|
11
10
|
}
|
|
12
11
|
.authorIcon,
|
|
13
|
-
.
|
|
12
|
+
.dateTimeWrapper,
|
|
14
13
|
.authorInfo {
|
|
15
14
|
height: 2rem;
|
|
16
15
|
display: inline-block;
|
|
@@ -20,3 +19,16 @@
|
|
|
20
19
|
color: #09f;
|
|
21
20
|
}
|
|
22
21
|
}
|
|
22
|
+
|
|
23
|
+
.authorWrapper {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
column-gap: 0.5rem;
|
|
27
|
+
|
|
28
|
+
> div {
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: flex-end;
|
|
31
|
+
flex-wrap: wrap;
|
|
32
|
+
column-gap: 0.5rem;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -37,7 +37,7 @@ describe('Author Component', () => {
|
|
|
37
37
|
date="2020-04-24 15:37:42"
|
|
38
38
|
/>
|
|
39
39
|
);
|
|
40
|
-
expect(container.querySelector('.
|
|
40
|
+
expect(container.querySelector('.dateTimeWrapper')).toBeTruthy();
|
|
41
41
|
const info = getByText('with mohsen');
|
|
42
42
|
expect(info).toBeTruthy();
|
|
43
43
|
expect(container.querySelector('i')).toBeTruthy();
|
|
@@ -15,42 +15,66 @@ const Author = ({
|
|
|
15
15
|
date = '',
|
|
16
16
|
dateFormat = 'DD.MM.YYYY',
|
|
17
17
|
dateSeparator = '.',
|
|
18
|
+
readingTime = '',
|
|
19
|
+
reviewer = {},
|
|
18
20
|
}) => {
|
|
19
21
|
return (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
<div className={styles.authorWrapper}>
|
|
23
|
+
<div>
|
|
24
|
+
{link && icon && (
|
|
25
|
+
<div className={styles.authorIcon}>
|
|
26
|
+
<a
|
|
27
|
+
href={link}
|
|
28
|
+
target="_blank"
|
|
29
|
+
rel="noreferrer"
|
|
30
|
+
aria-label={`${name} Link`}
|
|
31
|
+
className="author-gtm"
|
|
32
|
+
>
|
|
33
|
+
{icon}
|
|
34
|
+
</a>
|
|
35
|
+
</div>
|
|
36
|
+
)}
|
|
37
|
+
{!link && icon && <div className={styles.authorIcon}>{icon}</div>}
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
<div className={styles.authorInfo}>
|
|
40
|
+
{name &&
|
|
41
|
+
(authorProfile ? (
|
|
42
|
+
<>
|
|
43
|
+
{`${prefix} `}
|
|
44
|
+
<Link to={authorProfile} className="author-gtm" title={name}>
|
|
45
|
+
{name}
|
|
46
|
+
</Link>
|
|
47
|
+
</>
|
|
48
|
+
) : (
|
|
49
|
+
`${prefix} ${name}`
|
|
50
|
+
))}
|
|
51
|
+
</div>
|
|
52
|
+
{readingTime && (
|
|
53
|
+
<div className={date && styles.readingWithBorder}>
|
|
54
|
+
<span>Reading time</span>
|
|
55
|
+
{` ${readingTime} min`}
|
|
56
|
+
</div>
|
|
57
|
+
)}
|
|
48
58
|
</div>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
<div>
|
|
60
|
+
{reviewer.name && (
|
|
61
|
+
<div className={date && styles.reviewer}>
|
|
62
|
+
<span>Fact checked by</span>
|
|
63
|
+
{` `}
|
|
64
|
+
<Link to={reviewer.profile_page_path} title={reviewer.name}>
|
|
65
|
+
{reviewer.name}
|
|
66
|
+
</Link>
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
{date && (
|
|
70
|
+
<div className={styles.dateTimeWrapper}>
|
|
71
|
+
<span>Published on</span>
|
|
72
|
+
{` `}
|
|
73
|
+
{formatDate(date, dateFormat, dateSeparator, 'en-GB')}
|
|
74
|
+
</div>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
54
78
|
);
|
|
55
79
|
};
|
|
56
80
|
|
|
@@ -63,6 +87,8 @@ Author.propTypes = {
|
|
|
63
87
|
date: PropTypes.string,
|
|
64
88
|
dateFormat: PropTypes.string,
|
|
65
89
|
dateSeparator: PropTypes.string,
|
|
90
|
+
readingTime: PropTypes.string,
|
|
91
|
+
reviewer: PropTypes.shape({}),
|
|
66
92
|
};
|
|
67
93
|
|
|
68
94
|
export default Author;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import { FaInstagram, FaFacebookSquare, FaTwitter, FaLinkedin } from 'react-icons/fa';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { translate, imagePrettyUrl } from '~helpers/getters';
|
|
5
|
+
import { translate, imagePrettyUrl, getAltText } from '~helpers/getters';
|
|
6
6
|
import styles from './author-box.module.scss';
|
|
7
7
|
import LazyImage from '~hooks/lazy-image';
|
|
8
8
|
import Link from '~hooks/link';
|
|
@@ -24,7 +24,7 @@ export default function AuthorBox({ author }) {
|
|
|
24
24
|
{author.image_object && (
|
|
25
25
|
<LazyImage
|
|
26
26
|
src={imagePrettyUrl(author.image_object.filename)}
|
|
27
|
-
alt={author.image_alt || author.name}
|
|
27
|
+
alt={getAltText(author?.image_object, author.image_alt || author.name)}
|
|
28
28
|
width={author.image_object?.width}
|
|
29
29
|
height={author.image_object?.height}
|
|
30
30
|
/>
|
|
@@ -110,6 +110,7 @@ AuthorBox.propTypes = {
|
|
|
110
110
|
width: PropTypes.number,
|
|
111
111
|
height: PropTypes.number,
|
|
112
112
|
filename: PropTypes.string,
|
|
113
|
+
alt: PropTypes.string,
|
|
113
114
|
}),
|
|
114
115
|
image_alt: PropTypes.string,
|
|
115
116
|
name: PropTypes.string,
|
|
@@ -7,7 +7,7 @@ import { GrFormNextLink } from 'react-icons/gr';
|
|
|
7
7
|
import Button from '~atoms/button';
|
|
8
8
|
import LazyImage from '~hooks/lazy-image';
|
|
9
9
|
import keygen from '~helpers/keygen';
|
|
10
|
-
import { imagePrettyUrl, getImageFilename } from '~helpers/getters';
|
|
10
|
+
import { imagePrettyUrl, getImageFilename, getAltText } from '~helpers/getters';
|
|
11
11
|
import Link from '~hooks/link';
|
|
12
12
|
import styles from './spotlights.module.scss';
|
|
13
13
|
|
|
@@ -18,14 +18,13 @@ const Spotlights = ({ module, themeStyles = {} }) => {
|
|
|
18
18
|
const img = mode === 'icon' ? item.icon : item.image;
|
|
19
19
|
const imageSrc = imagePrettyUrl(img);
|
|
20
20
|
const fileName = getImageFilename(imageSrc);
|
|
21
|
-
|
|
22
21
|
return (
|
|
23
22
|
<>
|
|
24
23
|
{img && (
|
|
25
24
|
<LazyImage
|
|
26
25
|
width={100}
|
|
27
26
|
height={50}
|
|
28
|
-
alt={item.label || item?.link_text || fileName}
|
|
27
|
+
alt={getAltText(item?.image_object, item.label || item?.link_text || fileName)}
|
|
29
28
|
src={imageSrc}
|
|
30
29
|
/>
|
|
31
30
|
)}
|
|
@@ -75,7 +74,7 @@ const Spotlights = ({ module, themeStyles = {} }) => {
|
|
|
75
74
|
|
|
76
75
|
{mode === 'image_text' &&
|
|
77
76
|
(item.link.value ? (
|
|
78
|
-
<div>
|
|
77
|
+
<div className={styles.spotlightsTextCTA}>
|
|
79
78
|
<div dangerouslySetInnerHTML={{ __html: item.text }} />
|
|
80
79
|
{item.link.type === 'external' ? (
|
|
81
80
|
<a
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
6
|
import LazyImage from '~hooks/lazy-image';
|
|
7
|
-
import { imagePrettyUrl } from '~helpers/getters';
|
|
7
|
+
import { imagePrettyUrl, getAltText } from '~helpers/getters';
|
|
8
8
|
import Button from '~atoms/button';
|
|
9
9
|
import styles from './default-slide.module.scss';
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ const Slide = ({
|
|
|
22
22
|
<LazyImage
|
|
23
23
|
className={styles.image}
|
|
24
24
|
src={imagePrettyUrl(item.image, imageSizes.width, imageSizes.height)}
|
|
25
|
-
alt={item.title || slideTitle}
|
|
25
|
+
alt={getAltText(item?.image_object, item.title || slideTitle)}
|
|
26
26
|
/>
|
|
27
27
|
)}
|
|
28
28
|
{item.content && <p className={styles.content}>{item.content}</p>}
|
|
@@ -26,9 +26,22 @@
|
|
|
26
26
|
z-index: 1;
|
|
27
27
|
padding: 2.4rem;
|
|
28
28
|
|
|
29
|
-
.
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
.topSection {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
|
|
33
|
+
> div {
|
|
34
|
+
padding-top: 1rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.readingTime {
|
|
38
|
+
> span {
|
|
39
|
+
font-weight: bold;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@include max(mobile){
|
|
44
|
+
flex-direction: column;
|
|
32
45
|
}
|
|
33
46
|
}
|
|
34
47
|
}
|
|
@@ -14,7 +14,7 @@ describe('header component', () => {
|
|
|
14
14
|
expect(container.querySelectorAll('.headerContent')).toHaveLength(1);
|
|
15
15
|
|
|
16
16
|
// Inner HTML
|
|
17
|
-
expect(container.querySelectorAll('p')).toHaveLength(
|
|
17
|
+
expect(container.querySelectorAll('p')).toHaveLength(1);
|
|
18
18
|
expect(container.querySelectorAll('i')).toHaveLength(1);
|
|
19
19
|
|
|
20
20
|
// Testing image
|
|
@@ -62,6 +62,8 @@ function Header({ section, content = null, backgroundImage = true }) {
|
|
|
62
62
|
authorProfile={section.page.author?.profile_page_path}
|
|
63
63
|
name={section.page.author?.name}
|
|
64
64
|
date={section.page.updated_at ? section.page.updated_at : section.page.created_at}
|
|
65
|
+
readingTime={section.page.reading_time}
|
|
66
|
+
reviewer={section.page.reviewer}
|
|
65
67
|
/>
|
|
66
68
|
</div>
|
|
67
69
|
)}
|
|
@@ -72,9 +74,6 @@ function Header({ section, content = null, backgroundImage = true }) {
|
|
|
72
74
|
section.page.template !== 'article_casino' &&
|
|
73
75
|
section.page.template !== 'article_sports' &&
|
|
74
76
|
section.page.template !== 'game_review' && <h1>{section.page.title}</h1>}
|
|
75
|
-
<p className={styles.readingTime}>
|
|
76
|
-
Reading Time: <span>{section.page.reading_time}</span>
|
|
77
|
-
</p>
|
|
78
77
|
<div className={!content && styles.headerText}>{headerContent()}</div>
|
|
79
78
|
</div>
|
|
80
79
|
</header>
|
|
@@ -90,10 +89,12 @@ Header.propTypes = {
|
|
|
90
89
|
updated_at: PropTypes.string,
|
|
91
90
|
created_at: PropTypes.string,
|
|
92
91
|
reading_time: PropTypes.string,
|
|
92
|
+
reviewer: PropTypes.string,
|
|
93
93
|
author: PropTypes.shape({
|
|
94
94
|
name: PropTypes.string,
|
|
95
95
|
profile_page_path: PropTypes.string,
|
|
96
96
|
}),
|
|
97
|
+
authors: PropTypes.shape([PropTypes.shape({})]),
|
|
97
98
|
sections: PropTypes.shape({
|
|
98
99
|
header: PropTypes.shape({
|
|
99
100
|
extra_fields: PropTypes.shape({
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
6
|
import keygen from '~helpers/keygen';
|
|
7
|
-
import { imagePrettyUrl } from '~helpers/getters';
|
|
7
|
+
import { imagePrettyUrl, getAltText } from '~helpers/getters';
|
|
8
8
|
import Link from '~hooks/link';
|
|
9
9
|
import LazyImage from '~hooks/lazy-image';
|
|
10
10
|
|
|
@@ -29,7 +29,7 @@ const LinkList = ({
|
|
|
29
29
|
const LinkImage = () => (
|
|
30
30
|
<LazyImage
|
|
31
31
|
src={imagePrettyUrl(item.image)}
|
|
32
|
-
alt={item.title}
|
|
32
|
+
alt={getAltText(item?.image_object, item.title)}
|
|
33
33
|
width={width}
|
|
34
34
|
height={height}
|
|
35
35
|
loading={disableLazyLoad ? 'eager' : 'lazy'}
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { Context } from '~context/TranslationsProvider';
|
|
3
4
|
import { getRating } from '~helpers/rating';
|
|
5
|
+
import { translate } from '~helpers/getters';
|
|
4
6
|
|
|
5
7
|
import styles from './one-star.module.scss';
|
|
6
8
|
|
|
7
|
-
const OneStar = ({ numOfStars, rating, active = true }) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const OneStar = ({ numOfStars, rating, active = true, showLabel = false }) => {
|
|
10
|
+
const { translations } = useContext(Context) || {};
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div className={`${styles.starRatingContainer} ${!active && styles.inactive}`}>
|
|
14
|
+
{showLabel && (
|
|
15
|
+
<span className={styles.text}>{translate(translations, 'rating', 'Rating')}</span>
|
|
16
|
+
)}
|
|
17
|
+
<span className={styles.fullStar} />
|
|
18
|
+
<span className={styles.text}>{`${getRating(rating)}/${numOfStars}`}</span>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
13
22
|
|
|
14
23
|
OneStar.propTypes = {
|
|
15
24
|
numOfStars: PropTypes.oneOf([5, 10]).isRequired,
|
|
16
25
|
rating: PropTypes.oneOfType([PropTypes.array, PropTypes.number, PropTypes.string]).isRequired,
|
|
17
26
|
active: PropTypes.bool,
|
|
27
|
+
showLabel: PropTypes.bool,
|
|
18
28
|
};
|
|
19
29
|
|
|
20
30
|
export default OneStar;
|
|
@@ -7,22 +7,23 @@
|
|
|
7
7
|
line-height: 2.1rem;
|
|
8
8
|
border-radius: 0.4rem;
|
|
9
9
|
border: 1px solid var(--main-star-wrapper-color);
|
|
10
|
-
|
|
11
|
-
.fullStar {
|
|
12
|
-
@include star(var(--full-star-fill-color), var(--full-star-border-color), unset, 2.1rem);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.rateNr {
|
|
16
|
-
color: #17182f;
|
|
17
|
-
font-weight: 700;
|
|
18
|
-
font-size: 1.3rem;
|
|
19
|
-
margin-left: 0.33rem;
|
|
20
|
-
line-height: 2.1rem;
|
|
21
|
-
}
|
|
22
|
-
|
|
10
|
+
|
|
23
11
|
&.inactive {
|
|
24
12
|
.fullStar {
|
|
25
13
|
@include star(var(--empty-star-border-color), var(--empty-star-border-color), unset, 2.1rem);
|
|
26
14
|
}
|
|
27
15
|
}
|
|
28
16
|
}
|
|
17
|
+
|
|
18
|
+
.fullStar {
|
|
19
|
+
@include star(var(--full-star-fill-color), var(--full-star-border-color), unset, 2.1rem);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.text {
|
|
23
|
+
color: #17182f;
|
|
24
|
+
font-weight: 700;
|
|
25
|
+
font-size: 1.3rem;
|
|
26
|
+
margin: 0 0.33rem;
|
|
27
|
+
line-height: 2.1rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
@@ -4,10 +4,10 @@ import { MdCheck } from 'react-icons/md';
|
|
|
4
4
|
import Bonus from '~atoms/bonus';
|
|
5
5
|
import { Context } from '~context/TranslationsProvider';
|
|
6
6
|
import SellingPoints from '~atoms/selling-points';
|
|
7
|
-
import StarRating from '~molecules/star-rating';
|
|
7
|
+
import StarRating from '~molecules/star-rating/one-star';
|
|
8
8
|
import Link from '~hooks/link';
|
|
9
9
|
import OperatorCta from '~atoms/operator-cta';
|
|
10
|
-
import { prettyTracker, imagePrettyUrl, translate } from '~helpers/getters';
|
|
10
|
+
import { prettyTracker, imagePrettyUrl, translate, getAltText } from '~helpers/getters';
|
|
11
11
|
import LazyImage from '~hooks/lazy-image';
|
|
12
12
|
|
|
13
13
|
import styles from './default-row.module.scss';
|
|
@@ -17,6 +17,8 @@ const Row = ({ item, oneliner = 'main', layout = 'list', tracker = 'main' }) =>
|
|
|
17
17
|
const itemRating = item.rating;
|
|
18
18
|
const { translations } = useContext(Context) || {};
|
|
19
19
|
|
|
20
|
+
const imageObject = item?.standardised_logo_url_object || item?.logo_url_object;
|
|
21
|
+
|
|
20
22
|
return (
|
|
21
23
|
<div className={`${styles.row} ${styles[layout]}`}>
|
|
22
24
|
<a
|
|
@@ -37,10 +39,10 @@ const Row = ({ item, oneliner = 'main', layout = 'list', tracker = 'main' }) =>
|
|
|
37
39
|
aria-label={`${item.name} Link`}
|
|
38
40
|
>
|
|
39
41
|
<LazyImage
|
|
40
|
-
alt={item.name}
|
|
41
|
-
src={imagePrettyUrl(item
|
|
42
|
-
width={
|
|
43
|
-
height={
|
|
42
|
+
alt={getAltText(imageObject, item.name)}
|
|
43
|
+
src={imagePrettyUrl(imageObject?.filename || item?.logo_url, 100)}
|
|
44
|
+
width={100}
|
|
45
|
+
height={100}
|
|
44
46
|
/>
|
|
45
47
|
</a>
|
|
46
48
|
<a
|
|
@@ -51,7 +53,7 @@ const Row = ({ item, oneliner = 'main', layout = 'list', tracker = 'main' }) =>
|
|
|
51
53
|
>
|
|
52
54
|
<Bonus item={item} tracker={oneliner} />
|
|
53
55
|
</a>
|
|
54
|
-
<StarRating numOfStars={5} rating={itemRating} />
|
|
56
|
+
<StarRating numOfStars={5} rating={itemRating} showLabel />
|
|
55
57
|
<SellingPoints icon={<MdCheck />} sellingPoints={item.selling_points} />
|
|
56
58
|
<div>
|
|
57
59
|
<Link className={`${styles.reviewLink} toplist-variant-one-gtm`} to={item.review_link}>
|
|
@@ -80,6 +82,12 @@ Row.propTypes = {
|
|
|
80
82
|
one_liner: PropTypes.string,
|
|
81
83
|
}),
|
|
82
84
|
}),
|
|
85
|
+
logo_url_object: PropTypes.shape({
|
|
86
|
+
filename: PropTypes.string,
|
|
87
|
+
}),
|
|
88
|
+
standardised_logo_url_object: PropTypes.shape({
|
|
89
|
+
filename: PropTypes.string,
|
|
90
|
+
}),
|
|
83
91
|
bonus: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
|
84
92
|
}).isRequired,
|
|
85
93
|
};
|
|
@@ -49,10 +49,7 @@ const Head = ({ page = {}, siteInfo }) => {
|
|
|
49
49
|
<meta name="robots" content={page.meta_robots.join()} />
|
|
50
50
|
)}
|
|
51
51
|
|
|
52
|
-
{page.robot_options &&
|
|
53
|
-
<meta name="robots" content={getRobotOptions(page.robot_options)} />
|
|
54
|
-
)}
|
|
55
|
-
{page.path.includes('/page/') && <meta name="robots" content="noindex,follow" />}
|
|
52
|
+
{page.robot_options && <meta name="robots" content={getRobotOptions(page.robot_options)} />}
|
|
56
53
|
|
|
57
54
|
{process.env.GATSBY_ACTIVE_ENV === 'development' && (
|
|
58
55
|
<meta name="googlebot" content="noindex,follow" />
|
|
@@ -12,6 +12,8 @@ export const pickPageKeys = [
|
|
|
12
12
|
];
|
|
13
13
|
|
|
14
14
|
export const topListPickKeys = [
|
|
15
|
+
'standardised_logo_url_object',
|
|
16
|
+
'logo_url_object',
|
|
15
17
|
'logo_url',
|
|
16
18
|
'one_liner',
|
|
17
19
|
'one_liners',
|
|
@@ -35,6 +37,8 @@ export const topListPickKeys = [
|
|
|
35
37
|
export const pickRelationKeys = {
|
|
36
38
|
tournament: ['tournaments'],
|
|
37
39
|
operator: [
|
|
40
|
+
'standardised_logo_url_object',
|
|
41
|
+
'logo_url_object',
|
|
38
42
|
'logo_url',
|
|
39
43
|
'one_liner',
|
|
40
44
|
'one_liners',
|
|
@@ -60,9 +64,10 @@ export const pickRelationKeys = {
|
|
|
60
64
|
'third_rating',
|
|
61
65
|
'fourth_rating',
|
|
62
66
|
'thumbnail_filename',
|
|
67
|
+
'thumbnail_filename_object',
|
|
63
68
|
],
|
|
64
|
-
software_provider: ['logo', 'games_count', 'name'],
|
|
65
|
-
payment_method: ['logo', 'name'],
|
|
69
|
+
software_provider: ['logo_object', 'logo', 'games_count', 'name'],
|
|
70
|
+
payment_method: ['logo_object', 'logo', 'name'],
|
|
66
71
|
};
|
|
67
72
|
|
|
68
73
|
export const pickHTMLSitemapPageKeys = ['title', 'path', 'template_id'];
|
package/src/helpers/getters.js
CHANGED
|
@@ -368,3 +368,7 @@ export const getRoundMinutes = (time) => {
|
|
|
368
368
|
const value = seconds > 30 ? Number(minutes) + 1 : Number(minutes);
|
|
369
369
|
return value === 0 ? 1 : value;
|
|
370
370
|
};
|
|
371
|
+
|
|
372
|
+
export function getAltText(imageObject, defaultAlt = 'missing alt') {
|
|
373
|
+
return imageObject && imageObject.alt ? imageObject.alt : defaultAlt;
|
|
374
|
+
}
|
|
@@ -245,10 +245,12 @@ describe('Getters Helper', () => {
|
|
|
245
245
|
Getters.shiftFirstOperator(11607, module, pagesMappedById);
|
|
246
246
|
expect(module.items[0].id).toBe(11607);
|
|
247
247
|
});
|
|
248
|
+
|
|
248
249
|
test('move opeartor first postion', () => {
|
|
249
250
|
Getters.shiftFirstOperator(13212, module, pagesMappedById);
|
|
250
251
|
expect(module.items[0].id).toBe(13212);
|
|
251
252
|
});
|
|
253
|
+
|
|
252
254
|
test('check when we have the operator in first postion', () => {
|
|
253
255
|
Getters.shiftFirstOperator(13212, module, pagesMappedById);
|
|
254
256
|
expect(module.items[0].id).toBe(13212);
|
|
@@ -257,7 +259,18 @@ describe('Getters Helper', () => {
|
|
|
257
259
|
test('If the reading time is bigger than half, it should return the next number ', () => {
|
|
258
260
|
expect(Getters.getRoundMinutes('3:52')).toBe(4);
|
|
259
261
|
});
|
|
262
|
+
|
|
260
263
|
test('If reading time is less than half, it should return the last number ', () => {
|
|
261
264
|
expect(Getters.getRoundMinutes('3:29')).toBe(3);
|
|
262
265
|
});
|
|
266
|
+
|
|
267
|
+
test('Test altText', () => {
|
|
268
|
+
const alt = Getters.getAltText({ alt: 'imageAlt' }, 'default');
|
|
269
|
+
expect(alt).toEqual('imageAlt');
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test('Test without altText', () => {
|
|
273
|
+
const altText = Getters.getAltText(null, 'default');
|
|
274
|
+
expect(altText).toEqual('default');
|
|
275
|
+
});
|
|
263
276
|
});
|
|
@@ -248,6 +248,11 @@ export default {
|
|
|
248
248
|
transformedPages[market][pageType][index].author = data.authors[page.author_id];
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
// add reviewer object to page
|
|
252
|
+
if (page.reviewer_id !== null && Object.values(data.authors).length) {
|
|
253
|
+
transformedPages[market][pageType][index].reviewer = data.authors[page.reviewer_id];
|
|
254
|
+
}
|
|
255
|
+
|
|
251
256
|
// add breadcrumbs array to page
|
|
252
257
|
const pageBreadcrumbIds = transformedPages[market][pageType][index].breadcrumb_ids;
|
|
253
258
|
if (pageBreadcrumbIds) {
|
package/src/helpers/schema.js
CHANGED
|
@@ -2,45 +2,6 @@ import { getGameRating, getUrl, getLanguage } from './getters';
|
|
|
2
2
|
import { cleanHTML } from './strings';
|
|
3
3
|
|
|
4
4
|
/* HardCoded Start */
|
|
5
|
-
const isIL = process.env.GATSBY_SITE_NAME === 'irishluck.ie';
|
|
6
|
-
const isNSA = process.env.GATSBY_SITE_NAME === 'norskespilleautomater.com';
|
|
7
|
-
const publishingPrinciples = isIL
|
|
8
|
-
? 'https://www.irishluck.ie/editorial-principles'
|
|
9
|
-
: 'https://www.norskespilleautomater.com/om-oss/prinsipper';
|
|
10
|
-
const knowsAbout = [
|
|
11
|
-
{
|
|
12
|
-
'@type': 'Thing',
|
|
13
|
-
name: 'Norway',
|
|
14
|
-
sameAs: [
|
|
15
|
-
'https://no.wikipedia.org/wiki/Norge',
|
|
16
|
-
'https://www.google.no/search?q=Norge&pws=0&nord=1&hl=no&gl=NO',
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
'@type': 'Thing',
|
|
21
|
-
name: 'LottStift',
|
|
22
|
-
sameAs: [
|
|
23
|
-
'https://no.wikipedia.org/wiki/Lotteri-_og_stiftelsestilsynet',
|
|
24
|
-
'https://www.google.no/search?q=lottstift&pws=0&nord=1&hl=no&gl=NO',
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
'@type': 'Thing',
|
|
29
|
-
name: 'Kasino',
|
|
30
|
-
sameAs: [
|
|
31
|
-
'https://no.wikipedia.org/wiki/Kasino',
|
|
32
|
-
'https://www.google.no/search?q=Kasino&pws=0&nord=1&hl=no&gl=NO',
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
'@type': 'Thing',
|
|
37
|
-
name: 'Norsk Tipping Kommisjonær',
|
|
38
|
-
sameAs: [
|
|
39
|
-
'https://no.wikipedia.org/wiki/Norsk_Tipping',
|
|
40
|
-
'https://www.google.no/search?q=norsk+tipping&pws=0&nord=1&hl=no&gl=NO',
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
5
|
const customSchema = {
|
|
45
6
|
// Matrix
|
|
46
7
|
'playcasino.co.za': 'Playcasino',
|
|
@@ -60,7 +21,6 @@ const customSchema = {
|
|
|
60
21
|
'verfutbolonline.net': 'Ver Futbol Online',
|
|
61
22
|
'watchsport.gr': 'Watch Sport',
|
|
62
23
|
};
|
|
63
|
-
/* HardCoded End */
|
|
64
24
|
|
|
65
25
|
const socialLinks = [
|
|
66
26
|
'facebook',
|
|
@@ -71,6 +31,7 @@ const socialLinks = [
|
|
|
71
31
|
'wikipedia',
|
|
72
32
|
'youtube',
|
|
73
33
|
];
|
|
34
|
+
/* HardCoded End */
|
|
74
35
|
|
|
75
36
|
function checkSchemaProp(prop) {
|
|
76
37
|
return (
|
|
@@ -138,8 +99,7 @@ export function webPageSchema(page, pageImage) {
|
|
|
138
99
|
name: page.siteSchema?.site_name || '',
|
|
139
100
|
alternateName: page.siteSchema?.alias_site_name || '',
|
|
140
101
|
foundingDate: page.siteSchema?.organization_founding_date || '',
|
|
141
|
-
publishingPrinciples:
|
|
142
|
-
page.siteSchema?.publishing_principles || (isIL || isNSA ? publishingPrinciples : null),
|
|
102
|
+
publishingPrinciples: page.siteSchema?.publishing_principles,
|
|
143
103
|
logo: {
|
|
144
104
|
'@type': 'ImageObject',
|
|
145
105
|
url: pageImage,
|
|
@@ -154,7 +114,7 @@ export function webPageSchema(page, pageImage) {
|
|
|
154
114
|
sameAs: socialLinks
|
|
155
115
|
.map((socialLink) => page.siteSchema?.[socialLink])
|
|
156
116
|
.filter((socialLink) => socialLink),
|
|
157
|
-
...(
|
|
117
|
+
...(page.knowsAbout ? { knowsAbout: page.knowsAbout } : {}),
|
|
158
118
|
},
|
|
159
119
|
};
|
|
160
120
|
|
|
@@ -9,8 +9,6 @@ const parseCheckSchema = (schema) => {
|
|
|
9
9
|
return json;
|
|
10
10
|
};
|
|
11
11
|
const pageImage = 'pageImage/pageImage.jpg';
|
|
12
|
-
const isIL = process.env.GATSBY_SITE_NAME === 'irishluck.ie';
|
|
13
|
-
const isNSA = process.env.GATSBY_SITE_NAME === 'norskespilleautomater.com';
|
|
14
12
|
|
|
15
13
|
describe('Schema Helper', () => {
|
|
16
14
|
test('breadcrumbsSchema()', () => {
|
|
@@ -97,15 +95,7 @@ describe('Schema Helper', () => {
|
|
|
97
95
|
expect(json.author.name).toEqual('Site Name');
|
|
98
96
|
expect(json.author.alternateName).toEqual('Alias Site Name');
|
|
99
97
|
expect(json.author.foundingDate).toEqual('01/02/03');
|
|
100
|
-
|
|
101
|
-
expect(json.author.publishingPrinciples).toEqual(
|
|
102
|
-
isNSA
|
|
103
|
-
? 'https://www.norskespilleautomater.com/om-oss/prinsipper'
|
|
104
|
-
: 'https://www.irishluck.ie/editorial-principles'
|
|
105
|
-
);
|
|
106
|
-
} else {
|
|
107
|
-
expect(json.author.publishingPrinciples).toEqual(null);
|
|
108
|
-
}
|
|
98
|
+
expect(json.author.publishingPrinciples).toEqual(undefined);
|
|
109
99
|
|
|
110
100
|
expect(Object.prototype.toString.call(json.author.logo)).toEqual('[object Object]');
|
|
111
101
|
expect(json.author.logo['@type']).toEqual('ImageObject');
|
|
@@ -131,16 +121,7 @@ describe('Schema Helper', () => {
|
|
|
131
121
|
expect(json.author.sameAs[0]).toEqual('author_linkedin');
|
|
132
122
|
expect(json.author.sameAs[1]).toEqual('author_spotify');
|
|
133
123
|
expect(json.author.sameAs[2]).toEqual('author_wikipedia');
|
|
134
|
-
|
|
135
|
-
if (isNSA) {
|
|
136
|
-
expect(Object.prototype.toString.call(json.author.knowsAbout)).toEqual('[object Array]');
|
|
137
|
-
expect(json.author.knowsAbout).toHaveLength(4);
|
|
138
|
-
expect(Object.prototype.toString.call(json.author.knowsAbout[0])).toEqual('[object Object]');
|
|
139
|
-
expect(json.author.knowsAbout[0]['@type']).toEqual('Thing');
|
|
140
|
-
expect(json.author.knowsAbout[0].name).toEqual('Norway');
|
|
141
|
-
} else {
|
|
142
|
-
expect(json.author.knowsAbout).toEqual(undefined);
|
|
143
|
-
}
|
|
124
|
+
expect(json.author.knowsAbout).toEqual(undefined);
|
|
144
125
|
|
|
145
126
|
expect(Object.prototype.toString.call(json.keywords)).toEqual('[object Array]');
|
|
146
127
|
expect(json.keywords).toHaveLength(2);
|
|
@@ -174,6 +155,13 @@ describe('Schema Helper', () => {
|
|
|
174
155
|
expect(json.sameAs[2]).toEqual('organization_wikipedia');
|
|
175
156
|
});
|
|
176
157
|
|
|
158
|
+
test('moduleSchemas(null)', () => {
|
|
159
|
+
const output = Schema.moduleSchemas([{ name: 'other' }], '/');
|
|
160
|
+
|
|
161
|
+
expect(output).toHaveLength(0);
|
|
162
|
+
expect(output[0]).toEqual(undefined);
|
|
163
|
+
});
|
|
164
|
+
|
|
177
165
|
test('moduleSchemas(faq)', () => {
|
|
178
166
|
const output = Schema.moduleSchemas(
|
|
179
167
|
[
|
|
@@ -221,6 +209,15 @@ describe('Schema Helper', () => {
|
|
|
221
209
|
expect(json.mainEntity[2].acceptedAnswer.text).toEqual('Answer C');
|
|
222
210
|
});
|
|
223
211
|
|
|
212
|
+
test('templateSchemas(null)', () => {
|
|
213
|
+
const output = Schema.templateSchemas({
|
|
214
|
+
type: 'other',
|
|
215
|
+
path: 'other_page',
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
expect(output).toEqual(null);
|
|
219
|
+
});
|
|
220
|
+
|
|
224
221
|
test('templateSchemas(article)', () => {
|
|
225
222
|
const output = Schema.templateSchemas({
|
|
226
223
|
type: 'article',
|
|
@@ -22,6 +22,13 @@ export default function getHeaderSection() {
|
|
|
22
22
|
image_alt: null,
|
|
23
23
|
image_asset_id: 37728,
|
|
24
24
|
},
|
|
25
|
+
reviewer: {
|
|
26
|
+
name: 'Cameron Murphy',
|
|
27
|
+
image: 'cameron-murphy.jpeg',
|
|
28
|
+
image_alt: null,
|
|
29
|
+
image_asset_id: 37728,
|
|
30
|
+
profile_page_path: 'about-us/cameron-murphy',
|
|
31
|
+
},
|
|
25
32
|
},
|
|
26
33
|
};
|
|
27
34
|
|