fix: Alpha 列表失败项单行省略并提供完整提示
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
Tag,
|
||||
TextArea,
|
||||
Toast,
|
||||
Typography,
|
||||
} from "@douyinfe/semi-ui-19";
|
||||
import type { ColumnProps } from "@douyinfe/semi-ui-19/lib/es/table/interface";
|
||||
import {
|
||||
@@ -487,9 +488,25 @@ export function AlphaPage({
|
||||
title: "失败项",
|
||||
width: 230,
|
||||
render: (_, row) => (
|
||||
<span title={row!.failed_checks?.join("、")}>
|
||||
<Typography.Text
|
||||
className="alpha-failed-checks"
|
||||
size="inherit"
|
||||
style={{ width: "100%" }}
|
||||
ellipsis={{
|
||||
showTooltip: {
|
||||
opts: {
|
||||
content: row!.failed_checks?.join("\n"),
|
||||
style: {
|
||||
whiteSpace: "pre-line",
|
||||
overflowWrap: "anywhere",
|
||||
maxWidth: 420,
|
||||
},
|
||||
},
|
||||
},
|
||||
}}
|
||||
>
|
||||
{row!.failed_checks?.join("、") || "—"}
|
||||
</span>
|
||||
</Typography.Text>
|
||||
),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -5,6 +5,20 @@ test("submission tabs, day selection, local correlation and reload", async ({
|
||||
}) => {
|
||||
const errors: string[] = [];
|
||||
page.on("pageerror", (error) => errors.push(error.message));
|
||||
const failedChecks = [
|
||||
"LOW_SHARPE",
|
||||
"LOW_FITNESS",
|
||||
"LOW_GLB_AMER_SHARPE",
|
||||
"LOW_GLB_EMEA_SHARPE",
|
||||
"LOW_GLB_APAC_SHARPE",
|
||||
"LOW_2Y_SHARPE",
|
||||
];
|
||||
await page.route("**/api/v1/alphas?*", async (route) => {
|
||||
const response = await route.fetch();
|
||||
const data = await response.json();
|
||||
if (data.items?.length) data.items[0].failed_checks = failedChecks;
|
||||
await route.fulfill({ response, json: data });
|
||||
});
|
||||
await page.goto("/#alphas");
|
||||
await page.getByLabel("密码", { exact: true }).fill("browser-test-password");
|
||||
await page.getByRole("button", { name: "进入工作空间" }).click();
|
||||
@@ -70,6 +84,17 @@ test("submission tabs, day selection, local correlation and reload", async ({
|
||||
await page.getByRole("textbox", { name: "搜索 Alpha" }).fill("TEST0003");
|
||||
await page.getByRole("button", { name: "查询", exact: true }).click();
|
||||
await expect(page.locator(".alpha-link")).toHaveCount(1);
|
||||
const failedCell = page.locator(".alpha-failed-checks");
|
||||
await failedCell.scrollIntoViewIfNeeded();
|
||||
expect((await failedCell.boundingBox())!.height).toBeLessThanOrEqual(24);
|
||||
await failedCell.hover();
|
||||
await expect(page.getByRole("tooltip")).toHaveText(failedChecks.join("\n"));
|
||||
await page.screenshot({
|
||||
path: "../output/playwright/alpha-failed-checks-tooltip.png",
|
||||
animations: "disabled",
|
||||
});
|
||||
await page.getByRole("tab", { name: "待提交", exact: true }).hover();
|
||||
|
||||
await page.getByRole("tab", { name: "待提交", exact: true }).click();
|
||||
await expect(page.getByRole("textbox", { name: "搜索 Alpha" })).toHaveValue(
|
||||
"",
|
||||
|
||||
Reference in New Issue
Block a user