| ... | @@ -76,6 +76,21 @@ describe("chat canvas layout", () => { | ... | @@ -76,6 +76,21 @@ describe("chat canvas layout", () => { |
| 76 | expect(result.chat.left).toBe(48); | 76 | expect(result.chat.left).toBe(48); |
| 77 | expectClear(result); | 77 | expectClear(result); |
| 78 | }); | 78 | }); |
| | 79 | it.each([900, 1000, 1004])("allows dragging across a %spx chat canvas", (width) => { |
| | 80 | const start = resolve(width, { ...preview, position: { x: width - 332, y: 200 } }).frame!; |
| | 81 | const moved = resolve(width, { |
| | 82 | ...preview, |
| | 83 | position: { x: start.x - 300, y: start.y }, |
| | 84 | lastInteraction: "drag", |
| | 85 | }); |
| | 86 | expect(moved.frame).toEqual({ ...start, x: start.x - 300 }); |
| | 87 | const returned = resolve(width, { |
| | 88 | ...preview, |
| | 89 | position: { x: start.x, y: start.y }, |
| | 90 | lastInteraction: "drag", |
| | 91 | }); |
| | 92 | expect(returned.frame).toEqual(start); |
| | 93 | }); |
| 79 | it("stops leftward dragging before the player can push chat to the right", () => { | 94 | it("stops leftward dragging before the player can push chat to the right", () => { |
| 80 | const centered = resolve(1344, null).chat; | 95 | const centered = resolve(1344, null).chat; |
| 81 | for (const x of [1100, 800, 700, 600, 400, 12, -100]) { | 96 | for (const x of [1100, 800, 700, 600, 400, 12, -100]) { |
| ... | @@ -91,7 +106,7 @@ describe("chat canvas layout", () => { | ... | @@ -91,7 +106,7 @@ describe("chat canvas layout", () => { |
| 91 | it("keeps a dragged player above the composer when no readable lane fits beside it", () => { | 106 | it("keeps a dragged player above the composer when no readable lane fits beside it", () => { |
| 92 | const result = resolve(1000, { ...preview, position: { x: 12, y: 700 } }); | 107 | const result = resolve(1000, { ...preview, position: { x: 12, y: 700 } }); |
| 93 | expect(result.chat).toEqual(resolve(1000, null).chat); | 108 | expect(result.chat).toEqual(resolve(1000, null).chat); |
| 94 | expect(result.frame!.x).toBe(668); | 109 | expect(result.frame!.x).toBe(12); |
| 95 | expect(result.frame!.y + result.frame!.height).toBeLessThanOrEqual(708); | 110 | expect(result.frame!.y + result.frame!.height).toBeLessThanOrEqual(708); |
| 96 | }); | 111 | }); |
| 97 | it("allows message overlap on narrow screens while excluding the composer", () => { | 112 | it("allows message overlap on narrow screens while excluding the composer", () => { |
| ... | @@ -299,7 +314,7 @@ describe("chat canvas layout", () => { | ... | @@ -299,7 +314,7 @@ describe("chat canvas layout", () => { |
| 299 | }); | 314 | }); |
| 300 | expect(result.overlapsDetailsCard).toBe(true); | 315 | expect(result.overlapsDetailsCard).toBe(true); |
| 301 | expect(result.overlapsChat).toBe(true); | 316 | expect(result.overlapsChat).toBe(true); |
| 302 | expect(result.frame).toEqual({ x: 272, y: 396, width: 1300, height: 400 }); | 317 | expect(result.frame).toEqual({ x: 12, y: 396, width: 1300, height: 400 }); |
| 303 | }); | 318 | }); |
| 304 | }); | 319 | }); |
| 305 | | 320 | |