Skip to content

Commit

Permalink
Merge pull request #2 from ktsstudio/fixes
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
ReutovDanila authored Apr 6, 2024
2 parents f831c58 + ccf8acc commit ccc0d03
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import '../src/styles/styles.scss';
import './styles.scss';
import '../src/styles/styles.css';
import './styles.css';

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
Expand Down
File renamed without changes.
32 changes: 32 additions & 0 deletions src/__test__/MultiDropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,36 @@ describe('Тестирование компонента MultiDropdown', () => {

expect(secondOption).not.toBeInTheDocument();
});

test('Проверка фильтрации', () => {
const title = 'TEST_TITLE';
render(
<WrappedDropdown options={options} getTitle={() => title} />
);

const dropdownElement = screen.getByDisplayValue('');
expect(dropdownElement).toBeInTheDocument();

userEvent.click(dropdownElement);

const firstOption = screen.getByText(options[0].value);
const secondOption = screen.getByText(options[1].value);
const thirdOption = screen.getByText(options[2].value);

expect(firstOption).toBeInTheDocument();
expect(secondOption).toBeInTheDocument();
expect(thirdOption).toBeInTheDocument();

userEvent.type(dropdownElement, 'Екат');

expect(firstOption).not.toBeInTheDocument();
expect(secondOption).not.toBeInTheDocument();
expect(thirdOption).toBeInTheDocument();

userEvent.clear(dropdownElement);

expect(screen.getByText(options[0].value)).toBeInTheDocument();
expect(screen.getByText(options[1].value)).toBeInTheDocument();
expect(screen.getByText(options[2].value)).toBeInTheDocument();
});
});
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './styles/styles.scss';
import './styles/styles.css';

const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit ccc0d03

Please sign in to comment.