File tree Expand file tree Collapse file tree 3 files changed +3
-36
lines changed
src/components/content-presentation/inset-text
stories/Content Presentation Expand file tree Collapse file tree 3 files changed +3
-36
lines changed Original file line number Diff line number Diff line change 11import React , { FC , HTMLProps } from 'react' ;
22import classNames from 'classnames' ;
33
4- interface InsetTextProps extends HTMLProps < HTMLDivElement > {
5- visuallyHiddenText ?: string | false ;
6- }
7-
8- const InsetTextComponent : FC < InsetTextProps > = ( {
9- className,
10- children,
11- visuallyHiddenText = 'Information: ' ,
12- ...rest
13- } ) => (
4+ const InsetTextComponent : FC < HTMLProps < HTMLDivElement > > = ( { className, children, ...rest } ) => (
145 < div className = { classNames ( 'nhsuk-inset-text' , className ) } { ...rest } >
15- { visuallyHiddenText ? (
16- < span className = "nhsuk-u-visually-hidden" > { visuallyHiddenText } </ span >
17- ) : null }
6+ < span className = "nhsuk-u-visually-hidden" > Information: </ span >
187 { children }
198 </ div >
209) ;
Original file line number Diff line number Diff line change @@ -15,18 +15,6 @@ describe('InsetText', () => {
1515 expect ( container . querySelector ( '.nhsuk-u-visually-hidden' ) ?. textContent ) . toBe ( 'Information: ' ) ;
1616 } ) ;
1717
18- it ( 'has disabled visually hidden text' , ( ) => {
19- const { container } = render ( < InsetText visuallyHiddenText = { false } /> ) ;
20-
21- expect ( container . querySelector ( '.nhsuk-u-visually-hidden' ) ) . toBeFalsy ( ) ;
22- } ) ;
23-
24- it ( 'has custom visually hidden text' , ( ) => {
25- const { container } = render ( < InsetText visuallyHiddenText = "Custom" /> ) ;
26-
27- expect ( container . querySelector ( '.nhsuk-u-visually-hidden' ) ?. textContent ) . toBe ( 'Custom' ) ;
28- } ) ;
29-
3018 it ( 'renders children' , ( ) => {
3119 const { container } = render ( < InsetText > Child</ InsetText > ) ;
3220
Original file line number Diff line number Diff line change @@ -20,14 +20,4 @@ const meta: Meta<typeof InsetText> = {
2020export default meta ;
2121type Story = StoryObj < typeof InsetText > ;
2222
23- export const Standard : Story = { argTypes : { visuallyHiddenText : { table : { disable : true } } } } ;
24- export const WithCustomHiddenText : Story = {
25- args : {
26- visuallyHiddenText : 'Hidden Text: ' ,
27- } ,
28- } ;
29- export const WithDisabledHiddenText : Story = {
30- args : {
31- visuallyHiddenText : false ,
32- } ,
33- } ;
23+ export const Standard : Story = { } ;
You can’t perform that action at this time.
0 commit comments