From 9959731ef3c306e8d01e281db13b036b3a0c7b7b Mon Sep 17 00:00:00 2001 From: Josh Reisner <1551689+joshreisner@users.noreply.github.com> Date: Thu, 10 Feb 2022 08:05:55 -0800 Subject: [PATCH 1/3] 60% --- src/components/Controls.spec.tsx | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/components/Controls.spec.tsx diff --git a/src/components/Controls.spec.tsx b/src/components/Controls.spec.tsx new file mode 100644 index 00000000..aacfbc01 --- /dev/null +++ b/src/components/Controls.spec.tsx @@ -0,0 +1,45 @@ +import { fireEvent, render, screen } from '@testing-library/react'; +import Controls from './Controls'; + +describe('', () => { + jest.useFakeTimers(); + const mockState = { + capabilities: { + coordinates: true, + region: true, + distance: true, + }, + indexes: { + distance: [{ name: 'Foo', key: 'foo', slugs: [] }], + region: [{ name: 'Bar', key: 'bar', slugs: [] }], + }, + input: { + mode: 'search', + distance: [], + region: [], + search: 'foo', + }, + meetings: { + odaat: {}, + 'sunday-serenity': {}, + }, + }; + + it('renders', () => { + const { container } = render( + + ); + jest.runAllTimers(); + expect(container).toBeTruthy(); + }); + + it('has clickable dropdowns', () => { + const mockSetState = jest.fn(); + const { container } = render( + + ); + const buttons = screen.getAllByRole('button'); + expect(buttons).toHaveLength(2); + fireEvent.click(buttons[1]); + }); +}); From 8b3c25c331f725dace321e20292974723e3ba4cd Mon Sep 17 00:00:00 2001 From: Josh Reisner <1551689+joshreisner@users.noreply.github.com> Date: Thu, 10 Feb 2022 22:59:20 -0800 Subject: [PATCH 2/3] 89 --- src/components/Controls.jsx | 10 ++++- src/components/Controls.spec.tsx | 69 +++++++++++++++++++++++++++----- src/i18n/en.ts | 4 ++ src/i18n/es.ts | 4 ++ src/i18n/fr.ts | 4 ++ src/types/Translation.ts | 4 ++ 6 files changed, 82 insertions(+), 13 deletions(-) diff --git a/src/components/Controls.jsx b/src/components/Controls.jsx index c6cc1fc9..7d1f7aa9 100644 --- a/src/components/Controls.jsx +++ b/src/components/Controls.jsx @@ -133,8 +133,13 @@ export default function Controls({ state, setState, mapbox }) {
-
+ { @@ -204,10 +209,11 @@ export default function Controls({ state, setState, mapbox }) {
))} {canShowViews && ( -