fix(panel): LuckPerms 页在手机上玩家栏按内容收高、列表在卡内滚动,选中玩家的面板落在首屏
This commit is contained in:
3 files changed
+43
-4
No files matched your search
@@ -20,6 +20,7 @@ for (const [account, path] of [
|
||||
["linked", "/account"],
|
||||
["owner", "/servers"],
|
||||
["owner", "/admin/users"],
|
||||
["owner", "/servers/survival/luckperms"],
|
||||
] as const) {
|
||||
test(`${path} fits a 375px screen for ${account}`, async ({ page, signIn }) => {
|
||||
await signIn(account);
|
||||
@@ -29,3 +30,23 @@ for (const [account, path] of [
|
||||
await expectFitsScreen(page);
|
||||
});
|
||||
}
|
||||
|
||||
test("the LuckPerms player list leaves the rest of the page on the first screen", async ({ page, signIn }) => {
|
||||
await signIn("owner");
|
||||
await page.goto("/servers/survival/luckperms");
|
||||
const list = page.getByRole("button", { name: "mock_player", exact: true }).locator("..");
|
||||
await expect(list).toBeVisible();
|
||||
|
||||
// Twelve players online: the list scrolls inside its card, so the prompt
|
||||
// under it shows without scrolling the page.
|
||||
await expect(page.getByText(t("servers:luckperms_select_player_prompt"))).toBeInViewport({ ratio: 1 });
|
||||
const { scrollHeight, clientHeight } = await list.evaluate((el) => ({
|
||||
scrollHeight: el.scrollHeight,
|
||||
clientHeight: el.clientHeight,
|
||||
}));
|
||||
expect(scrollHeight).toBeGreaterThan(clientHeight);
|
||||
|
||||
// The last one is still a tap away.
|
||||
await page.getByRole("button", { name: "Herobrine", exact: true }).click();
|
||||
await expect(page.getByRole("textbox", { name: t("servers:luckperms_player_lookup") })).toHaveValue("Herobrine");
|
||||
});
|
||||
@@ -73,3 +73,19 @@ test("a player's pages load on demand and never pull in the admin pages", async
|
||||
await expect.poll(() => fetched.some((p) => ACCOUNT_PAGE.test(p))).toBe(true);
|
||||
expect(fetched.filter((p) => ADMIN_PAGE.test(p))).toEqual([]);
|
||||
});
|
||||
|
||||
test("on a wide screen the LuckPerms player list runs down its column", async ({ page, signIn }) => {
|
||||
await signIn("owner");
|
||||
await page.goto("/servers/survival/luckperms");
|
||||
const list = page.getByRole("button", { name: "mock_player", exact: true }).locator("..");
|
||||
await expect(list).toBeVisible();
|
||||
|
||||
const listBox = (await list.boundingBox())!;
|
||||
const cardBox = (await list.locator("..").boundingBox())!;
|
||||
expect(cardBox.height).toBeGreaterThanOrEqual(500);
|
||||
expect(Math.abs(listBox.y + listBox.height - (cardBox.y + cardBox.height))).toBeLessThanOrEqual(2);
|
||||
|
||||
// A taller screen grows the card to its cap, whatever the roster holds.
|
||||
await page.setViewportSize({ width: 1280, height: 1000 });
|
||||
await expect.poll(async () => (await list.locator("..").boundingBox())!.height).toBe(700);
|
||||
});
|
||||
Reference in new issue
Block a user