File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ describe("useAutoId", () => {
8181
8282 cy . findByText ( "A paragraph" )
8383 . invoke ( "attr" , "id" )
84- . should ( "match" , / ^ f d z - p r e f i x - - : ? [ a - z 0 - 9 : ] + : ? $ / ) ;
84+ . should ( "match" , / ^ f d z - p r e f i x - - [ a - z 0 - 9 ] + $ / ) ;
8585 } ) ;
8686
8787 context ( "React <18 (no useId support)" , ( ) => {
@@ -123,18 +123,18 @@ describe("useAutoId", () => {
123123
124124 cy . findByText ( "A paragraph" )
125125 . invoke ( "attr" , "id" )
126- . should ( "match" , / ^ : ? [ a - z 0 - 9 : ] + : ? $ / ) ;
126+ . should ( "match" , / ^ [ a - z 0 - 9 ] + $ / ) ;
127127 cy . findByText ( "An inline span element" )
128128 . invoke ( "attr" , "id" )
129- . should ( "match" , / ^ : ? [ a - z 0 - 9 : ] + : ? $ / ) ;
129+ . should ( "match" , / ^ [ a - z 0 - 9 ] + $ / ) ;
130130 } ) ;
131131
132132 it ( "applies prefix to ID generated by React.useId" , ( ) => {
133133 cy . mount ( < DemoComponent prefix = "fdz-js-prefix" /> ) ;
134134
135135 cy . findByText ( "A paragraph" )
136136 . invoke ( "attr" , "id" )
137- . should ( "match" , / ^ f d z - j s - p r e f i x - - : ? [ a - z 0 - 9 : ] + : ? $ / ) ;
137+ . should ( "match" , / ^ f d z - j s - p r e f i x - - [ a - z 0 - 9 ] + $ / ) ;
138138 } ) ;
139139
140140 it ( "uses static fallback ID when explicitly provided" , ( ) => {
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export function useAutoId(
8787 }
8888 } ) ;
8989
90- const baseId = customId ?? reactId ?? generatedId ;
90+ const baseId = customId ?? reactId ?. replace ( / : / g , "" ) ?? generatedId ;
9191
9292 return useMemo ( ( ) => {
9393 return prefix ? makeId ( prefix , baseId ) : baseId ;
You can’t perform that action at this time.
0 commit comments