@@ -469,19 +469,22 @@ describe("[Unit] ElementAssertion.test.ts", () => {
469469 } ) ;
470470 } ) ;
471471
472- describe ( ".toHaveDescription " , ( ) => {
472+ describe ( ".toHaveAccessibleDescription " , ( ) => {
473473 context ( "when checking for any description" , ( ) => {
474474 context ( "when the element has a description" , ( ) => {
475475 it ( "returns the assertion instance" , ( ) => {
476476 const { getByTestId } = render ( < DescriptionTestComponent /> ) ;
477477 const button = getByTestId ( "button-single" ) ;
478478 const test = new ElementAssertion ( button ) ;
479479
480- expect ( test . toHaveDescription ( ) ) . toBeEqual ( test ) ;
480+ expect ( test . toHaveAccessibleDescription ( ) ) . toBeEqual ( test ) ;
481481
482- expect ( ( ) => test . not . toHaveDescription ( ) )
482+ expect ( ( ) => test . not . toHaveAccessibleDescription ( ) )
483483 . toThrowError ( AssertionError )
484- . toHaveMessage ( 'Expected the element NOT to have a description, but received "This is a description"' ) ;
484+ . toHaveMessage (
485+ "Expected the element NOT to have an accessible description, "
486+ + 'but received "This is a description"' ,
487+ ) ;
485488 } ) ;
486489 } ) ;
487490
@@ -491,11 +494,11 @@ describe("[Unit] ElementAssertion.test.ts", () => {
491494 const button = getByTestId ( "button-no-description" ) ;
492495 const test = new ElementAssertion ( button ) ;
493496
494- expect ( ( ) => test . toHaveDescription ( ) )
497+ expect ( ( ) => test . toHaveAccessibleDescription ( ) )
495498 . toThrowError ( AssertionError )
496- . toHaveMessage ( "Expected the element to have a description" ) ;
499+ . toHaveMessage ( "Expected the element to have an accessible description" ) ;
497500
498- expect ( test . not . toHaveDescription ( ) ) . toBeEqual ( test ) ;
501+ expect ( test . not . toHaveAccessibleDescription ( ) ) . toBeEqual ( test ) ;
499502 } ) ;
500503 } ) ;
501504 } ) ;
@@ -507,12 +510,12 @@ describe("[Unit] ElementAssertion.test.ts", () => {
507510 const button = getByTestId ( "button-single" ) ;
508511 const test = new ElementAssertion ( button ) ;
509512
510- expect ( test . toHaveDescription ( "This is a description" ) ) . toBeEqual ( test ) ;
513+ expect ( test . toHaveAccessibleDescription ( "This is a description" ) ) . toBeEqual ( test ) ;
511514
512- expect ( ( ) => test . not . toHaveDescription ( "This is a description" ) )
515+ expect ( ( ) => test . not . toHaveAccessibleDescription ( "This is a description" ) )
513516 . toThrowError ( AssertionError )
514517 . toHaveMessage (
515- 'Expected the element NOT to have description "This is a description", '
518+ 'Expected the element NOT to have accessible description "This is a description", '
516519 + 'but received "This is a description"' ,
517520 ) ;
518521 } ) ;
@@ -524,12 +527,12 @@ describe("[Unit] ElementAssertion.test.ts", () => {
524527 const button = getByTestId ( "button-multiple" ) ;
525528 const test = new ElementAssertion ( button ) ;
526529
527- expect ( test . toHaveDescription ( "This is a description Additional info" ) ) . toBeEqual ( test ) ;
530+ expect ( test . toHaveAccessibleDescription ( "This is a description Additional info" ) ) . toBeEqual ( test ) ;
528531
529- expect ( ( ) => test . not . toHaveDescription ( "This is a description Additional info" ) )
532+ expect ( ( ) => test . not . toHaveAccessibleDescription ( "This is a description Additional info" ) )
530533 . toThrowError ( AssertionError )
531534 . toHaveMessage (
532- 'Expected the element NOT to have description "This is a description Additional info", '
535+ 'Expected the element NOT to have accessible description "This is a description Additional info", '
533536 + 'but received "This is a description Additional info"' ,
534537 ) ;
535538 } ) ;
@@ -541,13 +544,14 @@ describe("[Unit] ElementAssertion.test.ts", () => {
541544 const button = getByTestId ( "button-single" ) ;
542545 const test = new ElementAssertion ( button ) ;
543546
544- expect ( ( ) => test . toHaveDescription ( "Wrong description" ) )
547+ expect ( ( ) => test . toHaveAccessibleDescription ( "Wrong description" ) )
545548 . toThrowError ( AssertionError )
546549 . toHaveMessage (
547- 'Expected the element to have description "Wrong description", but received "This is a description"' ,
550+ 'Expected the element to have accessible description "Wrong description", '
551+ + 'but received "This is a description"' ,
548552 ) ;
549553
550- expect ( test . not . toHaveDescription ( "Wrong description" ) ) . toBeEqual ( test ) ;
554+ expect ( test . not . toHaveAccessibleDescription ( "Wrong description" ) ) . toBeEqual ( test ) ;
551555 } ) ;
552556 } ) ;
553557 } ) ;
@@ -559,12 +563,12 @@ describe("[Unit] ElementAssertion.test.ts", () => {
559563 const button = getByTestId ( "button-single" ) ;
560564 const test = new ElementAssertion ( button ) ;
561565
562- expect ( test . toHaveDescription ( / d e s c r i p t i o n / i) ) . toBeEqual ( test ) ;
566+ expect ( test . toHaveAccessibleDescription ( / d e s c r i p t i o n / i) ) . toBeEqual ( test ) ;
563567
564- expect ( ( ) => test . not . toHaveDescription ( / d e s c r i p t i o n / i) )
568+ expect ( ( ) => test . not . toHaveAccessibleDescription ( / d e s c r i p t i o n / i) )
565569 . toThrowError ( AssertionError )
566570 . toHaveMessage (
567- "Expected the element NOT to have description matching /description/i, "
571+ "Expected the element NOT to have accessible description matching /description/i, "
568572 + 'but received "This is a description"' ,
569573 ) ;
570574 } ) ;
@@ -576,14 +580,14 @@ describe("[Unit] ElementAssertion.test.ts", () => {
576580 const button = getByTestId ( "button-single" ) ;
577581 const test = new ElementAssertion ( button ) ;
578582
579- expect ( ( ) => test . toHaveDescription ( / w r o n g p a t t e r n / ) )
583+ expect ( ( ) => test . toHaveAccessibleDescription ( / w r o n g p a t t e r n / ) )
580584 . toThrowError ( AssertionError )
581585 . toHaveMessage (
582- "Expected the element to have description matching /wrong pattern/, "
586+ "Expected the element to have accessible description matching /wrong pattern/, "
583587 + 'but received "This is a description"' ,
584588 ) ;
585589
586- expect ( test . not . toHaveDescription ( / w r o n g p a t t e r n / ) ) . toBeEqual ( test ) ;
590+ expect ( test . not . toHaveAccessibleDescription ( / w r o n g p a t t e r n / ) ) . toBeEqual ( test ) ;
587591 } ) ;
588592 } ) ;
589593 } ) ;
0 commit comments