@@ -21,13 +21,13 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
2121 await expect ( helperText ) . toHaveText ( 'Helper text' ) ;
2222 await expect ( errorText ) . toBeHidden ( ) ;
2323 } ) ;
24- test ( 'input should have an aria-describedby attribute when helper text is present' , async ( { page } ) => {
24+ test ( 'toggle should have an aria-describedby attribute when helper text is present' , async ( { page } ) => {
2525 await page . setContent ( `<ion-toggle helper-text="Helper text" error-text="Error text">Label</ion-toggle>` , config ) ;
2626
27- const input = page . locator ( 'ion-toggle input[type=checkbox] ' ) ;
27+ const toggle = page . locator ( 'ion-toggle' ) ;
2828 const helperText = page . locator ( 'ion-toggle .helper-text' ) ;
2929 const helperTextId = await helperText . getAttribute ( 'id' ) ;
30- const ariaDescribedBy = await input . getAttribute ( 'aria-describedby' ) ;
30+ const ariaDescribedBy = await toggle . getAttribute ( 'aria-describedby' ) ;
3131
3232 expect ( ariaDescribedBy ) . toBe ( helperTextId ) ;
3333 } ) ;
@@ -44,42 +44,44 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
4444 await expect ( errorText ) . toHaveText ( 'Error text' ) ;
4545 } ) ;
4646
47- test ( 'input should have an aria-describedby attribute when error text is present' , async ( { page } ) => {
47+ test ( 'toggle should have an aria-describedby attribute when error text is present' , async ( { page } ) => {
4848 await page . setContent (
4949 `<ion-toggle class="ion-invalid ion-touched" helper-text="Helper text" error-text="Error text">Label</ion-toggle>` ,
5050 config
5151 ) ;
5252
53- const input = page . locator ( 'ion-toggle input[type=checkbox] ' ) ;
53+ const toggle = page . locator ( 'ion-toggle' ) ;
5454 const errorText = page . locator ( 'ion-toggle .error-text' ) ;
5555 const errorTextId = await errorText . getAttribute ( 'id' ) ;
56- const ariaDescribedBy = await input . getAttribute ( 'aria-describedby' ) ;
56+ const ariaDescribedBy = await toggle . getAttribute ( 'aria-describedby' ) ;
5757
5858 expect ( ariaDescribedBy ) . toBe ( errorTextId ) ;
5959 } ) ;
60- test ( 'input should have aria-invalid attribute when toggle is invalid' , async ( { page } ) => {
60+ test ( 'toggle should have aria-invalid attribute when toggle is invalid' , async ( { page } ) => {
6161 await page . setContent (
6262 `<ion-toggle class="ion-invalid ion-touched" helper-text="Helper text" error-text="Error text">Label</ion-toggle>` ,
6363 config
6464 ) ;
6565
66- const input = page . locator ( 'ion-toggle input[type=checkbox] ' ) ;
66+ const toggle = page . locator ( 'ion-toggle' ) ;
6767
68- await expect ( input ) . toHaveAttribute ( 'aria-invalid' ) ;
68+ await expect ( toggle ) . toHaveAttribute ( 'aria-invalid' ) ;
6969 } ) ;
70- test ( 'input should not have aria-invalid attribute when toggle is valid' , async ( { page } ) => {
70+ test ( 'toggle should not have aria-invalid attribute when toggle is valid' , async ( { page } ) => {
7171 await page . setContent ( `<ion-toggle helper-text="Helper text" error-text="Error text">Label</ion-toggle>` , config ) ;
7272
73- const input = page . locator ( 'ion-toggle input[type=checkbox] ' ) ;
73+ const toggle = page . locator ( 'ion-toggle' ) ;
7474
75- await expect ( input ) . not . toHaveAttribute ( 'aria-invalid' ) ;
75+ await expect ( toggle ) . not . toHaveAttribute ( 'aria-invalid' ) ;
7676 } ) ;
77- test ( 'input should not have aria-describedby attribute when no hint or error text is present' , async ( { page } ) => {
77+ test ( 'toggle should not have aria-describedby attribute when no hint or error text is present' , async ( {
78+ page,
79+ } ) => {
7880 await page . setContent ( `<ion-toggle>Label</ion-toggle>` , config ) ;
7981
80- const input = page . locator ( 'ion-toggle input[type=checkbox] ' ) ;
82+ const toggle = page . locator ( 'ion-toggle' ) ;
8183
82- await expect ( input ) . not . toHaveAttribute ( 'aria-describedby' ) ;
84+ await expect ( toggle ) . not . toHaveAttribute ( 'aria-describedby' ) ;
8385 } ) ;
8486 } ) ;
8587} ) ;
0 commit comments