@@ -100,7 +100,7 @@ describe("TextFieldWithMessage", () => {
100100 expect ( field ) . toHaveAttribute ( "maxLength" , "20" ) ;
101101 } ) ;
102102
103- it ( "should enable the error state if the value is less than the minLength or more than the maxLength" , ( ) => {
103+ it ( "should enable the error state if the value is greater than the maxLength" , ( ) => {
104104 const { getByRole } = render (
105105 < Test minLength = { 5 } maxLength = { 20 } messageRole = "alert" />
106106 ) ;
@@ -112,8 +112,8 @@ describe("TextFieldWithMessage", () => {
112112 expect ( message . className ) . not . toContain ( "--error" ) ;
113113
114114 fireEvent . change ( field , { target : { value : "1" } } ) ;
115- expect ( container . className ) . toContain ( "--error" ) ;
116- expect ( message . className ) . toContain ( "--error" ) ;
115+ expect ( container . className ) . not . toContain ( "--error" ) ;
116+ expect ( message . className ) . not . toContain ( "--error" ) ;
117117
118118 fireEvent . change ( field , { target : { value : "Valid" } } ) ;
119119 expect ( container . className ) . not . toContain ( "--error" ) ;
@@ -215,7 +215,7 @@ describe("TextFieldWithMessage", () => {
215215
216216 it ( "should render an icon next to the text field when there is an error by default" , ( ) => {
217217 const { getByRole, getByText } = render (
218- < Test minLength = { 10 } errorIcon = { < ErrorOutlineFontIcon /> } />
218+ < Test maxLength = { 3 } errorIcon = { < ErrorOutlineFontIcon /> } />
219219 ) ;
220220 const field = getByRole ( "textbox" ) ;
221221
@@ -227,7 +227,7 @@ describe("TextFieldWithMessage", () => {
227227 it ( "should default to the icon from the IconProvider" , ( ) => {
228228 const { getByText, getByRole } = render (
229229 < IconProvider >
230- < Test minLength = { 10 } />
230+ < Test maxLength = { 3 } />
231231 </ IconProvider >
232232 ) ;
233233 const field = getByRole ( "textbox" ) ;
@@ -240,7 +240,7 @@ describe("TextFieldWithMessage", () => {
240240 it ( "should override the IconProvider error icon when the errorIcon prop is defined" , ( ) => {
241241 const { getByRole, getByText, rerender } = render (
242242 < IconProvider >
243- < Test minLength = { 10 } errorIcon = { null } />
243+ < Test maxLength = { 3 } errorIcon = { null } />
244244 </ IconProvider >
245245 ) ;
246246 const field = getByRole ( "textbox" ) ;
@@ -251,7 +251,7 @@ describe("TextFieldWithMessage", () => {
251251
252252 rerender (
253253 < IconProvider >
254- < Test minLength = { 10 } errorIcon = { < span > My Icon!</ span > } />
254+ < Test maxLength = { 3 } errorIcon = { < span > My Icon!</ span > } />
255255 </ IconProvider >
256256 ) ;
257257 expect ( ( ) => getByText ( "My Icon!" ) ) . not . toThrow ( ) ;
@@ -306,7 +306,7 @@ describe("TextFieldWithMessage", () => {
306306 < Test
307307 onBlur = { ( event ) => event . stopPropagation ( ) }
308308 messageRole = "alert"
309- minLength = { 10 }
309+ maxLength = { 3 }
310310 validateOnChange = { false }
311311 />
312312 ) ;
@@ -354,7 +354,7 @@ describe("TextFieldWithMessage", () => {
354354 it ( "should allow for a custom isErrored function" , ( ) => {
355355 const isErrored = jest . fn ( ( ) => false ) ;
356356 const { getByRole } = render (
357- < Test isErrored = { isErrored } messageRole = "alert" minLength = { 10 } />
357+ < Test isErrored = { isErrored } messageRole = "alert" maxLength = { 3 } />
358358 ) ;
359359
360360 expect ( isErrored ) . not . toBeCalled ( ) ;
@@ -371,7 +371,7 @@ describe("TextFieldWithMessage", () => {
371371 expect ( isErrored ) . toBeCalledWith ( {
372372 value : "invalid" ,
373373 errorMessage : "" ,
374- minLength : 10 ,
374+ maxLength : 3 ,
375375 isBlurEvent : false ,
376376 validateOnChange : "recommended" ,
377377 validationMessage : "" ,
@@ -382,15 +382,15 @@ describe("TextFieldWithMessage", () => {
382382 it ( "should call the onErrorChange option correctly" , ( ) => {
383383 const onErrorChange = jest . fn ( ) ;
384384 const { getByRole } = render (
385- < Test onErrorChange = { onErrorChange } minLength = { 10 } />
385+ < Test onErrorChange = { onErrorChange } maxLength = { 3 } />
386386 ) ;
387387
388388 expect ( onErrorChange ) . not . toBeCalled ( ) ;
389389 const field = getByRole ( "textbox" ) ;
390390 fireEvent . change ( field , { target : { value : "invalid" } } ) ;
391391 expect ( onErrorChange ) . toBeCalledWith ( "field-id" , true ) ;
392392
393- fireEvent . change ( field , { target : { value : "this is a valid string " } } ) ;
393+ fireEvent . change ( field , { target : { value : "v " } } ) ;
394394 expect ( onErrorChange ) . toBeCalledWith ( "field-id" , false ) ;
395395 expect ( onErrorChange ) . toBeCalledTimes ( 2 ) ;
396396 } ) ;
@@ -403,7 +403,7 @@ describe("TextFieldWithMessage", () => {
403403 const errorIcon = < span data-testid = "error-icon" /> ;
404404
405405 const { getByTestId, getByRole } = render (
406- < Test minLength = { 10 } errorIcon = { errorIcon } getErrorIcon = { getErrorIcon } />
406+ < Test maxLength = { 3 } errorIcon = { errorIcon } getErrorIcon = { getErrorIcon } />
407407 ) ;
408408 const field = getByRole ( "textbox" ) ;
409409
0 commit comments