Skip to content

Commit e0ecde4

Browse files
Adjust test, add translations
1 parent 7a06a0f commit e0ecde4

File tree

15 files changed

+39
-2
lines changed

15 files changed

+39
-2
lines changed

src/components/ChannelPreview/ChannelPreviewActionButtons.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { Channel, ExtendableGenerics } from 'stream-chat';
44

55
import { useChannelMembershipState } from '../ChannelList';
66
import { Icon } from './icons';
7+
import { useTranslationContext } from '../../context';
78

89
export type ChannelPreviewActionButtonsProps<SCG extends ExtendableGenerics> = {
910
channel: Channel<SCG>;
@@ -13,10 +14,12 @@ export function ChannelPreviewActionButtons<SCG extends ExtendableGenerics>({
1314
channel,
1415
}: ChannelPreviewActionButtonsProps<SCG>) {
1516
const membership = useChannelMembershipState(channel);
17+
const { t } = useTranslationContext();
1618

1719
return (
1820
<div className='str-chat__channel-preview__action-buttons'>
1921
<button
22+
aria-label={membership.pinned_at ? t('Unpin') : t('Pin')}
2023
className={clsx(
2124
'str-chat__channel-preview__action-button',
2225
'str-chat__channel-preview__action-button--pin',
@@ -30,10 +33,12 @@ export function ChannelPreviewActionButtons<SCG extends ExtendableGenerics>({
3033
channel.pin();
3134
}
3235
}}
36+
title={membership.pinned_at ? t('Unpin') : t('Pin')}
3337
>
3438
<Icon.Pin />
3539
</button>
3640
<button
41+
aria-label={membership.archived_at ? t('Unarchive') : t('Archive')}
3742
className={clsx(
3843
'str-chat__channel-preview__action-button',
3944
'str-chat__channel-preview__action-button--archive',
@@ -47,6 +52,7 @@ export function ChannelPreviewActionButtons<SCG extends ExtendableGenerics>({
4752
channel.archive();
4853
}
4954
}}
55+
title={membership.archived_at ? t('Unarchive') : t('Archive')}
5056
>
5157
<Icon.ArchiveBox />
5258
</button>

src/components/ChannelPreview/__tests__/ChannelPreviewMessenger.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ const PREVIEW_TEST_ID = 'channel-preview-button';
2121

2222
describe('ChannelPreviewMessenger', () => {
2323
const clientUser = generateUser();
24+
2425
let chatClient;
2526
let channel;
2627
const renderComponent = (props) => (
27-
<ChatProvider value={{ client: { user: { id: 'id' } } }}>
28+
<ChatProvider value={{ client: chatClient }}>
2829
<div aria-label='Select Channel' role='listbox'>
2930
<ChannelPreviewMessenger
3031
channel={channel}
@@ -78,7 +79,9 @@ describe('ChannelPreviewMessenger', () => {
7879
expect(setActiveChannel).toHaveBeenCalledTimes(1);
7980
expect(setActiveChannel).toHaveBeenCalledWith(channel, {});
8081
});
81-
const results = await axe(container);
82+
83+
const results = await axe(container.firstChild.firstChild);
84+
8285
expect(results).toHaveNoViolations();
8386
});
8487

src/components/ChannelPreview/__tests__/__snapshots__/ChannelPreviewMessenger.test.js.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ exports[`ChannelPreviewMessenger should render correctly 1`] = `
1212
className="str-chat__channel-preview__action-buttons"
1313
>
1414
<button
15+
aria-label="Pin"
1516
className="str-chat__channel-preview__action-button str-chat__channel-preview__action-button--pin"
1617
onClick={[Function]}
18+
title="Pin"
1719
>
1820
<svg
1921
className="str-chat__icon str-chat__icon--pin"
@@ -27,8 +29,10 @@ exports[`ChannelPreviewMessenger should render correctly 1`] = `
2729
</svg>
2830
</button>
2931
<button
32+
aria-label="Archive"
3033
className="str-chat__channel-preview__action-button str-chat__channel-preview__action-button--archive"
3134
onClick={[Function]}
35+
title="Archive"
3236
>
3337
<svg
3438
className="str-chat__icon str-chat__icon--archive-box"

src/i18n/de.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"An error has occurred during the recording processing": "Ein Fehler ist während der Aufnahmeverarbeitung aufgetreten",
1010
"Anonymous": "Anonym",
1111
"Anonymous poll": "Anonyme Umfrage",
12+
"Archive": "Archivieren",
1213
"Ask a question": "Eine Frage stellen",
1314
"Attach files": "Dateien anhängen",
1415
"Cancel": "Abbrechen",
@@ -117,6 +118,7 @@
117118
"To start recording, allow the microphone access in your browser": "Um mit der Aufnahme zu beginnen, erlauben Sie den Zugriff auf das Mikrofon in Ihrem Browser",
118119
"Type a number from 2 to 10": "Geben Sie eine Zahl von 2 bis 10 ein",
119120
"Type your message": "Nachricht eingeben",
121+
"Unarchive": "Archivierung aufheben",
120122
"Unmute": "Stummschaltung aufheben",
121123
"Unpin": "Anheftung aufheben",
122124
"Unread messages": "Ungelesene Nachrichten",

src/i18n/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"An error has occurred during the recording processing": "An error has occurred during the recording processing",
1010
"Anonymous": "Anonymous",
1111
"Anonymous poll": "Anonymous poll",
12+
"Archive": "Archive",
1213
"Ask a question": "Ask a question",
1314
"Attach files": "Attach files",
1415
"Cancel": "Cancel",
@@ -117,6 +118,7 @@
117118
"To start recording, allow the microphone access in your browser": "To start recording, allow the microphone access in your browser",
118119
"Type a number from 2 to 10": "Type a number from 2 to 10",
119120
"Type your message": "Type your message",
121+
"Unarchive": "Unarchive",
120122
"Unmute": "Unmute",
121123
"Unpin": "Unpin",
122124
"Unread messages": "Unread messages",

src/i18n/es.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"An error has occurred during the recording processing": "Se ha producido un error durante el procesamiento de la grabación",
1010
"Anonymous": "Anónimo",
1111
"Anonymous poll": "Encuesta anónima",
12+
"Archive": "Archivo",
1213
"Ask a question": "Hacer una pregunta",
1314
"Attach files": "Adjuntar archivos",
1415
"Cancel": "Cancelar",
@@ -119,6 +120,7 @@
119120
"To start recording, allow the microphone access in your browser": "Para comenzar a grabar, permita el acceso al micrófono en su navegador",
120121
"Type a number from 2 to 10": "Escribe un número del 2 al 10",
121122
"Type your message": "Escribe tu mensaje",
123+
"Unarchive": "Desarchivar",
122124
"Unmute": "Activar sonido",
123125
"Unpin": "Desfijar",
124126
"Unread messages": "Mensajes no leídos",

src/i18n/fr.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"An error has occurred during the recording processing": "Une erreur s'est produite pendant le traitement de l'enregistrement",
1010
"Anonymous": "Anonyme",
1111
"Anonymous poll": "Sondage anonyme",
12+
"Archive": "Archive",
1213
"Ask a question": "Poser une question",
1314
"Attach files": "Joindre des fichiers",
1415
"Cancel": "Annuler",
@@ -119,6 +120,7 @@
119120
"To start recording, allow the microphone access in your browser": "Pour commencer l'enregistrement, autorisez l'accès au microphone dans votre navigateur",
120121
"Type a number from 2 to 10": "Tapez un nombre de 2 à 10",
121122
"Type your message": "Tapez votre message",
123+
"Unarchive": "Désarchiver",
122124
"Unmute": "Désactiver muet",
123125
"Unpin": "Détacher",
124126
"Unread messages": "Messages non lus",

src/i18n/hi.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"An error has occurred during the recording processing": "रेकॉर्डिंग प्रोसेसिंग के दौरान एक त्रुटि आ गई है",
1010
"Anonymous": "गुमनाम",
1111
"Anonymous poll": "गुमनाम मतदान",
12+
"Archive": "आर्काइव",
1213
"Ask a question": "एक प्रश्न पूछें",
1314
"Attach files": "फाइल्स अटैच करे",
1415
"Cancel": "रद्द करें",
@@ -118,6 +119,7 @@
118119
"To start recording, allow the microphone access in your browser": "रिकॉर्डिंग शुरू करने के लिए, अपने ब्राउज़र में माइक्रोफ़ोन तक पहुँच दें",
119120
"Type a number from 2 to 10": "2 से 10 तक का एक नंबर टाइप करें",
120121
"Type your message": "अपना मैसेज लिखे",
122+
"Unarchive": "अनआर्काइव",
121123
"Unmute": "अनम्यूट",
122124
"Unpin": "अनपिन",
123125
"Unread messages": "अपठित संदेश",

src/i18n/it.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"An error has occurred during the recording processing": "Si è verificato un errore durante l'elaborazione della registrazione",
1010
"Anonymous": "Anonimo",
1111
"Anonymous poll": "Sondaggio anonimo",
12+
"Archive": "Archivia",
1213
"Ask a question": "Fai una domanda",
1314
"Attach files": "Allega file",
1415
"Cancel": "Annulla",
@@ -119,6 +120,7 @@
119120
"To start recording, allow the microphone access in your browser": "Per iniziare a registrare, consenti l'accesso al microfono nel tuo browser",
120121
"Type a number from 2 to 10": "Digita un numero da 2 a 10",
121122
"Type your message": "Scrivi il tuo messaggio",
123+
"Unarchive": "Ripristina",
122124
"Unmute": "Riattiva il notifiche",
123125
"Unpin": "Sblocca",
124126
"Unread messages": "Messaggi non letti",

src/i18n/ja.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"An error has occurred during the recording processing": "録音処理中にエラーが発生しました",
1010
"Anonymous": "匿名",
1111
"Anonymous poll": "匿名投票",
12+
"Archive": "アーカイブ",
1213
"Ask a question": "質問する",
1314
"Attach files": "ファイルを添付する",
1415
"Cancel": "キャンセル",
@@ -115,6 +116,7 @@
115116
"To start recording, allow the microphone access in your browser": "録音を開始するには、ブラウザーでマイクロフォンへのアクセスを許可してください",
116117
"Type a number from 2 to 10": "2から10までの数字を入力してください",
117118
"Type your message": "メッセージを入力してください",
119+
"Unarchive": "アーカイブ解除",
118120
"Unmute": "無音を解除する",
119121
"Unpin": "ピンを解除する",
120122
"Unread messages": "未読メッセージ",

0 commit comments

Comments
 (0)