PR-722301: fixing list tests.
This commit is contained in:
parent
d1da40fdd2
commit
93d1776d8b
@ -4,21 +4,23 @@ import { List, Status } from '@components';
|
|||||||
describe('Testing List Component', () => {
|
describe('Testing List Component', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.mount(<List list={[
|
cy.mount(<List list={[
|
||||||
{
|
{
|
||||||
name: 'First Item',
|
name: 'First Item',
|
||||||
status: Status.DONE
|
status: Status.DONE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Second Item',
|
name: 'Second Item',
|
||||||
status: Status.TODO
|
status: Status.TODO
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Third Item',
|
name: 'Third Item',
|
||||||
status: Status.DONE
|
status: Status.DONE
|
||||||
}
|
}
|
||||||
]} />);
|
]}
|
||||||
|
handleChangeState={() => {}}
|
||||||
|
/>);
|
||||||
})
|
})
|
||||||
it('Show All Items in a list', () => {
|
it('Show All Items in a list', () => {
|
||||||
cy.get('input').should('have.length', 3);
|
cy.get('[role="textbox"]').should('have.length', 3);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -6,19 +6,21 @@ describe('Testing List Component', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// fetchMock.resetMocks();
|
// fetchMock.resetMocks();
|
||||||
render(<List list={[
|
render(<List list={[
|
||||||
{
|
{
|
||||||
name: 'First Item',
|
name: 'First Item',
|
||||||
status: Status.DONE
|
status: Status.DONE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Second Item',
|
name: 'Second Item',
|
||||||
status: Status.TODO
|
status: Status.TODO
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Third Item',
|
name: 'Third Item',
|
||||||
status: Status.DONE
|
status: Status.DONE
|
||||||
}
|
}
|
||||||
]} />)
|
]}
|
||||||
|
handleChangeState={() => {}}
|
||||||
|
/>)
|
||||||
});
|
});
|
||||||
it('Show All Items in a list', async () => {
|
it('Show All Items in a list', async () => {
|
||||||
/* fetchMock.mockResponseOnce(JSON.stringify({
|
/* fetchMock.mockResponseOnce(JSON.stringify({
|
||||||
|
@ -24,6 +24,10 @@ type TListProps = {
|
|||||||
* Is this the onClick Event of the button.
|
* Is this the onClick Event of the button.
|
||||||
*/
|
*/
|
||||||
onClickRemoveItem?: MouseEventHandler<HTMLButtonElement> |undefined
|
onClickRemoveItem?: MouseEventHandler<HTMLButtonElement> |undefined
|
||||||
|
/**
|
||||||
|
* Is this the on Event triggered by the checkbox.
|
||||||
|
*/
|
||||||
|
handleChangeState?: ChangeEventHandler<HTMLInputElement>
|
||||||
};
|
};
|
||||||
|
|
||||||
const List: FC<TListProps> = ({
|
const List: FC<TListProps> = ({
|
||||||
@ -31,7 +35,8 @@ const List: FC<TListProps> = ({
|
|||||||
placeholderInput,
|
placeholderInput,
|
||||||
onChangeInput,
|
onChangeInput,
|
||||||
onClickAddItem,
|
onClickAddItem,
|
||||||
onClickRemoveItem
|
onClickRemoveItem,
|
||||||
|
handleChangeState
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<div className="List">
|
<div className="List">
|
||||||
@ -39,7 +44,7 @@ const List: FC<TListProps> = ({
|
|||||||
<tbody>
|
<tbody>
|
||||||
{ list !== undefined && list.map((item, index) => (
|
{ list !== undefined && list.map((item, index) => (
|
||||||
<tr key={index}>
|
<tr key={index}>
|
||||||
<td><Item name={item.name} status={item.status} /></td>
|
<td><Item name={item.name} status={item.status} handleChange={handleChangeState} /></td>
|
||||||
<td>
|
<td>
|
||||||
<div className="delete-button-container">
|
<div className="delete-button-container">
|
||||||
<Button
|
<Button
|
||||||
|
Loading…
Reference in New Issue
Block a user