mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 21:51:26 -03:30
remove withRouter where not needed
This commit is contained in:
parent
4c62bf268d
commit
9d01334a86
@ -3,7 +3,7 @@ import React, { Fragment, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { t } from '@lingui/macro';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import {
|
||||
Button,
|
||||
ButtonVariant,
|
||||
@ -36,7 +36,6 @@ function Search({
|
||||
onReplaceSearch,
|
||||
onRemove,
|
||||
qsConfig,
|
||||
location,
|
||||
searchableKeys,
|
||||
relatedSearchableKeys,
|
||||
onShowAdvancedSearch,
|
||||
@ -45,6 +44,7 @@ function Search({
|
||||
enableNegativeFiltering,
|
||||
enableRelatedFuzzyFiltering,
|
||||
}) {
|
||||
const location = useLocation();
|
||||
const [isSearchDropdownOpen, setIsSearchDropdownOpen] = useState(false);
|
||||
const [searchKey, setSearchKey] = useState(
|
||||
(() => {
|
||||
@ -341,4 +341,4 @@ Search.defaultProps = {
|
||||
enableRelatedFuzzyFiltering: true,
|
||||
};
|
||||
|
||||
export default withRouter(Search);
|
||||
export default Search;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React, { Fragment, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { useLocation, withRouter } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { t } from '@lingui/macro';
|
||||
import {
|
||||
Button,
|
||||
@ -147,7 +147,4 @@ Sort.defaultProps = {
|
||||
onSort: null,
|
||||
};
|
||||
|
||||
export { Sort as _Sort };
|
||||
const Wrapped = withRouter(Sort);
|
||||
Wrapped.displayName = 'Sort';
|
||||
export default Wrapped;
|
||||
export default Sort;
|
||||
|
||||
@ -6,7 +6,7 @@ import {
|
||||
waitForElement,
|
||||
} from '../../../testUtils/enzymeHelpers';
|
||||
|
||||
import Sort, { _Sort as SortUnwrapped } from './Sort';
|
||||
import Sort from './Sort';
|
||||
|
||||
jest.mock('react-router-dom', () => ({
|
||||
...jest.requireActual('react-router-dom'),
|
||||
@ -167,7 +167,7 @@ describe('<Sort />', () => {
|
||||
const numericColumns = [{ name: 'ID', key: 'id' }];
|
||||
|
||||
const wrapper = shallow(
|
||||
<SortUnwrapped
|
||||
<Sort
|
||||
qsConfig={qsConfigNumDown}
|
||||
columns={numericColumns}
|
||||
onSort={jest.fn()}
|
||||
@ -186,7 +186,7 @@ describe('<Sort />', () => {
|
||||
const numericColumns = [{ name: 'ID', key: 'id' }];
|
||||
|
||||
const wrapper = shallow(
|
||||
<SortUnwrapped
|
||||
<Sort
|
||||
qsConfig={qsConfigNumUp}
|
||||
columns={numericColumns}
|
||||
onSort={jest.fn()}
|
||||
@ -205,7 +205,7 @@ describe('<Sort />', () => {
|
||||
const alphaColumns = [{ name: 'Name', key: 'name' }];
|
||||
|
||||
const wrapper = shallow(
|
||||
<SortUnwrapped
|
||||
<Sort
|
||||
qsConfig={qsConfigAlphaDown}
|
||||
columns={alphaColumns}
|
||||
onSort={jest.fn()}
|
||||
@ -224,7 +224,7 @@ describe('<Sort />', () => {
|
||||
const alphaColumns = [{ name: 'Name', key: 'name' }];
|
||||
|
||||
const wrapper = shallow(
|
||||
<SortUnwrapped
|
||||
<Sort
|
||||
qsConfig={qsConfigAlphaDown}
|
||||
columns={alphaColumns}
|
||||
onSort={jest.fn()}
|
||||
|
||||
@ -202,13 +202,6 @@ describe('<UserAndTeamAccessAdd/>', () => {
|
||||
})
|
||||
);
|
||||
|
||||
jest.mock('react-router-dom', () => ({
|
||||
...jest.requireActual('react-router-dom'),
|
||||
useParams: () => ({
|
||||
id: 'a',
|
||||
}),
|
||||
}));
|
||||
|
||||
await act(async () =>
|
||||
wrapper.find('SelectableCard[label="Job templates"]').prop('onClick')({
|
||||
fetchItems: JobTemplatesAPI.read,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user