Skip to content

Commit a6930d5

Browse files
committed
♿(frontend) remove redundant aria-label on hidden icons and update tests
clean up a11y by removing aria-label from aria-hidden icons and updating tests with data-testid Signed-off-by: Cyril <[email protected]>
1 parent 3607faa commit a6930d5

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

src/frontend/apps/e2e/__tests__/app-impress/doc-header.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ test.describe('Doc Header', () => {
7575
// Check the tree
7676
const docTree = page.getByTestId('doc-tree');
7777
await expect(docTree.getByText('Hello Emoji World')).toBeVisible();
78-
await expect(docTree.getByLabel('Document emoji icon')).toBeVisible();
79-
await expect(docTree.getByLabel('Simple document icon')).toBeHidden();
78+
await expect(docTree.getByTestId('doc-emoji-icon')).toBeVisible();
79+
await expect(docTree.getByTestId('doc-simple-icon')).toBeHidden();
8080

8181
await page.getByTestId('home-button').click();
8282

8383
// Check the documents grid
8484
const gridRow = await getGridRow(page, 'Hello Emoji World');
85-
await expect(gridRow.getByLabel('Document emoji icon')).toBeVisible();
86-
await expect(gridRow.getByLabel('Simple document icon')).toBeHidden();
85+
await expect(gridRow.getByTestId('doc-emoji-icon')).toBeVisible();
86+
await expect(gridRow.getByTestId('doc-simple-icon')).toBeHidden();
8787
});
8888

8989
test('it deletes the doc', async ({ page, browserName }) => {

src/frontend/apps/impress/src/features/docs/doc-management/components/DocIcon.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { useTranslation } from 'react-i18next';
2-
31
import { Text, TextType } from '@/components';
42

53
type DocIconProps = TextType & {
@@ -15,8 +13,6 @@ export const DocIcon = ({
1513
$weight = '400',
1614
...textProps
1715
}: DocIconProps) => {
18-
const { t } = useTranslation();
19-
2016
if (!emoji) {
2117
return <>{defaultIcon}</>;
2218
}
@@ -28,7 +24,7 @@ export const DocIcon = ({
2824
$variation={$variation}
2925
$weight={$weight}
3026
aria-hidden="true"
31-
aria-label={t('Document emoji icon')}
27+
data-testid="doc-emoji-icon"
3228
>
3329
{emoji}
3430
</Text>

src/frontend/apps/impress/src/features/docs/doc-management/components/SimpleDocItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const SimpleDocItem = ({
6666
{isPinned ? (
6767
<PinnedDocumentIcon
6868
aria-hidden="true"
69-
aria-label={t('Pin document icon')}
69+
data-testid="doc-pinned-icon"
7070
color={colorsTokens['primary-500']}
7171
/>
7272
) : (
@@ -75,7 +75,7 @@ export const SimpleDocItem = ({
7575
defaultIcon={
7676
<SimpleFileIcon
7777
aria-hidden="true"
78-
aria-label={t('Simple document icon')}
78+
data-testid="doc-simple-icon"
7979
color={colorsTokens['primary-500']}
8080
/>
8181
}

0 commit comments

Comments
 (0)