fix(Animation): Problem decimals using commas as decimal separation
Tests where failing due to `.` character being used as decimal separator in some regional settings (like spanish for example) Closes #6335 Closes #6338
This commit is contained in:
parent
97e94dd6e0
commit
5f3d02bc7c
|
@ -184,6 +184,7 @@ export class Animation {
|
|||
let value = NumberWrapper.parseInt(this.stripLetters(duration), 10);
|
||||
if (value > maxValue) maxValue = value;
|
||||
} else if (duration.substring(duration.length - 1) == 's') {
|
||||
duration = StringWrapper.replace(duration, ',', '.');
|
||||
let ms = NumberWrapper.parseFloat(this.stripLetters(duration)) * 1000;
|
||||
let value = Math.floor(ms);
|
||||
if (value > maxValue) maxValue = value;
|
||||
|
|
|
@ -93,6 +93,15 @@ export function main() {
|
|||
}
|
||||
}));
|
||||
|
||||
it('should support parsing when commas are used as decimal separator due to regional settings',
|
||||
inject([AnimationBuilder], (animate) => {
|
||||
var animateCss = animate.css();
|
||||
var element = el(`<div></div>`);
|
||||
var runner = animateCss.start(element);
|
||||
expect(runner.parseDurationString('0,5s')).toBe(500);
|
||||
expect(runner.parseDurationString('0.5s')).toBe(500);
|
||||
}));
|
||||
|
||||
it('should add classes', inject([AnimationBuilder], (animate) => {
|
||||
var animateCss = animate.css().addClass('one').addClass('two');
|
||||
var element = el('<div></div>');
|
||||
|
|
Loading…
Reference in New Issue