Skip to content

Commit

Permalink
update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
fboldo committed Sep 22, 2023
1 parent a00c0b1 commit 8e8a850
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ exports[`Breadcrumb base element matches snapshot: BaseBreadcrumbs 1`] = `
`;

exports[`Breadcrumb renders with children: BreadcrumbWithChildren 1`] = `
<Breadcrumb
aria-label="Breadcrumb"
>
<Breadcrumb>
<nav
aria-label="Breadcrumb"
className="nhsuk-breadcrumb"
Expand Down
24 changes: 7 additions & 17 deletions src/components/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ export const Button: React.FC<ButtonProps> = ({
disabled,
secondary,
reverse,
type = 'submit',
...rest
}) => (
// eslint-disable-next-line react/button-has-type
<button
type={type}
className={classNames(
'nhsuk-button',
{ 'nhsuk-button--disabled': disabled },
Expand All @@ -40,13 +42,12 @@ export const Button: React.FC<ButtonProps> = ({

export const ButtonLink: React.FC<ButtonLinkProps> = ({
className,
role,
draggable,
role = 'button',
draggable = false,
children,
disabled,
secondary,
reverse,
type = 'submit',
...rest
}) => (
<a
Expand All @@ -57,7 +58,6 @@ export const ButtonLink: React.FC<ButtonLinkProps> = ({
{ 'nhsuk-button--reverse': reverse },
className,
)}
type={type}
role={role}
aria-disabled={disabled ? 'true' : 'false'}
draggable={draggable}
Expand All @@ -67,26 +67,16 @@ export const ButtonLink: React.FC<ButtonLinkProps> = ({
</a>
);

const ButtonWrapper: React.FC<ButtonLinkProps | ButtonProps> = ({
href,
as,
role = 'button',
draggable = false,
...rest
}) => {
const ButtonWrapper: React.FC<ButtonLinkProps | ButtonProps> = ({ href, as, ...rest }) => {
const buttonProps = { type: 'submit', ...rest } as ButtonProps;
if (as === 'a') {
return (
<ButtonLink role={role} draggable={draggable} href={href} {...(rest as ButtonLinkProps)} />
);
return <ButtonLink href={href} {...(rest as ButtonLinkProps)} />;
}
if (as === 'button') {
return <Button {...buttonProps} />;
}
if (href) {
return (
<ButtonLink role={role} draggable={draggable} href={href} {...(rest as ButtonLinkProps)} />
);
return <ButtonLink href={href} {...(rest as ButtonLinkProps)} />;
}
return <Button {...buttonProps} />;
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Card: ICard = ({ className, clickable, children, feature = false, ...rest
)}
{...rest}
>
<CardContext.Provider value={{ feature: Boolean(feature) }}>{children}</CardContext.Provider>
<CardContext.Provider value={{ feature: feature }}>{children}</CardContext.Provider>
</div>
);

Expand Down
24 changes: 6 additions & 18 deletions src/components/card/__tests__/__snapshots__/Card.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,15 @@ exports[`Card Card.Group matches snapshot 1`] = `
<div
className="nhsuk-grid-column-one-half nhsuk-card-group__item"
>
<Card
feature={false}
>
<Card>
<div
className="nhsuk-card"
>
<CardContent>
<div
className="nhsuk-card__content"
>
<CardHeading
headingLevel="h2"
>
<CardHeading>
<HeadingLevel
className="nhsuk-card__heading"
headingLevel="h2"
Expand Down Expand Up @@ -66,19 +62,15 @@ exports[`Card Card.Group matches snapshot 1`] = `
<div
className="nhsuk-grid-column-one-half nhsuk-card-group__item"
>
<Card
feature={false}
>
<Card>
<div
className="nhsuk-card"
>
<CardContent>
<div
className="nhsuk-card__content"
>
<CardHeading
headingLevel="h2"
>
<CardHeading>
<HeadingLevel
className="nhsuk-card__heading"
headingLevel="h2"
Expand Down Expand Up @@ -110,9 +102,7 @@ exports[`Card Card.Group matches snapshot 1`] = `
`;

exports[`Card matches snapshot 1`] = `
<Card
feature={false}
>
<Card>
<div
className="nhsuk-card"
>
Expand All @@ -130,9 +120,7 @@ exports[`Card matches snapshot 1`] = `
<div
className="nhsuk-card__content"
>
<CardHeading
headingLevel="h2"
>
<CardHeading>
<HeadingLevel
className="nhsuk-card__heading"
headingLevel="h2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ exports[`Checkboxes matches snapshot 1`] = `
id="example"
>
<Box
type="checkbox"
value="animal"
>
<div
Expand Down Expand Up @@ -54,7 +53,6 @@ exports[`Checkboxes matches snapshot 1`] = `
</div>
</Box>
<Box
type="checkbox"
value="mines"
>
<div
Expand Down Expand Up @@ -90,7 +88,6 @@ exports[`Checkboxes matches snapshot 1`] = `
</div>
</Box>
<Box
type="checkbox"
value="farm"
>
<div
Expand Down Expand Up @@ -151,7 +148,6 @@ exports[`Checkboxes matches snapshot with boolean error 1`] = `
id="example"
>
<Box
type="checkbox"
value="animal"
>
<div
Expand Down Expand Up @@ -187,7 +183,6 @@ exports[`Checkboxes matches snapshot with boolean error 1`] = `
</div>
</Box>
<Box
type="checkbox"
value="mines"
>
<div
Expand Down Expand Up @@ -223,7 +218,6 @@ exports[`Checkboxes matches snapshot with boolean error 1`] = `
</div>
</Box>
<Box
type="checkbox"
value="farm"
>
<div
Expand Down Expand Up @@ -281,8 +275,6 @@ exports[`Checkboxes matches snapshot with string error 1`] = `
>
<ErrorMessage
id="example--error-message"
role="alert"
visuallyHiddenText="Error: "
>
<span
className="nhsuk-error-message"
Expand All @@ -302,7 +294,6 @@ exports[`Checkboxes matches snapshot with string error 1`] = `
id="example"
>
<Box
type="checkbox"
value="animal"
>
<div
Expand Down Expand Up @@ -338,7 +329,6 @@ exports[`Checkboxes matches snapshot with string error 1`] = `
</div>
</Box>
<Box
type="checkbox"
value="mines"
>
<div
Expand Down Expand Up @@ -374,7 +364,6 @@ exports[`Checkboxes matches snapshot with string error 1`] = `
</div>
</Box>
<Box
type="checkbox"
value="farm"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ exports[`DateInput matches snapshot 1`] = `
>
<DayInput>
<IndividualDateInput
inputMode="numeric"
inputType="day"
pattern="[0-9]*"
type="text"
>
<div
className="nhsuk-date-input__item"
Expand Down Expand Up @@ -65,10 +62,7 @@ exports[`DateInput matches snapshot 1`] = `
</DayInput>
<MonthInput>
<IndividualDateInput
inputMode="numeric"
inputType="month"
pattern="[0-9]*"
type="text"
>
<div
className="nhsuk-date-input__item"
Expand Down Expand Up @@ -111,10 +105,7 @@ exports[`DateInput matches snapshot 1`] = `
</MonthInput>
<YearInput>
<IndividualDateInput
inputMode="numeric"
inputType="year"
pattern="[0-9]*"
type="text"
>
<div
className="nhsuk-date-input__item"
Expand Down
2 changes: 1 addition & 1 deletion src/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface Footer extends React.FC<FooterProps> {
Copyright: React.FC<HTMLProps<HTMLParagraphElement>>;
}

const Footer: Footer = ({ className, children, visuallyHiddenText, ...rest }) => (
const Footer: Footer = ({ className, children, visuallyHiddenText = 'Support links', ...rest }) => (
<footer {...rest}>
<div className={classNames('nhsuk-footer', className)}>
<Container>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Hero Hero.Heading matches snapshot: Hero.Heading 1`] = `
<HeroHeading
headingLevel="h1"
>
<HeroHeading>
<HeadingLevel
className="nhsuk-u-margin-bottom-3"
headingLevel="h1"
Expand Down
Loading

0 comments on commit 8e8a850

Please sign in to comment.