Skip to content

Commit 8f08fe3

Browse files
committed
all tests working
1 parent 7a008eb commit 8f08fe3

File tree

6 files changed

+10
-8
lines changed

6 files changed

+10
-8
lines changed

src/components/navigation/breadcrumb/__tests__/Breadcrumb.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ describe('Breadcrumb', () => {
8787
},
8888
);
8989

90-
it.each<string | undefined>([undefined, 'button'])(
90+
it.each<'a' | undefined>([undefined, 'a'])(
9191
'Renders with asElement when specified as %s',
9292
(asElement) => {
9393
const { container } = render(

src/components/navigation/breadcrumb/__tests__/__snapshots__/Breadcrumb.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`Breadcrumb base element matches snapshot: BaseBreadcrumbs 1`] = `
44
<div>

src/components/navigation/card/__tests__/__snapshots__/Card.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`Card Card.Group matches snapshot 1`] = `
44
<div>

src/components/navigation/card/components/CardLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { ElementType, FC } from 'react';
22
import classNames from 'classnames';
33
import { AsElementLink } from '@util/types/LinkTypes';
44

5-
interface CardLinkProps extends AsElementLink {
5+
interface CardLinkProps extends AsElementLink<React.ElementType> {
66
className?: string;
77
}
88

src/components/navigation/header/__tests__/__snapshots__/Header.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`The header component Matches the snapshot 1`] = `
44
<div>

src/components/navigation/header/components/OrganisationalLogo.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import React, { FC, useContext } from 'react';
33
import HeaderContext, { IHeaderContext } from '../HeaderContext';
44
import { AsElementLink } from '@util/types/LinkTypes';
55

6-
export interface OrganisationalLogoProps extends AsElementLink<HTMLAnchorElement> {
6+
export interface OrganisationalLogoProps extends AsElementLink<'a'> {
77
logoUrl?: string;
8+
alt?: string;
89
}
910

1011
const OrganisationalLogo: FC<OrganisationalLogoProps> = ({
@@ -13,10 +14,11 @@ const OrganisationalLogo: FC<OrganisationalLogoProps> = ({
1314
asElement: Component = 'a',
1415
...rest
1516
}) => {
17+
const ElementComponent = Component as React.ElementType;
1618
const { orgName, orgSplit, orgDescriptor } = useContext<IHeaderContext>(HeaderContext);
1719
return (
1820
<div className="nhsuk-header__logo">
19-
<Component className="nhsuk-header__link" {...rest}>
21+
<ElementComponent className="nhsuk-header__link" {...rest}>
2022
{logoUrl ? (
2123
<img className="nhsuk-org-logo" src={logoUrl} alt={alt} />
2224
) : (
@@ -48,7 +50,7 @@ const OrganisationalLogo: FC<OrganisationalLogoProps> = ({
4850
) : null}
4951
</>
5052
)}
51-
</Component>
53+
</ElementComponent>
5254
</div>
5355
);
5456
};

0 commit comments

Comments
 (0)