Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): unpin preview dragging on narrow chat canvases #15556

MergedMatthewFeroz(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/15556/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 23 additions and 5 deletions.

x
0 of 2 viewed, 2 left
17 additions and 2 deletionsapps/web/src/components/chat/chatCanvasLayout.test.tsModified
View file
@@ -70,6 +70,21 @@
expect(result.chat.left).toBe(20);
expectClear(result);
});
+ it.each([900, 1000, 1004])("allows dragging across a %spx chat canvas", (width) => {
+ const start = resolve(width, { ...preview, position: { x: width - 332, y: 200 } }).frame!;
+ const moved = resolve(width, {
+ ...preview,
+ position: { x: start.x - 300, y: start.y },
+ lastInteraction: "drag",
+ });
+ expect(moved.frame).toEqual({ ...start, x: start.x - 300 });
+ const returned = resolve(width, {
+ ...preview,
+ position: { x: start.x, y: start.y },
+ lastInteraction: "drag",
+ });
+ expect(returned.frame).toEqual(start);
+ });
it("stops leftward dragging before the player can push chat to the right", () => {
const centered = resolve(1344, null).chat;
for (const x of [1100, 800, 672, 600, 400, 12, -100]) {
@@ -85,7 +100,7 @@
it("keeps a dragged player above the composer when no readable lane fits beside it", () => {
const result = resolve(1000, { ...preview, position: { x: 12, y: 700 } });
expect(result.chat).toEqual(resolve(1000, null).chat);
- expect(result.frame!.x).toBe(668);
+ expect(result.frame!.x).toBe(12);
expect(result.frame!.y + result.frame!.height).toBeLessThanOrEqual(708);