gatsby-core-theme 41.1.12 → 41.1.14
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 +19 -0
- package/package.json +1 -1
- package/src/components/atoms/admin/bar/preview/index.js +4 -3
- package/src/components/atoms/admin/bar/preview/preview.module.scss +15 -11
- package/src/components/organisms/anchor/template-one/index.js +7 -2
- package/src/components/organisms/anchor/template-two/index.js +8 -3
- package/src/helpers/api.mjs +0 -4
- package/src/helpers/path.js +1 -15
- package/src/helpers/path.test.js +1 -22
- package/src/helpers/processor/index.mjs +2 -2
- package/src/helpers/server-data.js +12 -20
- package/src/hooks/link/index.js +20 -36
- package/src/hooks/link/link.test.js +4 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [41.1.14](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.13...v41.1.14) (2024-12-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add placeholder for anchor ([1982603](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/19826038e2f94a1664ef01e11238c422a7a1fc76))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* Merge branch 'TM-5018-anchor-placeholder' into 'master' ([328a58b](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/328a58b9e15063c8b0adf0c15dd4578369d8051e))
|
|
10
|
+
|
|
11
|
+
## [41.1.13](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.12...v41.1.13) (2024-12-17)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* preview logic ([a524d5c](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/a524d5ca304aca0ea8dba9e1f927aee40babc68c))
|
|
17
|
+
* preview logic ([d8ae855](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/d8ae855070b6ab0a1b7dde77dccb260c96cec25b))
|
|
18
|
+
* preview logic ([c091d63](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/c091d63324c4a4cfced803079e8e210fe5159423))
|
|
19
|
+
|
|
1
20
|
## [41.1.12](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v41.1.11...v41.1.12) (2024-12-17)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -7,16 +7,16 @@ import styles from "./preview.module.scss";
|
|
|
7
7
|
const PreviewLink = ({ page, preview, activeMarket }) => {
|
|
8
8
|
|
|
9
9
|
let path = activeMarket && activeMarket.path_prefix ? page.path.replace(`${activeMarket.path_prefix}/`, '') : page.path;
|
|
10
|
-
path = activeMarket && page.path === `${activeMarket.path_prefix}` ?
|
|
10
|
+
path = activeMarket && page.path === `${activeMarket.path_prefix}` ? activeMarket.path_prefix : path;
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
13
|
<li>
|
|
14
14
|
<a
|
|
15
|
-
className={styles.preview}
|
|
15
|
+
className={`${styles.preview} ${preview ? styles.active : ""}`}
|
|
16
16
|
target={!preview ? "_blank" : ""}
|
|
17
17
|
href={
|
|
18
18
|
!preview
|
|
19
|
-
? `/preview/?path=${path}&
|
|
19
|
+
? `/preview/?path=${path}&page_id=${page.id}`
|
|
20
20
|
: `/${page.path}`
|
|
21
21
|
}
|
|
22
22
|
rel="noreferrer"
|
|
@@ -29,6 +29,7 @@ const PreviewLink = ({ page, preview, activeMarket }) => {
|
|
|
29
29
|
|
|
30
30
|
PreviewLink.propTypes = {
|
|
31
31
|
page: PropTypes.shape({
|
|
32
|
+
id: PropTypes.number,
|
|
32
33
|
path: PropTypes.string,
|
|
33
34
|
market_id: PropTypes.number,
|
|
34
35
|
market: PropTypes.string,
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
.preview {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
color: #fff;
|
|
3
|
+
height: 4rem;
|
|
4
|
+
padding: 0.6rem 1.6rem;
|
|
5
|
+
border-radius: 0.4rem;
|
|
6
|
+
font-weight: 500;
|
|
7
|
+
border: .1rem solid #fff;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
@include flex-direction(row);
|
|
10
|
+
@include flex-align(center, center);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
gap: 0.8rem;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.active {
|
|
16
|
+
border: 0;
|
|
17
|
+
background-color: #165af8;
|
|
18
|
+
}
|
|
@@ -11,6 +11,7 @@ import { IoIosArrowForward } from "@react-icons/all-files/io/IoIosArrowForward";
|
|
|
11
11
|
import isSticky from "~hooks/stickyOnScroll";
|
|
12
12
|
import keygen from "~helpers/keygen";
|
|
13
13
|
import { anchorLink, removeSymbols } from "~helpers/strings";
|
|
14
|
+
import { generatePlaceholderString } from "~helpers/generators";
|
|
14
15
|
|
|
15
16
|
import useTranslate from "~hooks/useTranslate/useTranslate";
|
|
16
17
|
import styles from "./anchor.module.scss";
|
|
@@ -27,10 +28,11 @@ function Anchor({
|
|
|
27
28
|
buttonScroll = 200,
|
|
28
29
|
leftButtonIcon = <IoIosArrowBack />,
|
|
29
30
|
rightButtonIcon = <IoIosArrowForward />,
|
|
31
|
+
page
|
|
30
32
|
}) {
|
|
31
33
|
const [scrollX, setScrollX] = useState(0);
|
|
32
34
|
const [scrollEnd, setScrollEnd] = useState(false);
|
|
33
|
-
|
|
35
|
+
|
|
34
36
|
const itemsRef = useRef([]);
|
|
35
37
|
const anchorContainerRef = useRef(null);
|
|
36
38
|
const anchorListRef = useRef(null);
|
|
@@ -126,7 +128,7 @@ function Anchor({
|
|
|
126
128
|
ref={(el) => (itemsRef.current[index] = el)}
|
|
127
129
|
href={`#${item?.id && item.id}`}
|
|
128
130
|
>
|
|
129
|
-
{useTranslate(item.slug, item.label)}
|
|
131
|
+
{generatePlaceholderString(useTranslate(item.slug, item.label),null, page?.relation)}
|
|
130
132
|
{icon}
|
|
131
133
|
</a>
|
|
132
134
|
</li>
|
|
@@ -200,6 +202,9 @@ Anchor.propTypes = {
|
|
|
200
202
|
rightButtonIcon: PropTypes.shape({}),
|
|
201
203
|
minCharactersForButtons: PropTypes.number,
|
|
202
204
|
setShowButtons: PropTypes.bool,
|
|
205
|
+
page: PropTypes.shape({
|
|
206
|
+
relation:PropTypes.shape({})
|
|
207
|
+
})
|
|
203
208
|
};
|
|
204
209
|
|
|
205
210
|
export default Anchor;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
1
2
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
3
|
/* eslint-disable no-unused-expressions */
|
|
3
4
|
/* eslint-disable prefer-destructuring */
|
|
@@ -10,9 +11,11 @@ import ScollX from 'gatsby-core-theme/src/hooks/scroll-x';
|
|
|
10
11
|
import keygen from '~helpers/keygen';
|
|
11
12
|
import { anchorLink, removeSymbols } from '~helpers/strings';
|
|
12
13
|
import useTranslate from '~hooks/useTranslate/useTranslate';
|
|
14
|
+
import { generatePlaceholderString } from "~helpers/generators";
|
|
15
|
+
|
|
13
16
|
import styles from './template-two.module.scss';
|
|
14
17
|
|
|
15
|
-
function Anchor({ module: { items }, icon = null, showTitle = true, exclOperator = false }) {
|
|
18
|
+
function Anchor({ module: { items }, icon = null, showTitle = true, exclOperator = false, page }) {
|
|
16
19
|
const itemsRef = useRef([]);
|
|
17
20
|
const anchorContainerRef = useRef(null);
|
|
18
21
|
const anchorListRef = useRef(null);
|
|
@@ -49,7 +52,7 @@ function Anchor({ module: { items }, icon = null, showTitle = true, exclOperator
|
|
|
49
52
|
ref={(el) => (itemsRef.current[index] = el)}
|
|
50
53
|
href={`#${item?.id && item.id}`}
|
|
51
54
|
>
|
|
52
|
-
{useTranslate(item.slug, item.label)}
|
|
55
|
+
{generatePlaceholderString(useTranslate(item.slug, item.label), null, page?.relation)}
|
|
53
56
|
{icon}
|
|
54
57
|
</a>
|
|
55
58
|
</li>
|
|
@@ -70,10 +73,12 @@ Anchor.propTypes = {
|
|
|
70
73
|
})
|
|
71
74
|
),
|
|
72
75
|
}).isRequired,
|
|
73
|
-
headerOffset: PropTypes.number,
|
|
74
76
|
styles: PropTypes.shape({}),
|
|
75
77
|
icon: PropTypes.element,
|
|
76
78
|
showTitle: PropTypes.string,
|
|
79
|
+
page: PropTypes.shape({
|
|
80
|
+
relation: PropTypes.shape({})
|
|
81
|
+
})
|
|
77
82
|
};
|
|
78
83
|
|
|
79
84
|
export default Anchor;
|
package/src/helpers/api.mjs
CHANGED
|
@@ -78,10 +78,6 @@ export async function getOperators(params) {
|
|
|
78
78
|
return callAPIV2(`v0.1/operators/operators-sorted-v2${params ? `?${params}` : ''}`);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
// export async function getDepositMethods(params) {
|
|
82
|
-
// return callAPIV2(`v0.1/globals/deposit-methods/sorted-v2/?market_short_codes=ie_en${params ? `?${params}` : ''}`);
|
|
83
|
-
// }
|
|
84
|
-
|
|
85
81
|
export async function getCurrencies() {
|
|
86
82
|
return callAPIV2(`v0.1/globals/currencies/sorted`);
|
|
87
83
|
}
|
package/src/helpers/path.js
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
let previewPath = path;
|
|
3
|
-
if (previewPath && previewPath !== '/' && path.charAt(0) === '/') {
|
|
4
|
-
previewPath = path.substring(1);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
return previewPath;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function previewPath(path) {
|
|
11
|
-
// eslint-disable-next-line no-restricted-globals
|
|
12
|
-
const searchParams2 = typeof window !== 'undefined' ? new URLSearchParams(location.search) : null;
|
|
13
|
-
return `/preview?path=${previewFormat(path)}&market_id=${searchParams2.get('market_id')}`;
|
|
14
|
-
}
|
|
15
|
-
|
|
1
|
+
/* eslint-disable import/prefer-default-export */
|
|
16
2
|
export function formatPath(path) {
|
|
17
3
|
let link = path;
|
|
18
4
|
if (path.charAt(0) !== '/') {
|
package/src/helpers/path.test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { formatPath } from './path';
|
|
2
2
|
|
|
3
3
|
describe('Path format component', () => {
|
|
4
4
|
test('path format adding /', () => {
|
|
@@ -14,25 +14,4 @@ describe('Path format component', () => {
|
|
|
14
14
|
|
|
15
15
|
expect(path).toBe('/test/link');
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
test('preview mode path format removes initial /', () => {
|
|
19
|
-
const path = previewFormat('/test/link');
|
|
20
|
-
expect(typeof path).toEqual('string');
|
|
21
|
-
|
|
22
|
-
expect(path).toBe('test/link');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test('preview mode path navigation removes initial / on path param', () => {
|
|
26
|
-
const path = previewPath('/test/link');
|
|
27
|
-
expect(typeof path).toEqual('string');
|
|
28
|
-
|
|
29
|
-
expect(path).toBe('/preview?path=test/link&market_id=null');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test('preview mode path navigation keep no initial / on path param', () => {
|
|
33
|
-
const path = previewPath('test/link');
|
|
34
|
-
|
|
35
|
-
expect(typeof path).toEqual('string');
|
|
36
|
-
expect(path).toBe('/preview?path=test/link&market_id=null');
|
|
37
|
-
});
|
|
38
17
|
});
|
|
@@ -321,7 +321,7 @@ function updatePlaceholders(page, data, translationsData) {
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
export default {
|
|
324
|
-
run(data, themeOptions, fs, translationsData,
|
|
324
|
+
run(data, themeOptions, fs, translationsData, previewPageID = null) {
|
|
325
325
|
const start = new Date();
|
|
326
326
|
const transformedPages = transform(data);
|
|
327
327
|
|
|
@@ -576,7 +576,7 @@ export default {
|
|
|
576
576
|
transformedPages[market][pageType].forEach((page, index) => {
|
|
577
577
|
page.hreflangs = generateHreflangs(page, data);
|
|
578
578
|
|
|
579
|
-
if ((page.sections && !
|
|
579
|
+
if ((page.sections && !previewPageID) || (previewPageID && page.id === previewPageID)) {
|
|
580
580
|
transformedPages[market][pageType][index] = Object.assign(page, {
|
|
581
581
|
sections: processSections(
|
|
582
582
|
page.sections,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable no-prototype-builtins */
|
|
3
3
|
/* eslint-disable no-nested-ternary */
|
|
4
4
|
/* eslint-disable import/prefer-default-export */
|
|
5
|
-
import chalk from
|
|
5
|
+
import chalk from "chalk";
|
|
6
6
|
import loadSource from "~helpers/search-source";
|
|
7
7
|
import { deparam } from "~helpers/strings";
|
|
8
8
|
import { groupBy } from "~helpers/getters";
|
|
@@ -25,14 +25,10 @@ export async function getAPIData(page, url, headers, preview) {
|
|
|
25
25
|
pagesData,
|
|
26
26
|
operatorData,
|
|
27
27
|
paymentData,
|
|
28
|
-
allMarketsData,
|
|
29
28
|
gamesData,
|
|
30
|
-
providersData
|
|
29
|
+
providersData,
|
|
31
30
|
} = await fetchSiteSettings(siteName, true);
|
|
32
31
|
|
|
33
|
-
const pagePathPrefix = `${params?.market && allMarketsData[params?.market].path_prefix ? `${allMarketsData[params?.market].path_prefix}` : '' }`
|
|
34
|
-
const pagePath = `${pagePathPrefix}${params?.path === '/' && params?.market && allMarketsData[params?.market].path_prefix ? '' : params?.path}`
|
|
35
|
-
|
|
36
32
|
const processed = processor.run(
|
|
37
33
|
{
|
|
38
34
|
...siteSettingsData,
|
|
@@ -47,28 +43,25 @@ export async function getAPIData(page, url, headers, preview) {
|
|
|
47
43
|
operator: operatorData,
|
|
48
44
|
payment_method: paymentData,
|
|
49
45
|
software_provider: providersData,
|
|
50
|
-
game: gamesData
|
|
46
|
+
game: gamesData,
|
|
51
47
|
},
|
|
52
48
|
},
|
|
53
49
|
{},
|
|
54
50
|
null,
|
|
55
51
|
null,
|
|
56
|
-
|
|
52
|
+
parseInt(params?.page_id)
|
|
57
53
|
);
|
|
58
54
|
|
|
59
|
-
console.log(pagePath);
|
|
60
|
-
|
|
61
|
-
|
|
62
55
|
const pagePreviewProcessed = Object.values(pagesData).filter(
|
|
63
|
-
(value) => (value.
|
|
56
|
+
(value) => parseInt(value.id) === parseInt(params?.page_id)
|
|
64
57
|
);
|
|
65
|
-
|
|
66
|
-
if(pagePreviewProcessed.length > 0
|
|
67
|
-
const previewPageData = pagePreviewProcessed[0]
|
|
58
|
+
|
|
59
|
+
if (pagePreviewProcessed.length > 0) {
|
|
60
|
+
const previewPageData = pagePreviewProcessed[0];
|
|
68
61
|
const end = new Date() - start;
|
|
69
62
|
|
|
70
63
|
console.log(
|
|
71
|
-
chalk.green(
|
|
64
|
+
chalk.green("success") + chalk.whiteBright(` Preview Feature - %ds`),
|
|
72
65
|
end / 1000
|
|
73
66
|
);
|
|
74
67
|
return {
|
|
@@ -84,12 +77,11 @@ export async function getAPIData(page, url, headers, preview) {
|
|
|
84
77
|
}
|
|
85
78
|
|
|
86
79
|
console.log(
|
|
87
|
-
chalk.red(
|
|
80
|
+
chalk.red("error") +
|
|
81
|
+
chalk.whiteBright(` Preview Page Not Found ${params?.path}`)
|
|
88
82
|
);
|
|
89
83
|
|
|
90
|
-
return {props: {}};
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
return { props: {} };
|
|
93
85
|
}
|
|
94
86
|
|
|
95
87
|
const results = await loadSource(page.market);
|
package/src/hooks/link/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
import { Link } from
|
|
4
|
-
import PropTypes from
|
|
5
|
-
import {
|
|
3
|
+
import { Link } from "gatsby";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
import { formatPath } from "~helpers/path";
|
|
6
6
|
|
|
7
7
|
function LinkCustom({
|
|
8
8
|
children = <></>,
|
|
9
|
-
to =
|
|
10
|
-
activeClassName =
|
|
9
|
+
to = "",
|
|
10
|
+
activeClassName = "",
|
|
11
11
|
partiallyActive = false,
|
|
12
12
|
external = false,
|
|
13
13
|
nofollow = false,
|
|
@@ -17,11 +17,6 @@ function LinkCustom({
|
|
|
17
17
|
return <>{children}</>;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
let preview = false;
|
|
21
|
-
|
|
22
|
-
if (typeof window !== 'undefined' && window.location.pathname.includes('/preview')) {
|
|
23
|
-
preview = true;
|
|
24
|
-
}
|
|
25
20
|
if (external) {
|
|
26
21
|
return (
|
|
27
22
|
<a
|
|
@@ -37,37 +32,26 @@ function LinkCustom({
|
|
|
37
32
|
);
|
|
38
33
|
}
|
|
39
34
|
return (
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
>
|
|
50
|
-
{children}
|
|
51
|
-
</a>
|
|
52
|
-
) : (
|
|
53
|
-
<Link
|
|
54
|
-
rel={nofollow ? 'nofollow' : null}
|
|
55
|
-
to={formatPath(to)}
|
|
56
|
-
activeClassName={activeClassName}
|
|
57
|
-
partiallyActive={partiallyActive}
|
|
58
|
-
{...other}
|
|
59
|
-
>
|
|
60
|
-
{children}
|
|
61
|
-
</Link>
|
|
62
|
-
)}
|
|
63
|
-
</>
|
|
35
|
+
<Link
|
|
36
|
+
rel={nofollow ? "nofollow" : null}
|
|
37
|
+
to={formatPath(to)}
|
|
38
|
+
activeClassName={activeClassName}
|
|
39
|
+
partiallyActive={partiallyActive}
|
|
40
|
+
{...other}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</Link>
|
|
64
44
|
);
|
|
65
45
|
}
|
|
66
46
|
|
|
67
47
|
LinkCustom.propTypes = {
|
|
68
48
|
to: PropTypes.string,
|
|
69
49
|
nofollow: PropTypes.bool,
|
|
70
|
-
children: PropTypes.oneOfType([
|
|
50
|
+
children: PropTypes.oneOfType([
|
|
51
|
+
PropTypes.node,
|
|
52
|
+
PropTypes.element,
|
|
53
|
+
PropTypes.any,
|
|
54
|
+
]),
|
|
71
55
|
activeClassName: PropTypes.string,
|
|
72
56
|
partiallyActive: PropTypes.bool,
|
|
73
57
|
gtmClass: PropTypes.string,
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
2
2
|
/* eslint-disable no-unused-expressions */
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { render, cleanup
|
|
4
|
+
import { render, cleanup } from '@testing-library/react';
|
|
5
5
|
import '@testing-library/jest-dom/extend-expect';
|
|
6
6
|
import Link from '.';
|
|
7
7
|
|
|
8
8
|
describe('Link Component', () => {
|
|
9
9
|
test('render Link', () => {
|
|
10
|
-
const { container,
|
|
10
|
+
const { container, getByText } = render(
|
|
11
11
|
<Link to="/test/link" className="testClassName">
|
|
12
12
|
Test Content
|
|
13
13
|
</Link>
|
|
14
14
|
);
|
|
15
|
-
expect(getAllByText('Test Content')).toBeTruthy();
|
|
16
15
|
expect(getByText('Test Content').closest('a')).toHaveAttribute('href', '/test/link');
|
|
17
16
|
expect(container.querySelectorAll('.testClassName')).toHaveLength(1);
|
|
18
17
|
});
|
|
@@ -34,27 +33,6 @@ describe('Link Component', () => {
|
|
|
34
33
|
);
|
|
35
34
|
expect(getByText('Test Content').closest('a').classList.contains('test-gtm')).toBe(true);
|
|
36
35
|
});
|
|
37
|
-
test('with window.location.pathname: /preview', () => {
|
|
38
|
-
delete global.window.location;
|
|
39
|
-
global.window ??= Object.create(window);
|
|
40
|
-
global.window.location = {
|
|
41
|
-
pathname: '/preview',
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const { container } = render(
|
|
45
|
-
<Link to="test/link">
|
|
46
|
-
<span>Just Test</span>
|
|
47
|
-
</Link>
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
expect(container.querySelectorAll('a')).toHaveLength(1);
|
|
51
|
-
expect(container.querySelectorAll('a')[0]).toHaveAttribute('href', 'test/link');
|
|
52
|
-
const ahref = container.querySelector('a');
|
|
53
|
-
// eslint-disable-next-line no-lone-blocks
|
|
54
|
-
{
|
|
55
|
-
ahref && fireEvent.click(ahref);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
36
|
|
|
59
37
|
test('Without to false ', () => {
|
|
60
38
|
const { getByText } = render(
|
|
@@ -62,7 +40,7 @@ describe('Link Component', () => {
|
|
|
62
40
|
<span>Just Test</span>
|
|
63
41
|
</Link>
|
|
64
42
|
);
|
|
65
|
-
expect(getByText('Just Test')).
|
|
43
|
+
expect(getByText('Just Test')).toBeInTheDocument();
|
|
66
44
|
});
|
|
67
45
|
|
|
68
46
|
test('Without to ', () => {
|
|
@@ -71,7 +49,7 @@ describe('Link Component', () => {
|
|
|
71
49
|
<span>Just Test 2</span>
|
|
72
50
|
</Link>
|
|
73
51
|
);
|
|
74
|
-
expect(getByText('Just Test 2')).
|
|
52
|
+
expect(getByText('Just Test 2')).toBeInTheDocument();
|
|
75
53
|
});
|
|
76
54
|
});
|
|
77
55
|
afterEach(() => {
|