8f2fe7a8e6
* feat(web): add agent message comments * fix(web): harden agent message comments * fix(web): address message comment review findings * fix(web): allow comments on legacy agent messages * fix(web): address latest message comment review * fix(web): address follow-up message comment review * fix(web): address remaining message comment review * fix(web): keep failed mobile comments open * fix(web): preserve selections over message comments
31 lines
847 B
TypeScript
31 lines
847 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { placeFloatingRect, type FloatingBounds } from "./floating-selection-position";
|
|
|
|
describe("placeFloatingRect", () => {
|
|
const dialogBounds: FloatingBounds = { left: 100, top: 50, right: 500, bottom: 450 };
|
|
|
|
it("clamps horizontal placement to the portal container", () => {
|
|
expect(
|
|
placeFloatingRect({
|
|
left: 480,
|
|
topCandidates: [100],
|
|
width: 340,
|
|
height: 180,
|
|
bounds: dialogBounds,
|
|
}),
|
|
).toEqual({ left: 152, top: 100 });
|
|
});
|
|
|
|
it("uses the first fitting vertical candidate within the container", () => {
|
|
expect(
|
|
placeFloatingRect({
|
|
left: 120,
|
|
topCandidates: [430, 246],
|
|
width: 40,
|
|
height: 180,
|
|
bounds: dialogBounds,
|
|
}),
|
|
).toEqual({ left: 120, top: 246 });
|
|
});
|
|
});
|