From 718ad691c076621f2523a6ff6a19718f3bc0668f Mon Sep 17 00:00:00 2001 From: Pavel Mineev Date: Sun, 8 Aug 2021 12:58:13 +0300 Subject: [PATCH] add tests for select --- .../app/components/select/select.spec.tsx | 46 +++++++++++++++++++ .../sort-picker/sort-picker.spec.tsx | 0 2 files changed, 46 insertions(+) create mode 100644 frontend/app/components/select/select.spec.tsx create mode 100644 frontend/app/components/sort-picker/sort-picker.spec.tsx diff --git a/frontend/app/components/select/select.spec.tsx b/frontend/app/components/select/select.spec.tsx new file mode 100644 index 00000000..a55aab73 --- /dev/null +++ b/frontend/app/components/select/select.spec.tsx @@ -0,0 +1,46 @@ +import '@testing-library/jest-dom'; +import { h } from 'preact'; +import { render } from 'tests/utils'; +import { Select } from './select'; + +const items = [ + { + label: 'None', + value: 'none', + }, + { + label: 'Oldest', + value: 'oldest', + }, + { + label: 'Newest', + value: 'newest', + }, + { + label: 'Best', + value: 'best', + }, + { + label: 'Worst', + value: 'worst', + }, +]; + +describe('); + + expect(container.querySelector('.select')).toBeInTheDocument(); + expect(container.querySelector('.select-arrow')).toBeInTheDocument(); + expect(container.querySelector('.select-element')).toBeInTheDocument(); + }); + + it('should render selected item', () => { + const { container, getAllByText } = render(