refactor: update pricing input handling to use PriceInput component
- Replaced raw input fields for pricing with PriceInput component across various forms and modals to ensure consistent formatting and accessibility. - Updated tests to reflect changes in pricing input handling, ensuring values are displayed in toman with proper formatting. - Enhanced accessibility by adding aria-labels and aria-invalid attributes to PriceInput components. - Adjusted UI elements to improve layout and user experience, particularly in forms related to service items and scheduling. - Changed labels from "نمایش در نوبتدهی" to "نمایش در نوبتدهی آنلاین" for clarity.
This commit is contained in:
@@ -115,4 +115,23 @@ describe('PriceInput', () => {
|
||||
rerender(<PriceInput value={0} onChange={vi.fn()} />);
|
||||
expect(input().value).toBe('');
|
||||
});
|
||||
|
||||
/**
|
||||
* برچسبِ کنارِ بعضی فیلدهای مبلغ `<label>` واقعی نیست (span/div)، پس نامِ
|
||||
* دسترسیپذیر باید صریح داده شود؛ پیش از این آن فیلدها input خام بودند و
|
||||
* `aria-label` خودشان را داشتند.
|
||||
*/
|
||||
it('ariaLabel نام دسترسیپذیر میسازد', () => {
|
||||
render(<PriceInput value={0} onChange={vi.fn()} ariaLabel="قیمت ویزیت" />);
|
||||
|
||||
expect(screen.getByRole('textbox', { name: 'قیمت ویزیت' })).toBeTruthy();
|
||||
});
|
||||
|
||||
it('ariaInvalid فقط در حالت خطا روی فیلد مینشیند', () => {
|
||||
const { rerender } = render(<PriceInput value={0} onChange={vi.fn()} ariaInvalid />);
|
||||
expect(input().getAttribute('aria-invalid')).toBe('true');
|
||||
|
||||
rerender(<PriceInput value={0} onChange={vi.fn()} />);
|
||||
expect(input().getAttribute('aria-invalid')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user