Skip to content

Commit 311c35e

Browse files
Add missing summary list row noBorder prop
1 parent d291a07 commit 311c35e

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

src/components/content-presentation/summary-list/__tests__/SummaryList.test.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ describe('SummaryList', () => {
1010
expect(container).toMatchSnapshot('SummaryList');
1111
});
1212

13+
it('matches snapshot without border', () => {
14+
const { container } = render(<SummaryList noBorder />);
15+
16+
expect(container).toMatchSnapshot();
17+
});
18+
1319
it('forwards refs', () => {
1420
const ref = createRef<HTMLDListElement>();
1521

@@ -34,6 +40,13 @@ describe('SummaryList', () => {
3440
expect(container.textContent).toBe('Row');
3541
expect(container).toMatchSnapshot();
3642
});
43+
44+
it('matches snapshot without border', () => {
45+
const { container } = render(<SummaryList.Row noBorder>Row</SummaryList.Row>);
46+
47+
expect(container).toHaveTextContent('Row');
48+
expect(container).toMatchSnapshot();
49+
});
3750
});
3851

3952
describe('SummaryList.Key', () => {

src/components/content-presentation/summary-list/__tests__/__snapshots__/SummaryList.test.tsx.snap

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ exports[`SummaryList SummaryList.Row matches snapshot 1`] = `
3030
</div>
3131
`;
3232

33+
exports[`SummaryList SummaryList.Row matches snapshot without border 1`] = `
34+
<div>
35+
<div
36+
class="nhsuk-summary-list__row nhsuk-summary-list__row--no-border"
37+
>
38+
Row
39+
</div>
40+
</div>
41+
`;
42+
3343
exports[`SummaryList SummaryList.Value matches snapshot 1`] = `
3444
<div>
3545
<dd
@@ -40,6 +50,14 @@ exports[`SummaryList SummaryList.Value matches snapshot 1`] = `
4050
</div>
4151
`;
4252

53+
exports[`SummaryList matches snapshot without border 1`] = `
54+
<div>
55+
<dl
56+
class="nhsuk-summary-list nhsuk-summary-list--no-border"
57+
/>
58+
</div>
59+
`;
60+
4361
exports[`SummaryList matches snapshot: SummaryList 1`] = `
4462
<div>
4563
<dl
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
import classNames from 'classnames';
22
import { type ComponentPropsWithoutRef, type FC } from 'react';
33

4-
export const SummaryListRow: FC<ComponentPropsWithoutRef<'div'>> = ({ className, ...rest }) => (
5-
<div className={classNames('nhsuk-summary-list__row', className)} {...rest} />
4+
export interface SummaryListRowProps extends ComponentPropsWithoutRef<'div'> {
5+
noBorder?: boolean;
6+
}
7+
8+
export const SummaryListRow: FC<SummaryListRowProps> = ({ className, noBorder, ...rest }) => (
9+
<div
10+
className={classNames(
11+
'nhsuk-summary-list__row',
12+
{ 'nhsuk-summary-list__row--no-border': noBorder },
13+
className,
14+
)}
15+
{...rest}
16+
/>
617
);
718

819
SummaryListRow.displayName = 'SummaryList.Row';

0 commit comments

Comments
 (0)