Skip to content

Commit

Permalink
fix(review): mv withRexExp to withRegExp
Browse files Browse the repository at this point in the history
  • Loading branch information
inomdzhon committed Jan 16, 2024
1 parent 1303529 commit 67ab7c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { baselineComponent, userEvent, withRexExp } from '../../testing/utils';
import { baselineComponent, userEvent, withRegExp } from '../../testing/utils';
import { ChipsInputBase } from './ChipsInputBase';
import type { ChipOption, ChipsInputBasePrivateProps } from './types';

Expand Down Expand Up @@ -96,7 +96,7 @@ describe('ChipsInputBase', () => {
onRemoveChipOption={onRemoveChipOption}
/>,
);
const chipEl = result.getByRole('option', { name: withRexExp(TEST_OPTION.label) });
const chipEl = result.getByRole('option', { name: withRegExp(TEST_OPTION.label) });
await userEvent.click(chipEl);
await userEvent.type(chipEl, `{${type}}`);
expect(onRemoveChipOption).not.toHaveBeenCalled();
Expand All @@ -123,7 +123,7 @@ describe('ChipsInputBase', () => {
onRemoveChipOption={onRemoveChipOption}
/>,
);
const chipEl = result.getByRole('option', { name: withRexExp(TEST_OPTION.label) });
const chipEl = result.getByRole('option', { name: withRegExp(TEST_OPTION.label) });
await userEvent.click(chipEl);
expect(chipEl).toHaveFocus();
});
Expand Down
4 changes: 2 additions & 2 deletions packages/vkui/src/components/ChipsSelect/ChipsSelect.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
baselineComponent,
userEvent,
waitForFloatingPosition,
withRexExp,
withRegExp,
} from '../../testing/utils';
import type { ChipOption } from '../ChipsInputBase/types';
import { ChipsSelect } from './ChipsSelect';
Expand Down Expand Up @@ -233,7 +233,7 @@ describe('ChipsSelect', () => {
};

const result = render(<ChipsSelect data-testid="chips-select" {...colorsChipsProps} />);
const chipEl = result.getByRole('option', { name: withRexExp(FIRST_OPTION.label) });
const chipEl = result.getByRole('option', { name: withRegExp(FIRST_OPTION.label) });
await userEvent.click(within(chipEl).getByRole('button'));
expect(result.getByTestId('chips-select')).not.toHaveFocus();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/testing/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,4 @@ export const fireEventPatch = async (
});
};

export const withRexExp = (v: string) => new RegExp(v);
export const withRegExp = (v: string) => new RegExp(v);

0 comments on commit 67ab7c0

Please sign in to comment.