mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 17:37:30 -02:30
Fixes test failure
This commit is contained in:
@@ -1,133 +1,133 @@
|
|||||||
// These tests have been turned off because they fail due to a console wanring coming from patternfly.
|
// These tests have been turned off because they fail due to a console wanring coming from patternfly.
|
||||||
// The warning is that the onDrag api has been deprecated. It's replacement is a DragDrop component,
|
// The warning is that the onDrag api has been deprecated. It's replacement is a DragDrop component,
|
||||||
// however that component is not keyboard accessible. Therefore we have elected to turn off these tests.
|
// however that component is not keyboard accessible. Therefore we have elected to turn off these tests.
|
||||||
// https://github.com/patternfly/patternfly-react/issues/6317s
|
//github.com/patternfly/patternfly-react/issues/6317s
|
||||||
|
|
||||||
// import React from 'react';
|
import React from 'react';
|
||||||
// import { act } from 'react-dom/test-utils';
|
import { act } from 'react-dom/test-utils';
|
||||||
// import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
||||||
// import DraggableSelectedList from './DraggableSelectedList';
|
import DraggableSelectedList from './DraggableSelectedList';
|
||||||
|
|
||||||
// describe('<DraggableSelectedList />', () => {
|
describe.skip('<DraggableSelectedList />', () => {
|
||||||
// let wrapper;
|
let wrapper;
|
||||||
// afterEach(() => {
|
afterEach(() => {
|
||||||
// jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
// });
|
});
|
||||||
|
|
||||||
// test('should render expected rows', () => {
|
test('should render expected rows', () => {
|
||||||
// const mockSelected = [
|
const mockSelected = [
|
||||||
// {
|
{
|
||||||
// id: 1,
|
id: 1,
|
||||||
// name: 'foo',
|
name: 'foo',
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// id: 2,
|
id: 2,
|
||||||
// name: 'bar',
|
name: 'bar',
|
||||||
// },
|
},
|
||||||
// ];
|
];
|
||||||
// wrapper = mountWithContexts(
|
wrapper = mountWithContexts(
|
||||||
// <DraggableSelectedList
|
<DraggableSelectedList
|
||||||
// selected={mockSelected}
|
selected={mockSelected}
|
||||||
// onRemove={() => {}}
|
onRemove={() => {}}
|
||||||
// onRowDrag={() => {}}
|
onRowDrag={() => {}}
|
||||||
// />
|
/>
|
||||||
// );
|
);
|
||||||
// expect(wrapper.find('DraggableSelectedList').length).toBe(1);
|
expect(wrapper.find('DraggableSelectedList').length).toBe(1);
|
||||||
// expect(wrapper.find('DataListItem').length).toBe(2);
|
expect(wrapper.find('DataListItem').length).toBe(2);
|
||||||
// expect(
|
expect(
|
||||||
// wrapper
|
wrapper
|
||||||
// .find('DataListItem DataListCell')
|
.find('DataListItem DataListCell')
|
||||||
// .first()
|
.first()
|
||||||
// .containsMatchingElement(<span>1. foo</span>)
|
.containsMatchingElement(<span>1. foo</span>)
|
||||||
// ).toEqual(true);
|
).toEqual(true);
|
||||||
// expect(
|
expect(
|
||||||
// wrapper
|
wrapper
|
||||||
// .find('DataListItem DataListCell')
|
.find('DataListItem DataListCell')
|
||||||
// .last()
|
.last()
|
||||||
// .containsMatchingElement(<span>2. bar</span>)
|
.containsMatchingElement(<span>2. bar</span>)
|
||||||
// ).toEqual(true);
|
).toEqual(true);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// test('should not render when selected list is empty', () => {
|
test('should not render when selected list is empty', () => {
|
||||||
// wrapper = mountWithContexts(
|
wrapper = mountWithContexts(
|
||||||
// <DraggableSelectedList
|
<DraggableSelectedList
|
||||||
// selected={[]}
|
selected={[]}
|
||||||
// onRemove={() => {}}
|
onRemove={() => {}}
|
||||||
// onRowDrag={() => {}}
|
onRowDrag={() => {}}
|
||||||
// />
|
/>
|
||||||
// );
|
);
|
||||||
// expect(wrapper.find('DataList').length).toBe(0);
|
expect(wrapper.find('DataList').length).toBe(0);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// test('should call onRemove callback prop on remove button click', () => {
|
test('should call onRemove callback prop on remove button click', () => {
|
||||||
// const onRemove = jest.fn();
|
const onRemove = jest.fn();
|
||||||
// const mockSelected = [
|
const mockSelected = [
|
||||||
// {
|
{
|
||||||
// id: 1,
|
id: 1,
|
||||||
// name: 'foo',
|
name: 'foo',
|
||||||
// },
|
},
|
||||||
// ];
|
];
|
||||||
// wrapper = mountWithContexts(
|
wrapper = mountWithContexts(
|
||||||
// <DraggableSelectedList selected={mockSelected} onRemove={onRemove} />
|
<DraggableSelectedList selected={mockSelected} onRemove={onRemove} />
|
||||||
// );
|
);
|
||||||
// expect(
|
expect(
|
||||||
// wrapper
|
wrapper
|
||||||
// .find('DataListDragButton[aria-label="Reorder"]')
|
.find('DataListDragButton[aria-label="Reorder"]')
|
||||||
// .prop('isDisabled')
|
.prop('isDisabled')
|
||||||
// ).toBe(true);
|
).toBe(true);
|
||||||
// wrapper
|
wrapper
|
||||||
// .find('DataListItem[id="foo"] Button[aria-label="Remove"]')
|
.find('DataListItem[id="foo"] Button[aria-label="Remove"]')
|
||||||
// .simulate('click');
|
.simulate('click');
|
||||||
// expect(onRemove).toBeCalledWith({
|
expect(onRemove).toBeCalledWith({
|
||||||
// id: 1,
|
id: 1,
|
||||||
// name: 'foo',
|
name: 'foo',
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
|
||||||
// test('should disable remove button when dragging item', () => {
|
test('should disable remove button when dragging item', () => {
|
||||||
// const mockSelected = [
|
const mockSelected = [
|
||||||
// {
|
{
|
||||||
// id: 1,
|
id: 1,
|
||||||
// name: 'foo',
|
name: 'foo',
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// id: 2,
|
id: 2,
|
||||||
// name: 'bar',
|
name: 'bar',
|
||||||
// },
|
},
|
||||||
// ];
|
];
|
||||||
// wrapper = mountWithContexts(
|
wrapper = mountWithContexts(
|
||||||
// <DraggableSelectedList
|
<DraggableSelectedList
|
||||||
// selected={mockSelected}
|
selected={mockSelected}
|
||||||
// onRemove={() => {}}
|
onRemove={() => {}}
|
||||||
// onRowDrag={() => {}}
|
onRowDrag={() => {}}
|
||||||
// />
|
/>
|
||||||
// );
|
);
|
||||||
|
|
||||||
// expect(
|
expect(
|
||||||
// wrapper.find('Button[aria-label="Remove"]').at(0).prop('isDisabled')
|
wrapper.find('Button[aria-label="Remove"]').at(0).prop('isDisabled')
|
||||||
// ).toBe(false);
|
).toBe(false);
|
||||||
// expect(
|
expect(
|
||||||
// wrapper.find('Button[aria-label="Remove"]').at(1).prop('isDisabled')
|
wrapper.find('Button[aria-label="Remove"]').at(1).prop('isDisabled')
|
||||||
// ).toBe(false);
|
).toBe(false);
|
||||||
// act(() => {
|
act(() => {
|
||||||
// wrapper.find('DataList').prop('onDragStart')();
|
wrapper.find('DataList').prop('onDragStart')();
|
||||||
// });
|
});
|
||||||
// wrapper.update();
|
wrapper.update();
|
||||||
// expect(
|
expect(
|
||||||
// wrapper.find('Button[aria-label="Remove"]').at(0).prop('isDisabled')
|
wrapper.find('Button[aria-label="Remove"]').at(0).prop('isDisabled')
|
||||||
// ).toBe(true);
|
).toBe(true);
|
||||||
// expect(
|
expect(
|
||||||
// wrapper.find('Button[aria-label="Remove"]').at(1).prop('isDisabled')
|
wrapper.find('Button[aria-label="Remove"]').at(1).prop('isDisabled')
|
||||||
// ).toBe(true);
|
).toBe(true);
|
||||||
// act(() => {
|
act(() => {
|
||||||
// wrapper.find('DataList').prop('onDragCancel')();
|
wrapper.find('DataList').prop('onDragCancel')();
|
||||||
// });
|
});
|
||||||
// wrapper.update();
|
wrapper.update();
|
||||||
// expect(
|
expect(
|
||||||
// wrapper.find('Button[aria-label="Remove"]').at(0).prop('isDisabled')
|
wrapper.find('Button[aria-label="Remove"]').at(0).prop('isDisabled')
|
||||||
// ).toBe(false);
|
).toBe(false);
|
||||||
// expect(
|
expect(
|
||||||
// wrapper.find('Button[aria-label="Remove"]').at(1).prop('isDisabled')
|
wrapper.find('Button[aria-label="Remove"]').at(1).prop('isDisabled')
|
||||||
// ).toBe(false);
|
).toBe(false);
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ describe('JobOutputSearch', () => {
|
|||||||
wrapper.find(searchBtn).simulate('click');
|
wrapper.find(searchBtn).simulate('click');
|
||||||
});
|
});
|
||||||
expect(wrapper.find('Search').prop('columns')).toHaveLength(3);
|
expect(wrapper.find('Search').prop('columns')).toHaveLength(3);
|
||||||
expect(wrapper.find('Search').prop('columns').at(0).name).toBe('Stdout');
|
expect(wrapper.find('Search').prop('columns')[0].name).toBe('Stdout');
|
||||||
expect(wrapper.find('Search').prop('columns').at(1).name).toBe('Event');
|
expect(wrapper.find('Search').prop('columns')[1].name).toBe('Event');
|
||||||
expect(wrapper.find('Search').prop('columns').at(2).name).toBe('Advanced');
|
expect(wrapper.find('Search').prop('columns')[2].name).toBe('Advanced');
|
||||||
expect(history.location.search).toEqual('?stdout__icontains=99');
|
expect(history.location.search).toEqual('?stdout__icontains=99');
|
||||||
});
|
});
|
||||||
test('Should not have Event key in search drop down for system job', () => {
|
test('Should not have Event key in search drop down for system job', () => {
|
||||||
@@ -70,8 +70,8 @@ describe('JobOutputSearch', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
expect(wrapper.find('Search').prop('columns')).toHaveLength(2);
|
expect(wrapper.find('Search').prop('columns')).toHaveLength(2);
|
||||||
expect(wrapper.find('Search').prop('columns').at(0).name).toBe('Stdout');
|
expect(wrapper.find('Search').prop('columns')[0].name).toBe('Stdout');
|
||||||
expect(wrapper.find('Search').prop('columns').at(1).name).toBe('Advanced');
|
expect(wrapper.find('Search').prop('columns')[1].name).toBe('Advanced');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Should not have Event key in search drop down for inventory update job', () => {
|
test('Should not have Event key in search drop down for inventory update job', () => {
|
||||||
@@ -94,8 +94,9 @@ describe('JobOutputSearch', () => {
|
|||||||
context: { router: { history } },
|
context: { router: { history } },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(wrapper.find('Search').prop('columns')).toHaveLength(2);
|
expect(wrapper.find('Search').prop('columns')).toHaveLength(2);
|
||||||
expect(wrapper.find('Search').prop('columns').at(0).name).toBe('Stdout');
|
expect(wrapper.find('Search').prop('columns')[0].name).toBe('Stdout');
|
||||||
expect(wrapper.find('Search').prop('columns').at(1).name).toBe('Advanced');
|
expect(wrapper.find('Search').prop('columns')[1].name).toBe('Advanced');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user