File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ const locators = {
2323} ;
2424
2525const getTheme = ( page : Page ) =>
26- page . evaluate ( ( ) => document . documentElement . dataset . theme ) ;
26+ page . evaluate (
27+ ( ) => document . documentElement . dataset . theme as 'light' | 'dark'
28+ ) ;
2729
2830const openLanguageMenu = async ( page : Page ) => {
2931 const button = page . getByRole ( 'button' , {
@@ -71,11 +73,22 @@ test.describe('Node.js Website', () => {
7173 await expect ( themeToggle ) . toBeVisible ( ) ;
7274
7375 const initialTheme = await getTheme ( page ) ;
76+ const initialAriaLabel = await themeToggle . getAttribute ( 'aria-label' ) ;
77+ expect ( initialAriaLabel ) . toBe (
78+ englishLocale . components . common . themeToggle . label [ initialTheme ]
79+ ) ;
80+
7481 await themeToggle . click ( ) ;
7582
7683 const newTheme = await getTheme ( page ) ;
77- expect ( newTheme ) . not . toEqual ( initialTheme ) ;
84+ const newAriaLabel = await themeToggle . getAttribute ( 'aria-label' ) ;
85+
86+ expect ( newTheme ) . not . toBe ( initialTheme ) ;
7887 expect ( [ 'light' , 'dark' ] ) . toContain ( newTheme ) ;
88+
89+ expect ( newAriaLabel ) . toBe (
90+ englishLocale . components . common . themeToggle . label [ newTheme ]
91+ ) ;
7992 } ) ;
8093
8194 test ( 'should persist theme across page navigation' , async ( { page } ) => {
You can’t perform that action at this time.
0 commit comments