fix(editable_champ): can enter negative decimal number

This commit is contained in:
Eric Leroy-Terquem 2023-10-06 15:05:36 +02:00
parent c53b0a1c9e
commit ff700b19bb
2 changed files with 6 additions and 1 deletions

View file

@ -54,6 +54,6 @@ export class FormatController extends ApplicationController {
const decimalSeparator =
value.lastIndexOf(',') > value.lastIndexOf('.') ? ',' : '.';
return value.replace(new RegExp(`[^\\d${decimalSeparator}]`, 'g'), '');
return value.replace(new RegExp(`[^-?\\d${decimalSeparator}]`, 'g'), '');
}
}

View file

@ -199,6 +199,11 @@ describe 'The user' do
wait_until {
champ_value_for('nombre décimal') == '1234.56'
}
fill_in('nombre décimal', with: '-1,234.56')
wait_until {
champ_value_for('nombre décimal') == '-1234.56'
}
end
scenario 'extends dossier experation date more than one time, ', js: true, retry: 3 do