feat: redesign insurance pricing page with tabbed navigation for basic and supplementary insurance, expandable rows for contract details, and move free visit price card to appointment settings
This commit is contained in:
@@ -51,13 +51,15 @@ describe('contractToForm', () => {
|
||||
});
|
||||
|
||||
describe('InsuranceModal', () => {
|
||||
it('renders all seven fields in add mode', () => {
|
||||
it('renders the fields in add mode with no manual kind select', () => {
|
||||
renderWithProviders(
|
||||
<InsuranceModal open editContract={null} options={options} onClose={() => {}} onSubmit={() => {}} />,
|
||||
<InsuranceModal open editContract={null} options={options} kind="basic" onClose={() => {}} onSubmit={() => {}} />,
|
||||
);
|
||||
expect(screen.getByText('افزودن بیمه')).toBeInTheDocument();
|
||||
expect(screen.getByText('نام بیمه')).toBeInTheDocument();
|
||||
expect(screen.getByText('نوع بیمه')).toBeInTheDocument();
|
||||
// Manual "نوع بیمه" select is gone; kind is shown as a read-only chip from the tab.
|
||||
expect(screen.queryByText('نوع بیمه')).not.toBeInTheDocument();
|
||||
expect(screen.getByText('پایه')).toBeInTheDocument();
|
||||
expect(screen.getByText('تاریخ شروع قرارداد')).toBeInTheDocument();
|
||||
expect(screen.getByText('تاریخ پایان قرارداد')).toBeInTheDocument();
|
||||
expect(screen.getByText('درصد پوشش')).toBeInTheDocument();
|
||||
@@ -66,10 +68,18 @@ describe('InsuranceModal', () => {
|
||||
expect(screen.getByText('ثبت بیمه')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows the tab kind chip and carries it into a new payload', () => {
|
||||
const onSubmit = vi.fn();
|
||||
renderWithProviders(
|
||||
<InsuranceModal open editContract={null} options={options} kind="supplementary" onClose={() => {}} onSubmit={onSubmit} />,
|
||||
);
|
||||
expect(screen.getByText('تکمیلی')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('submits the built payload for an edited contract', () => {
|
||||
const onSubmit = vi.fn();
|
||||
renderWithProviders(
|
||||
<InsuranceModal open editContract={mkContract()} options={options} onClose={() => {}} onSubmit={onSubmit} />,
|
||||
<InsuranceModal open editContract={mkContract()} options={options} kind="basic" onClose={() => {}} onSubmit={onSubmit} />,
|
||||
);
|
||||
fireEvent.click(screen.getByText('ثبت بیمه'));
|
||||
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
||||
|
||||
Reference in New Issue
Block a user