mock: バリアントグループを選んでキーを足すと、表示中のバリアントに新しい行を作る(T-30 単位6)
クラスターを選んだときと同じ挙動にそろえる。これまではグループの右隣(親の中)に足していた。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XsamNKrWY3obJwR746oQRq
This commit is contained in:
@@ -637,3 +637,24 @@ test("クラスターを選んでキーを足すと、そのクラスターに
|
||||
expect(Math.abs(box.x - left!.x)).toBeLessThan(1);
|
||||
expect(Math.abs(box.y - (left!.y + unit))).toBeLessThan(1);
|
||||
});
|
||||
|
||||
test("バリアントグループを選んでキーを足すと、表示中のバリアントに新しい行を作る", async ({ page }) => {
|
||||
await keysSelectVariantGroup(page);
|
||||
const group = page.locator('[data-node-type="variantGroup"]').first();
|
||||
const groupId = await group.getAttribute("data-node-id");
|
||||
await page.locator(`[data-tree-id="${groupId}"]`).first().click();
|
||||
const groupKeys = group.locator('[data-node-type="key"]');
|
||||
const before = await groupKeys.evaluateAll((es) => es.map((e) => e.getAttribute("data-node-id")));
|
||||
const boxes = await Promise.all(before.map((id) => page.locator(`[data-node-id="${id}"]`).boundingBox()));
|
||||
await page.getByRole("button", { name: "キーを足す" }).click();
|
||||
await expect(groupKeys).toHaveCount(before.length + 1);
|
||||
const after = await groupKeys.evaluateAll((es) => es.map((e) => e.getAttribute("data-node-id")));
|
||||
const added = after.find((id) => !before.includes(id));
|
||||
await expect(page.locator(`[data-sel-id="${added}"]`)).toHaveCount(1);
|
||||
const box = (await page.locator(`[data-node-id="${added}"]`).boundingBox())!;
|
||||
// The variant holds two keys of the first row, 1U apart; the new row starts 1U below its left end.
|
||||
const [left, right] = [...boxes].sort((a, b) => a!.x - b!.x);
|
||||
const unit = right!.x - left!.x;
|
||||
expect(Math.abs(box.x - left!.x)).toBeLessThan(1);
|
||||
expect(Math.abs(box.y - (left!.y + unit))).toBeLessThan(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user