fix(chat): calibrate Facebook IAB keyboard fallback
This commit is contained in:
@@ -84,27 +84,36 @@ describe("resolveChatKeyboardInset", () => {
|
||||
|
||||
describe("resolveChatKeyboardFallbackInset", () => {
|
||||
it.each([
|
||||
[{ layoutWidth: 320, layoutHeight: 568 }, 256],
|
||||
[{ layoutWidth: 360, layoutHeight: 640 }, 285],
|
||||
[{ layoutWidth: 390, layoutHeight: 844 }, 316],
|
||||
[{ layoutWidth: 430, layoutHeight: 932 }, 347],
|
||||
[{ layoutWidth: 320, layoutHeight: 568 }, 260],
|
||||
[{ layoutWidth: 360, layoutHeight: 640 }, 291],
|
||||
[{ layoutWidth: 390, layoutHeight: 844 }, 344],
|
||||
[{ layoutWidth: 430, layoutHeight: 932 }, 356],
|
||||
])("fits common viewport %o", (viewport, expectedInset) => {
|
||||
expect(resolveChatKeyboardFallbackInset(viewport)).toBe(expectedInset);
|
||||
});
|
||||
|
||||
it("covers the reported 392 by 760 Facebook viewport", () => {
|
||||
expect(
|
||||
resolveChatKeyboardFallbackInset({
|
||||
layoutWidth: 392,
|
||||
layoutHeight: 760,
|
||||
}),
|
||||
).toBe(343);
|
||||
});
|
||||
|
||||
it("stays stable across tall viewports with the same width", () => {
|
||||
expect(
|
||||
resolveChatKeyboardFallbackInset({
|
||||
layoutWidth: 390,
|
||||
layoutHeight: 760,
|
||||
}),
|
||||
).toBe(316);
|
||||
).toBe(343);
|
||||
expect(
|
||||
resolveChatKeyboardFallbackInset({
|
||||
layoutWidth: 390,
|
||||
layoutHeight: 900,
|
||||
}),
|
||||
).toBe(316);
|
||||
).toBe(344);
|
||||
});
|
||||
|
||||
it("keeps the keyboard estimate within its bounds", () => {
|
||||
|
||||
Reference in New Issue
Block a user