Fix stepper validation issue

This commit is contained in:
Arnaud 2024-11-27 15:38:07 +01:00
parent 1b9bc61647
commit 30726228bd
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663
2 changed files with 3 additions and 3 deletions

View File

@ -8,9 +8,9 @@ test('create an availability', async ({ page }) => {
await page.locator('.availability-edit button').first().click();
await page.getByLabel('Total size').click();
const value = (Math.random() * 0.5);
const value = (Math.random() * 0.5) + 0.1;
await page.getByLabel('Total size').fill(value.toFixed(2));
await page.getByLabel('Total size').fill(value.toFixed(1));
await page.getByLabel('Duration').click();
await page.getByLabel('Duration').fill('30');
await page.getByLabel('Min price').click();

View File

@ -48,7 +48,7 @@ export const AvailabilityUtils = {
isValid: (
availability: AvailabilityState,
max: number
) => availability.totalSize > 0 && availability.totalSize <= max
) => availability.totalSize > 0 && availability.totalSize * AvailabilityUtils.unitValue(availability.totalSizeUnit) <= max
,
toggle: <T>(arr: Array<T>, value: T) =>
arr.includes(value) ? arr.filter(i => i !== value) : [...arr, value],