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.
- package/CHANGELOG.md +59 -0
- package/__mocks__/gatsby.js +16 -4
- package/gatsby-node.esm.js +7 -1
- package/jest.config.js +8 -1
- package/package.json +1 -1
- package/src/components/app.js +1 -17
- package/src/components/atoms/author/author.test.js +12 -5
- package/src/components/atoms/author-box/index.js +9 -11
- package/src/components/atoms/breadcrumbs/breadcrumbs.test.js +8 -0
- package/src/components/atoms/carousel/pagination-item/pagination-item.test.js +18 -3
- package/src/components/atoms/collapse/collapse.test.js +10 -0
- package/src/components/atoms/collapse/index.js +3 -1
- package/src/components/atoms/content-box/content-box.test.js +9 -6
- package/src/components/atoms/content-box/index.js +13 -12
- package/src/components/atoms/custom-select/index.js +31 -30
- package/src/components/atoms/disclaimer/disclaimer.test.js +16 -1
- package/src/components/atoms/iframe/iframe.module.scss +3 -0
- package/src/components/atoms/iframe/iframe.test.js +6 -0
- package/src/components/atoms/image/image.test.js +19 -6
- package/src/components/atoms/image/index.js +2 -4
- package/src/components/atoms/info-grid/index.js +10 -12
- package/src/components/atoms/label/index.js +2 -2
- package/src/components/atoms/label/label.test.js +4 -0
- package/src/components/atoms/module-title/index.js +9 -9
- package/src/components/atoms/module-title/module-title.test.js +76 -0
- package/src/components/atoms/open-graph/open-graph.test.js +34 -5
- package/src/components/atoms/operator-cta/operator-cta.test.js +26 -3
- package/src/components/atoms/scroll-to-top/scroll-to-top.test.js +6 -0
- package/src/components/atoms/search/autocomplete/operator.js +1 -1
- package/src/components/atoms/sitemap/index.js +1 -1
- package/src/components/atoms/spotlights/index.js +55 -53
- package/src/components/atoms/spotlights/spotlights.module.scss +25 -37
- package/src/components/atoms/spotlights/spotlights.test.js +13 -15
- package/src/components/molecules/content/content.test.js +127 -0
- package/src/components/molecules/content/index.js +0 -1
- package/src/components/molecules/header/header.test.js +6 -0
- package/src/components/molecules/main/main.test.js +48 -12
- package/src/components/molecules/menu/menu.test.js +27 -0
- package/src/components/molecules/module/module.test.js +134 -0
- package/src/components/molecules/operator-banner/operator-banner.test.js +7 -1
- package/src/components/molecules/pagination/pagination-with-midpoints.module.scss +48 -49
- package/src/components/organisms/cookie-consent/cookie-consent.test.js +7 -1
- package/src/components/organisms/form/form.test.js +21 -0
- package/src/components/organisms/form/index.js +5 -1
- package/src/components/organisms/navigation/index.js +9 -1
- package/src/components/organisms/search/index.js +0 -1
- package/src/components/organisms/toplist/list/index.js +1 -1
- package/src/components/organisms/toplist/list/list.test.js +30 -0
- package/src/components/pages/body/index.js +4 -6
- package/src/components/pages/tracker/index.js +1 -1
- package/src/constants/settings.js +1 -1
- package/src/helpers/getters.js +1 -6
- package/src/helpers/getters.test.js +1 -3
- package/src/helpers/processor/common.test.js +7 -1
- package/src/helpers/processor/index.js +2 -3
- package/src/helpers/processor/index.test.js +21 -0
- package/src/helpers/schema.js +1 -1
- package/src/helpers/schema.test.js +4 -4
- package/src/hooks/gatsby-img/index.js +1 -1
- package/src/hooks/lazy-image/index.js +1 -1
- package/src/hooks/lazy-image/lazy-image.test.js +39 -0
- package/src/hooks/lazy-picture/index.js +1 -1
- package/src/hooks/link/link.test.js +42 -1
- package/src/hooks/tabs/tab/tab.test.js +41 -0
- package/src/styles/utils/variables/_main.scss +3 -1
- package/tests/envVars.js +1 -1
- package/tests/factories/modules/content.factory.js +6 -3
- package/tests/factories/modules/modules.factory.js +152 -0
- package/tests/factories/modules/schema.factory.js +87 -0
- package/tests/factories/pages/list.factory.js +2 -1
- package/tests/factories/pages/pages.factory.js +192 -0
- package/tests/factories/sections/header.factory.js +8 -2
- package/src/components/atoms/logo/index.js +0 -36
- package/src/components/atoms/logo/logo.module.scss +0 -4
- package/src/components/atoms/logo/logo.stories.js +0 -57
- package/src/components/atoms/logo/logo.test.js +0 -30
- package/src/components/molecules/section/index.js +0 -24
- package/src/components/molecules/section/section.test.js +0 -16
- package/src/components/molecules/sidebar/index.js +0 -25
- package/src/components/molecules/sidebar/sidebar.module.scss +0 -3
- package/src/components/molecules/sidebar/sidebar.test.js +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
+
# [4.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v3.0.0...v4.0.0) (2022-02-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add global variable for pagination border ([6046cad](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6046cad5a846f41220e3a6a7cbf5105c04d2f9a1))
|
|
7
|
+
* added custom styles ([9d4f51c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9d4f51cf96fba24b50b60dce92565c86b9f21334))
|
|
8
|
+
* fix conflicts ([b5fb9c6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b5fb9c6972488ece497a2d5b50a63d7799f63358))
|
|
9
|
+
* fix unit testing ([66f57d3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/66f57d3d4e8192eeb72f852d9834e0d58077a48a))
|
|
10
|
+
* fix unit testing ([88abd13](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/88abd1380c574cadd4c064580e458a862da71590))
|
|
11
|
+
* fix unit testing ([0497042](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0497042d8dc9aadae5f0d49e34ab8d1b3fa0663e))
|
|
12
|
+
* fixed prelive path condition ([b7bf68f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b7bf68fc29de038bf23988d0a16eca3ef5ef9f52))
|
|
13
|
+
* fixed unit testing ([8837446](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/88374469c79e64b7e9f04a1ab3c18bc011adc99f))
|
|
14
|
+
* improve test for cookie and lazy ([7cc8a7d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/7cc8a7da3bc8ffcaffb3b7326eecc0606c648f8c))
|
|
15
|
+
* improve unit testing ([0fbf8fc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0fbf8fcd9e7a1df4d67bfc8e1b82eb433975850c))
|
|
16
|
+
* make unit testing ([7938019](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/793801915c7ccd835ca1976b83824416b86b8126))
|
|
17
|
+
* spotlight tests ([13f617c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/13f617c25ce7a2df84aec7acda9783c63890f59e))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Code Refactoring
|
|
21
|
+
|
|
22
|
+
* add variables to pipeline ([3c7b842](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3c7b8422769ffbc4196fc01770e2fd6df8f29923))
|
|
23
|
+
* changes to variables ([3b5a5a3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3b5a5a31a9de8430e611615b885c387b0f2551b9))
|
|
24
|
+
* cleaning up spotlights module ([9b8c181](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9b8c181311b0dbd5cee0748e239b6ea96c713dea))
|
|
25
|
+
* merge master to branch ([c4de93c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/c4de93c2151a1f681bc7b93515c3e0e7ea606185))
|
|
26
|
+
* remove some unneeded components ([d29df5d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d29df5d0d112ed70fd56da3c5d749daf8e3c9008))
|
|
27
|
+
* remove test data ([8e3c0d6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8e3c0d60652e6a9f9b8541cccebc107c2d14a33d))
|
|
28
|
+
* remove unneeded check ([8007c96](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8007c967a82f5c216bc9196e35b67c1372e882a5))
|
|
29
|
+
* remove unused pipeline ([f4ba474](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/f4ba474b9aa4bda20f1dae293888ee6869823023))
|
|
30
|
+
* test new pipeline ([afbda7c](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/afbda7c3885959cebb2a3e1194dbad352b96a50d))
|
|
31
|
+
* test new pipeline ([74b1667](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/74b1667773a1bbf68e221dc9d990375b4efd61d1))
|
|
32
|
+
* test new pipeline ([0070134](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0070134d06fc8ef0ab8bb59dd82ff9a9a8bbf41f))
|
|
33
|
+
* test new pipeline ([8e4a07f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/8e4a07f910753d911b02b8e71d01f357ac98b3d0))
|
|
34
|
+
* test new pipeline ([918dede](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/918dede9f7bcac0dbc89d8a01797765732039b90))
|
|
35
|
+
* test new pipeline ([38f1572](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/38f15727f255602e46fad0deef41a80a07b2b5e8))
|
|
36
|
+
* update getPageImage conditionals for readability ([3026c02](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3026c02141ec1eb84e4347309571fa22fcf258c4))
|
|
37
|
+
* update img alt tags ([234ae5e](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/234ae5eb892fc437197b79393508da69bc5b768e))
|
|
38
|
+
* update schema publisher logo check ([9cffb56](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/9cffb5661157b3b7e8b549682b72628f4ce3aa04))
|
|
39
|
+
* update tracker pages pageImage generation ([6c6c86f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6c6c86f2eaab60d580f05d9a1c79e19ff1523adf))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Config
|
|
43
|
+
|
|
44
|
+
* increased threshold ([ef1c310](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ef1c31023312841b11af983dab5a5a189124e06a))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
* Merge branch 'tm-2624-spotlight-custom-styles' into 'master' ([18d168b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/18d168befd09fd279bc4a0e775f6a230df303fa0))
|
|
48
|
+
* Merge branch 'tm-2738-trackers-page-image' into 'master' ([cfc1fb4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/cfc1fb413ca4350e2b9b73f72b58e688966eb108))
|
|
49
|
+
* Merge branch 'tm-2715-update-img-alt-tags' into 'master' ([fbbbad6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/fbbbad60e6abc08cfc9c971519023177bbb61ad1))
|
|
50
|
+
* Merge branch 'master' into 'tm-2715-update-img-alt-tags' ([b27f85f](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/b27f85faeb6e843a0d12733635c1524239176b85))
|
|
51
|
+
* Merge branch 'tm-2716-html-cleanup' into 'master' ([83ff1de](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/83ff1de24d90207235833f43093c58edb519d0c4))
|
|
52
|
+
* Merge branch 'master' into 'tm-2715-update-img-alt-tags' ([ab98ebd](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/ab98ebd2ac7a220b4dcaa54ff87d68c1d23529c8))
|
|
53
|
+
* Merge branch 'tm-2706-custom-demo-deployment' into 'master' ([006e13d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/006e13d08f2bb435e99fb35f1bfec76f3f0c2590))
|
|
54
|
+
* Merge branch 'master' into tm-2706-custom-demo-deployment ([eb2483d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eb2483d76b494627555568ee2213ea7b8c6264a7))
|
|
55
|
+
* Merge branch 'tm-2699-unit-testing' into 'master' ([e36d06d](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/e36d06d8cd96bb92468047c319cb467ecdbd9980))
|
|
56
|
+
* Merge branch 'tm-2681-canary-tokens' into 'master' ([d70add6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d70add68ba2ba599f6e44d6686f108c68490168c))
|
|
57
|
+
* Merge branch 'tm-2705-gatsby-deployment-refactor' into 'master' ([d8dbeb2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/d8dbeb238502552d90e7092bca277a3f8873104a))
|
|
58
|
+
* Merge branch 'master' into tm-2705-gatsby-deployment-refactor ([2a11b10](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2a11b1015cf497661cc05ff3eb447921236fe0cc))
|
|
59
|
+
|
|
1
60
|
# [3.0.0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v2.2.6...v3.0.0) (2022-02-08)
|
|
2
61
|
|
|
3
62
|
|
package/__mocks__/gatsby.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
const React = require('react')
|
|
2
|
-
|
|
1
|
+
const React = require('react');
|
|
2
|
+
|
|
3
|
+
const gatsby = jest.requireActual('gatsby');
|
|
3
4
|
|
|
4
5
|
module.exports = {
|
|
5
6
|
...gatsby,
|
|
6
7
|
graphql: jest.fn(),
|
|
7
8
|
Link: jest.fn().mockImplementation(
|
|
8
9
|
// these props are invalid for an `a` tag
|
|
9
|
-
({
|
|
10
|
+
({
|
|
11
|
+
activeClassName,
|
|
12
|
+
activeStyle,
|
|
13
|
+
getProps,
|
|
14
|
+
innerRef,
|
|
15
|
+
partiallyActive,
|
|
16
|
+
ref,
|
|
17
|
+
replace,
|
|
18
|
+
to,
|
|
19
|
+
...rest
|
|
20
|
+
}) =>
|
|
10
21
|
React.createElement('a', {
|
|
11
22
|
...rest,
|
|
12
23
|
href: to,
|
|
@@ -14,4 +25,5 @@ module.exports = {
|
|
|
14
25
|
),
|
|
15
26
|
StaticQuery: jest.fn(),
|
|
16
27
|
useStaticQuery: jest.fn(),
|
|
17
|
-
|
|
28
|
+
navigate: jest.fn(),
|
|
29
|
+
};
|
package/gatsby-node.esm.js
CHANGED
|
@@ -270,6 +270,7 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
270
270
|
component: require.resolve('./src/components/app.js'),
|
|
271
271
|
context: {
|
|
272
272
|
page: trackerPageObject,
|
|
273
|
+
siteInfo,
|
|
273
274
|
provider,
|
|
274
275
|
isTracker: true,
|
|
275
276
|
},
|
|
@@ -299,7 +300,12 @@ exports.createPages = async ({ actions: { createPage } }, themeOptions) => {
|
|
|
299
300
|
createPage({
|
|
300
301
|
path: trackerPath,
|
|
301
302
|
component: require.resolve('./src/components/app.js'),
|
|
302
|
-
context: {
|
|
303
|
+
context: {
|
|
304
|
+
page: trackerPageObject,
|
|
305
|
+
siteInfo,
|
|
306
|
+
operator,
|
|
307
|
+
isTracker: true,
|
|
308
|
+
},
|
|
303
309
|
});
|
|
304
310
|
}
|
|
305
311
|
});
|
package/jest.config.js
CHANGED
|
@@ -20,6 +20,13 @@ module.exports = {
|
|
|
20
20
|
'data.json': '<rootDir>/__mocks__/search-data.json',
|
|
21
21
|
},
|
|
22
22
|
// testPathIgnorePatterns: [`node_modules`, `\\.cache`, `<rootDir>.*/public`],
|
|
23
|
+
coveragePathIgnorePatterns: [
|
|
24
|
+
'tests/helpers',
|
|
25
|
+
'src/components/organisms/search',
|
|
26
|
+
'src/components/molecules/search',
|
|
27
|
+
'src/components/app.js',
|
|
28
|
+
// ''
|
|
29
|
+
],
|
|
23
30
|
transformIgnorePatterns: [`node_modules/(?!(gatsby)/)`],
|
|
24
31
|
globals: {
|
|
25
32
|
__PATH_PREFIX__: ``,
|
|
@@ -29,7 +36,7 @@ module.exports = {
|
|
|
29
36
|
collectCoverage: true,
|
|
30
37
|
coverageThreshold: {
|
|
31
38
|
global: {
|
|
32
|
-
statements:
|
|
39
|
+
statements: 80,
|
|
33
40
|
},
|
|
34
41
|
},
|
|
35
42
|
};
|
package/package.json
CHANGED
package/src/components/app.js
CHANGED
|
@@ -8,7 +8,7 @@ import Body from '~pages/body';
|
|
|
8
8
|
import Head from '~organisms/head';
|
|
9
9
|
|
|
10
10
|
const App = ({ pageContext }) => {
|
|
11
|
-
const { translations, isTracker, isPreview } = pageContext;
|
|
11
|
+
const { translations = {}, isTracker, isPreview } = pageContext;
|
|
12
12
|
const [previewContext, setPreviewContext] = useState({});
|
|
13
13
|
const [isLoading, setIsLoading] = useState({});
|
|
14
14
|
|
|
@@ -33,26 +33,10 @@ const App = ({ pageContext }) => {
|
|
|
33
33
|
window.location = `${window.location.origin}/preview?path=/`;
|
|
34
34
|
}
|
|
35
35
|
getData(searchParams);
|
|
36
|
-
// let { hi, bye } = await import('./say.js');
|
|
37
|
-
// getPreview(pageContext.siteName, searchParams.get('path') || '/', pageContext).then(
|
|
38
|
-
// (previewResponse) => {
|
|
39
|
-
// setPreviewContext(previewResponse);
|
|
40
|
-
// setIsLoading(false);
|
|
41
|
-
// }
|
|
42
|
-
// );
|
|
43
|
-
|
|
44
36
|
globalHistory.listen(({ location }) => {
|
|
45
37
|
setIsLoading(true);
|
|
46
38
|
|
|
47
39
|
getData(null, location.search.replace('?path=', ''));
|
|
48
|
-
// getPreview(pageContext.siteName, location.search.replace('?path=', ''), pageContext)
|
|
49
|
-
// .then((previewResponse) => {
|
|
50
|
-
// setPreviewContext(previewResponse);
|
|
51
|
-
// setIsLoading(false);
|
|
52
|
-
// })
|
|
53
|
-
// .catch(() => {
|
|
54
|
-
// alert('failed to load..');
|
|
55
|
-
// });
|
|
56
40
|
});
|
|
57
41
|
}
|
|
58
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -10,30 +10,37 @@ describe('Author Component', () => {
|
|
|
10
10
|
<Author
|
|
11
11
|
name="mohsen"
|
|
12
12
|
prefix="by"
|
|
13
|
+
authorProfile="/author"
|
|
13
14
|
link="https://twitter.com/name"
|
|
14
15
|
icon={<i className="twitter" />}
|
|
15
16
|
/>
|
|
16
17
|
);
|
|
17
18
|
expect(container.querySelector('.authorInfo')).toBeTruthy();
|
|
18
|
-
const info = getByText('
|
|
19
|
+
const info = getByText('mohsen');
|
|
19
20
|
expect(info).toBeTruthy();
|
|
20
21
|
expect(container.querySelector('a').getAttribute('href')).toEqual('https://twitter.com/name');
|
|
21
22
|
expect(container.querySelector('i.twitter')).toBeTruthy();
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
test('without link and icon', () => {
|
|
25
|
-
const { container
|
|
26
|
+
const { container } = render(<Author name="mohsen" />);
|
|
26
27
|
expect(container.querySelector('.authorInfo')).toBeTruthy();
|
|
27
|
-
const info = getByText('with mohsen');
|
|
28
|
-
expect(info).toBeTruthy();
|
|
29
28
|
expect(container.querySelector('a')).toBeFalsy();
|
|
30
29
|
});
|
|
31
30
|
|
|
32
31
|
test('with date', () => {
|
|
33
|
-
const { container, getByText } = render(
|
|
32
|
+
const { container, getByText } = render(
|
|
33
|
+
<Author
|
|
34
|
+
name="mohsen"
|
|
35
|
+
icon={<i className="twitter" />}
|
|
36
|
+
prefix="with"
|
|
37
|
+
date="2020-04-24 15:37:42"
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
34
40
|
expect(container.querySelector('.date')).toBeTruthy();
|
|
35
41
|
const info = getByText('with mohsen');
|
|
36
42
|
expect(info).toBeTruthy();
|
|
43
|
+
expect(container.querySelector('i')).toBeTruthy();
|
|
37
44
|
expect(container.querySelector('a')).toBeFalsy();
|
|
38
45
|
});
|
|
39
46
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/no-danger */
|
|
1
2
|
import React, { useContext } from 'react';
|
|
2
3
|
import { FaInstagram, FaFacebookSquare, FaTwitter, FaLinkedin } from 'react-icons/fa';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
@@ -19,17 +20,14 @@ export default function AuthorBox({ author }) {
|
|
|
19
20
|
<div className={styles.container}>
|
|
20
21
|
<div className={styles.innerContainer}>
|
|
21
22
|
<div className={styles.information}>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/>
|
|
31
|
-
)}
|
|
32
|
-
</div>
|
|
23
|
+
{author.image_object && (
|
|
24
|
+
<LazyImage
|
|
25
|
+
src={imagePrettyUrl(author.image_object.filename)}
|
|
26
|
+
alt={author.image_alt}
|
|
27
|
+
width={author.image_object?.width}
|
|
28
|
+
height={author.image_object?.height}
|
|
29
|
+
/>
|
|
30
|
+
)}
|
|
33
31
|
<span className={styles.name}>{author.name}</span>
|
|
34
32
|
<p className={styles.title}>{author.author_title}</p>
|
|
35
33
|
</div>
|
|
@@ -20,6 +20,14 @@ describe('Show Breadcrumbs in a page', () => {
|
|
|
20
20
|
const { container } = render(<Breadcrumbs page={page} />);
|
|
21
21
|
expect(container).toBeEmptyDOMElement();
|
|
22
22
|
});
|
|
23
|
+
test('Breadcrumb when we dont have link', () => {
|
|
24
|
+
const page = {
|
|
25
|
+
...getPageData(),
|
|
26
|
+
breadcrumbs: [{ label: 'Sport', path: null }],
|
|
27
|
+
};
|
|
28
|
+
const { container } = render(<Breadcrumbs page={page} />);
|
|
29
|
+
expect(container.querySelectorAll('a')).toHaveLength(1);
|
|
30
|
+
});
|
|
23
31
|
test('Vanity label', () => {
|
|
24
32
|
const page = {
|
|
25
33
|
vanity_label: 'Alternative title',
|
|
@@ -9,18 +9,33 @@ const currentSlide = 3;
|
|
|
9
9
|
|
|
10
10
|
describe('Pagination Item Component', () => {
|
|
11
11
|
test('render pagination item', () => {
|
|
12
|
-
const { container } = render(
|
|
12
|
+
const { container } = render(
|
|
13
|
+
<PaginationItem slideIndex={currentSlide} type="dots" totalSlides={5} />
|
|
14
|
+
);
|
|
13
15
|
expect(container.querySelectorAll('button.paginationItem')).toHaveLength(5);
|
|
14
16
|
expect(container.querySelectorAll('button.paginationItem.active')).toHaveLength(1);
|
|
15
17
|
});
|
|
16
18
|
test('on click', () => {
|
|
17
19
|
const paginationClick = jest.fn();
|
|
18
20
|
|
|
19
|
-
const { container } = render(
|
|
21
|
+
const { container } = render(
|
|
22
|
+
<PaginationItem
|
|
23
|
+
slideIndex={currentSlide}
|
|
24
|
+
type="dots"
|
|
25
|
+
totalSlides={5}
|
|
26
|
+
paginationHandler={paginationClick}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
20
29
|
const paginationItemBtn = container.querySelector('button.paginationItem.active');
|
|
21
30
|
fireEvent.click(paginationItemBtn);
|
|
31
|
+
fireEvent.keyDown(paginationItemBtn);
|
|
22
32
|
expect(paginationClick).toHaveBeenCalled();
|
|
23
|
-
expect(paginationClick).toHaveBeenCalledWith(3)
|
|
33
|
+
expect(paginationClick).toHaveBeenCalledWith(3);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('render empty', () => {
|
|
37
|
+
const { container } = render(<PaginationItem totalSlides={0} />);
|
|
38
|
+
expect(container.querySelector('button')).toBeFalsy();
|
|
24
39
|
});
|
|
25
40
|
});
|
|
26
41
|
afterEach(() => {
|
|
@@ -27,6 +27,16 @@ describe('Collapse Component', () => {
|
|
|
27
27
|
// jest does not render the component, hence testing the actual layout cannot be done due to the collapse using scrollHeight.
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
+
test('Open collapse with different initial height', () => {
|
|
31
|
+
const { container } = render(
|
|
32
|
+
<Collapse buttonText="Open" maxHeight={20} contentText="Content Text" />
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const button = container.querySelector('button');
|
|
36
|
+
fireEvent.click(button);
|
|
37
|
+
expect(button.classList.contains('active')).toBeFalsy();
|
|
38
|
+
});
|
|
39
|
+
|
|
30
40
|
test('Only Mobile', () => {
|
|
31
41
|
const { container } = render(
|
|
32
42
|
<Collapse buttonText="Open" contentText="Content Text" onlyMobile />
|
|
@@ -10,8 +10,9 @@ const Collapse = ({
|
|
|
10
10
|
onlyMobile = false,
|
|
11
11
|
onlyDesktop = false,
|
|
12
12
|
initOpen = false,
|
|
13
|
+
maxHeight = 0,
|
|
13
14
|
}) => {
|
|
14
|
-
const [maxHeightStyle, setMaxHeightStyle] = useState(
|
|
15
|
+
const [maxHeightStyle, setMaxHeightStyle] = useState(maxHeight);
|
|
15
16
|
const contentRef = useRef(React.createRef());
|
|
16
17
|
let showButton = true;
|
|
17
18
|
const isMobile = useIsMobile();
|
|
@@ -68,6 +69,7 @@ Collapse.propTypes = {
|
|
|
68
69
|
onlyMobile: PropTypes.bool,
|
|
69
70
|
onlyDesktop: PropTypes.bool,
|
|
70
71
|
initOpen: PropTypes.bool,
|
|
72
|
+
maxHeight: PropTypes.number,
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
export default Collapse;
|
|
@@ -8,20 +8,17 @@ const info = [
|
|
|
8
8
|
{
|
|
9
9
|
title: 'Fully licensed casinos',
|
|
10
10
|
image: '../../../images/content-1.png',
|
|
11
|
-
text:
|
|
12
|
-
'We only list and review fully licensed and legally operating casinos so you can be sure where you end up playing will be safe and secure.',
|
|
11
|
+
text: 'We only list and review fully licensed and legally operating casinos so you can be sure where you end up playing will be safe and secure.',
|
|
13
12
|
},
|
|
14
13
|
{
|
|
15
14
|
title: 'Get the most for your money',
|
|
16
15
|
image: '../../../images/content-2.png',
|
|
17
|
-
text:
|
|
18
|
-
'We list all the features the Casinos have to offer so you can make an educated decision about where to place your money for maximum gains!',
|
|
16
|
+
text: 'We list all the features the Casinos have to offer so you can make an educated decision about where to place your money for maximum gains!',
|
|
19
17
|
},
|
|
20
18
|
{
|
|
21
19
|
title: 'Authenticly written articles',
|
|
22
20
|
image: '../../../images/content-3.png',
|
|
23
|
-
text:
|
|
24
|
-
'All our Authors are professional writers with industry know-how, so you can depend on what we say is the truth!',
|
|
21
|
+
text: 'All our Authors are professional writers with industry know-how, so you can depend on what we say is the truth!',
|
|
25
22
|
},
|
|
26
23
|
];
|
|
27
24
|
|
|
@@ -32,6 +29,12 @@ describe('ContentBox Component', () => {
|
|
|
32
29
|
expect(getByText('Authenticly written articles')).toBeTruthy();
|
|
33
30
|
expect(container.querySelectorAll('.icon')).toHaveLength(3);
|
|
34
31
|
});
|
|
32
|
+
|
|
33
|
+
test('render without props', () => {
|
|
34
|
+
const { container } = render(<ContentBox data={[]} />);
|
|
35
|
+
|
|
36
|
+
expect(container.querySelector('li')).toBeFalsy();
|
|
37
|
+
});
|
|
35
38
|
});
|
|
36
39
|
afterEach(() => {
|
|
37
40
|
cleanup();
|
|
@@ -8,19 +8,20 @@ import styles from './content-box.module.scss';
|
|
|
8
8
|
const ContentBox = ({ data = [] }) => (
|
|
9
9
|
<div className={styles.contentBoxContainer}>
|
|
10
10
|
<ul className={styles.contentBoxList}>
|
|
11
|
-
{data
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
<div className={styles.
|
|
15
|
-
<
|
|
11
|
+
{data &&
|
|
12
|
+
data.map((item) => (
|
|
13
|
+
<li key={keygen()}>
|
|
14
|
+
<div className={styles.item}>
|
|
15
|
+
<div className={styles.icon}>
|
|
16
|
+
<LazyImage alt={item.title} src={item.image} />
|
|
17
|
+
</div>
|
|
18
|
+
<div className={styles.body}>
|
|
19
|
+
<div className="h2">{item.title}</div>
|
|
20
|
+
<p>{item.text}</p>
|
|
21
|
+
</div>
|
|
16
22
|
</div>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<p>{item.text}</p>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</li>
|
|
23
|
-
))}
|
|
23
|
+
</li>
|
|
24
|
+
))}
|
|
24
25
|
</ul>
|
|
25
26
|
</div>
|
|
26
27
|
);
|
|
@@ -35,39 +35,40 @@ const CustomSelect = ({
|
|
|
35
35
|
onClick={showDropdown}
|
|
36
36
|
data-id="select-button"
|
|
37
37
|
>
|
|
38
|
-
{selectedOption[itemsLabel]}
|
|
38
|
+
{selectedOption && selectedOption[itemsLabel]}
|
|
39
39
|
</button>
|
|
40
40
|
<ol ref={selectList} className={styles.list} data-id="select-list">
|
|
41
|
-
{options
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
currentItem[itemsValue]
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
currentItem.type
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<button
|
|
58
|
-
type="button"
|
|
59
|
-
className="custom-select-gtm btn-cta"
|
|
60
|
-
onClick={() => {
|
|
61
|
-
onClick(currentItem[itemsValue], currentItem[itemsLabel], currentItem.type);
|
|
62
|
-
setSelectedOption(currentItem);
|
|
63
|
-
showDropdown();
|
|
64
|
-
}}
|
|
41
|
+
{options &&
|
|
42
|
+
options.map((item) => {
|
|
43
|
+
if (item[itemsValue] === selectedOption[itemsValue]) return null;
|
|
44
|
+
const currentItem = item;
|
|
45
|
+
if (currentItem[itemsValue] === undefined) {
|
|
46
|
+
currentItem[itemsValue] = 'id';
|
|
47
|
+
}
|
|
48
|
+
if (currentItem.type === undefined) {
|
|
49
|
+
currentItem.type = 'type';
|
|
50
|
+
}
|
|
51
|
+
return (
|
|
52
|
+
<li
|
|
53
|
+
className={styles.selectListItem}
|
|
54
|
+
key={keygen()}
|
|
55
|
+
data-value={currentItem[itemsValue]}
|
|
56
|
+
data-type={currentItem.type}
|
|
65
57
|
>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
<button
|
|
59
|
+
type="button"
|
|
60
|
+
className="custom-select-gtm btn-cta"
|
|
61
|
+
onClick={() => {
|
|
62
|
+
onClick(currentItem[itemsValue], currentItem[itemsLabel], currentItem.type);
|
|
63
|
+
setSelectedOption(currentItem);
|
|
64
|
+
showDropdown();
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
{currentItem[itemsLabel]}
|
|
68
|
+
</button>
|
|
69
|
+
</li>
|
|
70
|
+
);
|
|
71
|
+
})}
|
|
71
72
|
</ol>
|
|
72
73
|
</div>
|
|
73
74
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/* eslint-disable no-unused-expressions */
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { render, cleanup } from '@testing-library/react';
|
|
3
|
+
import { render, cleanup, fireEvent } from '@testing-library/react';
|
|
3
4
|
|
|
4
5
|
import '@testing-library/jest-dom/extend-expect';
|
|
5
6
|
|
|
@@ -17,6 +18,20 @@ describe('Disclaimer Component', () => {
|
|
|
17
18
|
const { container } = render(<Disclaimer image={dmcaImg} />);
|
|
18
19
|
expect(container.querySelectorAll('a')).toHaveLength(1);
|
|
19
20
|
expect(container.querySelectorAll('img')).toHaveLength(1);
|
|
21
|
+
const ahref = container.querySelector('a');
|
|
22
|
+
// eslint-disable-next-line no-lone-blocks
|
|
23
|
+
{
|
|
24
|
+
ahref &&
|
|
25
|
+
fireEvent.change(ahref, {
|
|
26
|
+
target: {
|
|
27
|
+
href: '//www.dmca.com/Protection/Status.aspx?ID=9e466e76-827d-4247-ac51-4eb75b227301',
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// eslint-disable-next-line no-lone-blocks
|
|
32
|
+
{
|
|
33
|
+
ahref && fireEvent.click(container.querySelector('a'));
|
|
34
|
+
}
|
|
20
35
|
});
|
|
21
36
|
});
|
|
22
37
|
afterEach(() => {
|
|
@@ -22,6 +22,12 @@ describe('Iframe Component', () => {
|
|
|
22
22
|
expect(iframe.getAttribute('style')).toEqual('width: 100%; min-height: 10rem; display: block;');
|
|
23
23
|
expect(iframe.getAttribute('src')).toEqual('http://google.com');
|
|
24
24
|
});
|
|
25
|
+
|
|
26
|
+
test('without data', () => {
|
|
27
|
+
const { container } = render(<Iframe src="http://google.com" />);
|
|
28
|
+
|
|
29
|
+
expect(container.querySelector('iframe')).toBeFalsy();
|
|
30
|
+
});
|
|
25
31
|
});
|
|
26
32
|
afterEach(() => {
|
|
27
33
|
cleanup();
|
|
@@ -5,13 +5,13 @@ import '@testing-library/jest-dom/extend-expect';
|
|
|
5
5
|
import Image from '.';
|
|
6
6
|
|
|
7
7
|
describe('Image Component', () => {
|
|
8
|
+
const imageModule = {
|
|
9
|
+
alignment: 'align_right',
|
|
10
|
+
alt: 'image alt',
|
|
11
|
+
title: 'title',
|
|
12
|
+
value: 'image.png',
|
|
13
|
+
};
|
|
8
14
|
test('render', () => {
|
|
9
|
-
const imageModule = {
|
|
10
|
-
alignment: 'align_right',
|
|
11
|
-
alt: 'image alt',
|
|
12
|
-
title: 'title',
|
|
13
|
-
value: 'image.png',
|
|
14
|
-
};
|
|
15
15
|
const { container } = render(<Image module={imageModule} />);
|
|
16
16
|
expect(container).toBeTruthy();
|
|
17
17
|
|
|
@@ -19,6 +19,19 @@ describe('Image Component', () => {
|
|
|
19
19
|
// expect(container.querySelector('img')).toBeFalsy();
|
|
20
20
|
// expect(container.querySelector('div.lazyload-placeholder')).toBeTruthy();
|
|
21
21
|
});
|
|
22
|
+
|
|
23
|
+
test('render without data', () => {
|
|
24
|
+
const { container } = render(<Image />);
|
|
25
|
+
|
|
26
|
+
expect(container.querySelector('img')).toBeFalsy();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('render without alt ', () => {
|
|
30
|
+
delete imageModule.alt;
|
|
31
|
+
const { container } = render(<Image module={imageModule} />);
|
|
32
|
+
|
|
33
|
+
expect(container).toBeTruthy();
|
|
34
|
+
});
|
|
22
35
|
});
|
|
23
36
|
afterEach(() => {
|
|
24
37
|
cleanup();
|
|
@@ -6,19 +6,17 @@ import { imagePrettyUrl } from '~helpers/getters';
|
|
|
6
6
|
import styles from './image.module.scss';
|
|
7
7
|
|
|
8
8
|
const Image = ({ module = {} }) => {
|
|
9
|
-
const { title, value, alt, alignment } = module;
|
|
9
|
+
const { title, value, alt = 'missing alt', alignment } = module;
|
|
10
10
|
|
|
11
11
|
if (!value) return <></>;
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<div>
|
|
15
14
|
<LazyImage
|
|
16
15
|
src={imagePrettyUrl(value)}
|
|
17
|
-
alt={alt
|
|
16
|
+
alt={alt || 'missing alt'}
|
|
18
17
|
title={title && title}
|
|
19
18
|
className={`${styles.imageModule} ${styles[alignment]}`}
|
|
20
19
|
/>
|
|
21
|
-
</div>
|
|
22
20
|
);
|
|
23
21
|
};
|
|
24
22
|
|
|
@@ -4,18 +4,16 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import styles from './info-grid.module.scss';
|
|
5
5
|
import keygen from '~helpers/keygen';
|
|
6
6
|
|
|
7
|
-
const InfoGrid = ({ data }) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
<div
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
);
|
|
18
|
-
};
|
|
7
|
+
const InfoGrid = ({ data }) => (
|
|
8
|
+
<div className={styles.infoGridContainer}>
|
|
9
|
+
{data.map((row) => (
|
|
10
|
+
<div key={keygen()} className={styles.infoGridItem}>
|
|
11
|
+
<div className={styles.infoGridItemTitle}>{row.name}</div>
|
|
12
|
+
<div className={styles.infoGridItemValue}>{row.value}</div>
|
|
13
|
+
</div>
|
|
14
|
+
))}
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
19
17
|
InfoGrid.propTypes = {
|
|
20
18
|
data: PropTypes.arrayOf(PropTypes.shape({ name: PropTypes.string, value: PropTypes.string }))
|
|
21
19
|
.isRequired,
|