File tree Expand file tree Collapse file tree
packages/app/src/modules/admin/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,4 +64,28 @@ describe("AdminNavigation", () => {
6464 "aria-current" ,
6565 ) ;
6666 } ) ;
67+
68+ it ( "marks /admin/declarations as active — and not Accueil" , ( ) => {
69+ ( usePathname as Mock ) . mockReturnValue ( "/admin/declarations" ) ;
70+ render ( < AdminNavigation /> ) ;
71+ expect ( screen . getByRole ( "link" , { name : "Déclarations" } ) ) . toHaveAttribute (
72+ "aria-current" ,
73+ "page" ,
74+ ) ;
75+ expect ( screen . getByRole ( "link" , { name : "Accueil" } ) ) . not . toHaveAttribute (
76+ "aria-current" ,
77+ ) ;
78+ } ) ;
79+
80+ it ( "marks /admin/declarations/<id> as active on the Déclarations link" , ( ) => {
81+ ( usePathname as Mock ) . mockReturnValue ( "/admin/declarations/abc123" ) ;
82+ render ( < AdminNavigation /> ) ;
83+ expect ( screen . getByRole ( "link" , { name : "Déclarations" } ) ) . toHaveAttribute (
84+ "aria-current" ,
85+ "page" ,
86+ ) ;
87+ expect ( screen . getByRole ( "link" , { name : "Accueil" } ) ) . not . toHaveAttribute (
88+ "aria-current" ,
89+ ) ;
90+ } ) ;
6791} ) ;
You can’t perform that action at this time.
0 commit comments