Fix widget resizing handles, edge anchoring, scroll sync, and axis limits
This commit is contained in:
1 parent
216c80252d
commit
bb978fd6de
13 files changed
+538
-76
No files matched your search
+16
-1
@@ -173,8 +173,22 @@ const serve = () => new Promise((resolve) => {
|
||||
// hold a widget without moving: resize handles; drag them to snap it to the grid
|
||||
await longpress(".widget-slot");
|
||||
assert.ok(!(await p.$(".sheet")), "a widget gets handles, not the menu");
|
||||
assert.ok(await p.$(".widget-slot.resizing .resize-handle[data-edge=rb]"));
|
||||
assert.equal(await p.textContent(".resize-size"), "5 × 2");
|
||||
for (const edge of ["l", "r", "t", "b", "rb"]) {
|
||||
const box = await p.locator(`.resize-handle[data-edge=${edge}]`).boundingBox();
|
||||
assert.ok(box, `handle ${edge} rendered`);
|
||||
assert.ok(box.width >= 36 && box.height >= 36, `handle ${edge} generous target: ${box.width}x${box.height}`);
|
||||
assert.ok(box.x >= 0 && box.x + box.width <= 390, `handle ${edge} stays inside viewport: [${box.x}, ${box.x + box.width}]`);
|
||||
}
|
||||
await shot(p, "05-resize-handles");
|
||||
// resting a finger >= 500ms on a resize handle must not lift the widget or open a menu
|
||||
const hr = await p.locator(".resize-handle[data-edge=r]").boundingBox();
|
||||
await p.mouse.move(hr.x + hr.width / 2, hr.y + hr.height / 2);
|
||||
await p.mouse.down(); await p.waitForTimeout(600);
|
||||
assert.ok(await p.$(".widget-slot.resizing"), "holding handle keeps resize mode");
|
||||
assert.ok(!(await p.$(".widget-slot.lifted")), "holding handle does not lift widget");
|
||||
assert.ok(!(await p.$(".sheet")), "holding handle does not open sheet");
|
||||
await p.mouse.up(); await settle();
|
||||
const size = () => p.$eval(".widget-slot", (w) => [Math.round(w.getBoundingClientRect().width), Math.round(w.getBoundingClientRect().height)]);
|
||||
const [w0] = await size();
|
||||
const tile = await p.locator(".slots .tile").first().boundingBox();
|
||||
@@ -187,6 +201,7 @@ const serve = () => new Promise((resolve) => {
|
||||
const [w1, h1] = await size();
|
||||
assert.ok(w1 < w0 && Math.abs(w1 - (2 * tile.width + 8)) < 3, `two columns wide: ${w1} (tile ${tile.width})`);
|
||||
assert.equal(h1, 2 * 64 + 8, "snapped to two whole rows of tiles");
|
||||
assert.equal(await p.textContent(".resize-size"), "2 × 2");
|
||||
assert.ok(await p.$(".widget-slot.resizing"), "letting go of a handle keeps the handles");
|
||||
await p.click(".resize-bar >> text=Done"); await settle();
|
||||
assert.ok(!(await p.$(".resize-handle")));
|
||||
|
||||
Reference in new issue
Block a user