Skip to content

Commit

Permalink
chore: remove old shared header
Browse files Browse the repository at this point in the history
  • Loading branch information
Riippi committed Dec 5, 2024
1 parent e70a2fc commit 477eea9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ const defaultTranslations = {
en: 'In English',
};

const languageMenuButtonAriaLabels = {
fi: 'Valitse kieli',
sv: 'Ändra språk',
en: 'Select language',
};

const expectations = {
userIsLoggedIn: async (expectedUser?: User): Promise<void> => {
await screen.findByRole('button', {
Expand Down Expand Up @@ -79,7 +73,7 @@ const actions = {
toLang: Language
): Promise<void> => {
return userEvent.click(
screen.getAllByRole('link', {
screen.getAllByRole('button', {
name: new RegExp(
`(${defaultTranslations[toLang]})|(languages.${toLang})`,
'i'
Expand Down
12 changes: 2 additions & 10 deletions frontend/shared/browser-tests/page-models/Header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,8 @@ class Header<
.nth(0);
}

private languageSelector(): SelectorPromise {
return this.withinNavigationActions.findByRole('button', {
name: this.translations.header.languageMenuButtonAriaLabel,
});
}

private languageSelectorItem(toLang: Language): SelectorPromise {
return this.withinNavigationActions.findByRole('link', {
return this.withinNavigationActions.findByRole('button', {
name: this.translations.languages[toLang],
});
}
Expand Down Expand Up @@ -74,9 +68,7 @@ class Header<
}

public async changeLanguage(toLang: Language): Promise<void> {
return t
.click(this.languageSelector())
.click(this.languageSelectorItem(toLang));
return t.click(this.languageSelectorItem(toLang));
}

public clickLoginButton(): Promise<void> {
Expand Down
175 changes: 0 additions & 175 deletions frontend/shared/src/components/header/Header.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { axe } from 'jest-axe';
import React from 'react';
import { render } from 'shared/__tests__/utils/test-utils';

import Header from '../Header';
import Header from '../HeaderV3';

// "svg elements with an img role have an alternative text (svg-img-alt)"
test.skip('test for accessibility violations', async () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/shared/src/components/header/useHeader.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TFunction, useTranslation } from 'next-i18next';
import { useState } from 'react';
import { HeaderProps } from 'shared/components/header/Header';
import { HeaderProps } from 'shared/components/header/HeaderV3';
import useLocale from 'shared/hooks/useLocale';
import { Language } from 'shared/i18n/i18n';

Expand Down

0 comments on commit 477eea9

Please sign in to comment.