File tree Expand file tree Collapse file tree 3 files changed +44
-2
lines changed
src/components/content-presentation/summary-list Expand file tree Collapse file tree 3 files changed +44
-2
lines changed Original file line number Diff line number Diff 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' , ( ) => {
Original file line number Diff line number Diff 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+
3343exports [` 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+
4361exports [` SummaryList matches snapshot: SummaryList 1` ] = `
4462<div >
4563 <dl
Original file line number Diff line number Diff line change 11import classNames from 'classnames' ;
22import { 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
819SummaryListRow . displayName = 'SummaryList.Row' ;
You can’t perform that action at this time.
0 commit comments