Skip to content

Commit 06e6341

Browse files
authored
Merge branch 'develop' into chore/legal-router
2 parents 21e94db + 3778d18 commit 06e6341

File tree

3 files changed

+57
-7
lines changed

3 files changed

+57
-7
lines changed

client/modules/IDE/components/Toast.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function Toast() {
1313
return null;
1414
}
1515
return (
16-
<section className="toast">
16+
<section className="toast" role="status" aria-live="polite">
1717
<p>{t(text)}</p>
1818
<button
1919
className="toast__close"
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import React from 'react';
2+
import {
3+
act,
4+
reduxRender,
5+
screen,
6+
fireEvent,
7+
waitFor
8+
} from '../../../test-utils';
9+
import { showToast } from '../actions/toast';
10+
import Toast from './Toast';
11+
12+
describe(`Toast`, () => {
13+
it('is hidden by default', () => {
14+
reduxRender(<Toast />);
15+
expect(screen.queryByRole('status')).not.toBeInTheDocument();
16+
});
17+
18+
it('opens when an action is dispatched', async () => {
19+
const { store } = reduxRender(<Toast />);
20+
act(() => {
21+
store.dispatch(showToast('Toast.SketchSaved'));
22+
});
23+
24+
const toast = screen.queryByRole('status');
25+
expect(toast).toBeVisible();
26+
expect(toast).toHaveTextContent('Sketch saved.');
27+
});
28+
29+
it('closes automatically after time', async () => {
30+
const { store } = reduxRender(<Toast />);
31+
act(() => {
32+
store.dispatch(showToast('Toast.SketchSaved', 100));
33+
});
34+
35+
expect(screen.queryByRole('status')).toBeInTheDocument();
36+
37+
await waitFor(() => {
38+
expect(screen.queryByRole('status')).not.toBeInTheDocument();
39+
});
40+
});
41+
42+
it('closes when "X" button is pressed', () => {
43+
reduxRender(<Toast />, {
44+
initialState: { toast: { isVisible: true, text: 'Hello World' } }
45+
});
46+
const button = screen.getByRole('button');
47+
fireEvent.click(button);
48+
expect(screen.queryByRole('status')).not.toBeInTheDocument();
49+
});
50+
});

translations/locales/hi/translations.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"File": {
44
"Title": "फाइल",
55
"New": "नई",
6-
"Share": "शेयर",
7-
"Duplicate": "डुप्लिकेट",
8-
"Open": "ओपन",
6+
"Share": "भेजें",
7+
"Duplicate": "प्रतिलिपि बनाएँ",
8+
"Open": "खोलें",
99
"Download": "डाउनलोड",
1010
"AddToCollection": "संग्रह में जोड़ें",
1111
"Examples": "उदाहरण"
@@ -17,7 +17,7 @@
1717
"Replace": "बदली करें"
1818
},
1919
"Sketch": {
20-
"Title": "स्केच",
20+
"Title": "चित्र",
2121
"AddFile": "फाइल जोड़ें",
2222
"AddFolder": "फोल्डर जोड़ें",
2323
"Run": "चलाएं",
@@ -42,7 +42,7 @@
4242
"My": "मेरा",
4343
"MySketches": "मेरे स्केच",
4444
"MyCollections": "मेरे संग्रह",
45-
"Asset": "ऐसेट",
45+
"Asset": "संपत्ति",
4646
"MyAssets": "मेरे ऐसेट",
4747
"LogOut": "लॉग आउट"
4848
}
@@ -95,7 +95,7 @@
9595
"Learn": "सीखें",
9696
"Resources": "साधन",
9797
"Libraries": "लाइब्रेरीज़",
98-
"Forum": "फोरम",
98+
"Forum": "समूह",
9999
"Examples": "उदाहरण"
100100
},
101101
"Toast": {

0 commit comments

Comments
 (0)