fix(modal): backdrop animation when backdropBreakpoint is 1 (#25430)

Resolves #25402
This commit is contained in:
Sean Perkins
2022-06-13 13:37:11 -04:00
committed by GitHub
parent 7b105a3471
commit c10df52f39
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,11 @@
import { getBackdropValueForSheet } from './utils';
describe('getBackdropValueForSheet()', () => {
it('should return a valid integer when backdropBreakpoint is 1', () => {
/**
* Issue: https://github.com/ionic-team/ionic-framework/issues/25402
*/
const backdropBreakpoint = 1;
expect(getBackdropValueForSheet(1, backdropBreakpoint)).toBe(0);
});
});

View File

@ -23,7 +23,15 @@ export const getBackdropValueForSheet = (x: number, backdropBreakpoint: number)
*
* This is simplified from:
* m = (1 - 0) / (maxBreakpoint - backdropBreakpoint)
*
* If the backdropBreakpoint is 1, we return 0 as the
* backdrop is completely hidden.
*
*/
if (backdropBreakpoint === 1) {
return 0;
}
const slope = 1 / (1 - backdropBreakpoint);
/**