Skip to content

Commit

Permalink
feat: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
小豪 committed Oct 16, 2024
1 parent 7692626 commit 75fdf31
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Panel.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,17 @@ describe('Cascader.Panel', () => {
const checkedLi = container.querySelector('[aria-checked="true"]');
expect(checkedLi?.textContent).toEqual('Little');
});

it('disabled', () => {
const onChange = jest.fn();
const { container } = render(
<Cascader.Panel options={options} onChange={onChange} disabled={true} />,
);

expect(container.querySelector('.rc-cascader-panel-disabled')).toBeTruthy();

const selectOption = container.querySelector('.rc-cascader-menu-item')!;
fireEvent.click(selectOption);
expect(onChange).not.toHaveBeenCalled();
});
});

0 comments on commit 75fdf31

Please sign in to comment.