feat(web): 用紧凑卡片替换选股表格并精简资金雷达列

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
yuxuanhui
2026-09-01 14:57:27 +08:00
parent 4b8a7bd484
commit c944b219d9
12 changed files with 281 additions and 293 deletions
@@ -143,31 +143,18 @@ describe("SelectionResultsPage", () => {
expect(screen.getByText("执行完成")).toBeInTheDocument()
expect(screen.queryByText("目标股票数")).not.toBeInTheDocument()
const table = screen.getByRole("table")
expect(table).toBeInTheDocument()
expect(
within(table).getByRole("columnheader", { name: "信号类型" }),
).toBeInTheDocument()
expect(
within(table).getByRole("columnheader", { name: "J 值" }),
).toBeInTheDocument()
expect(
within(table).getByRole("columnheader", { name: "图形评分" }),
).toBeInTheDocument()
expect(
within(table).queryByRole("columnheader", { name: "关键详情" }),
).not.toBeInTheDocument()
expect(within(table).getByText("原始 B1")).toBeInTheDocument()
expect(within(table).getByText("回踩白线 B")).toBeInTheDocument()
expect(within(table).getByText("12")).toBeInTheDocument()
expect(within(table).queryByText("13")).not.toBeInTheDocument()
expect(within(table).getByText("平安银行")).toBeInTheDocument()
expect(within(table).getByText("86.40 分")).toBeInTheDocument()
expect(within(table).getByText("华纳药厂")).toBeInTheDocument()
const mobileRecord = screen.getAllByRole("article")[0]
expect(within(mobileRecord).getByText("12")).toBeInTheDocument()
expect(within(mobileRecord).queryByText("13")).not.toBeInTheDocument()
expect(screen.queryByRole("table")).not.toBeInTheDocument()
const record = screen.getByRole("article")
expect(within(record).getByText("平安银行")).toBeInTheDocument()
expect(within(record).getByText("000001.SZ")).toBeInTheDocument()
expect(within(record).getByText("原始 B1")).toBeInTheDocument()
expect(within(record).getByText("回踩白线 B")).toBeInTheDocument()
expect(within(record).getByText("86.40 分")).toBeInTheDocument()
expect(within(record).getByText("12")).toBeInTheDocument()
expect(within(record).queryByText("13")).not.toBeInTheDocument()
expect(within(record).getByText("¥ 10.50")).toBeInTheDocument()
expect(within(record).getByText("华纳药厂")).toBeInTheDocument()
expect(screen.getByRole("button", { name: /平安银行/ })).toBeInTheDocument()
const detailPanel = screen.getByRole("complementary", {
name: "当前股票详情",
@@ -249,9 +236,9 @@ describe("SelectionResultsPage", () => {
render(<SelectionResultsPage />)
expect(screen.getAllByText(expected).length).toBeGreaterThan(0)
const table = screen.getByRole("table")
expect(within(table).getByText("原始 B1")).toBeInTheDocument()
expect(within(table).getByText("12")).toBeInTheDocument()
const record = screen.getByRole("article")
expect(within(record).getByText("原始 B1")).toBeInTheDocument()
expect(within(record).getByText("12")).toBeInTheDocument()
if (score?.status === "below_threshold") {
const detailPanel = screen.getByRole("complementary", {
name: "当前股票详情",
@@ -558,16 +545,27 @@ describe("SelectionResultsPage", () => {
fireEvent.change(screen.getByLabelText("搜索命中股票"), {
target: { value: "招商" },
})
const table = screen.getByRole("table")
expect(within(table).getByText("招商银行")).toBeInTheDocument()
fireEvent.click(within(table).getByText("招商银行"))
const extraRecord = screen
.getAllByRole("article")
.find((article) => within(article).queryByText("招商银行"))
expect(extraRecord).toBeTruthy()
if (!extraRecord) {
throw new Error("expected 招商银行 card to be visible")
}
const selectButton = within(extraRecord).getByRole("button", {
name: /招商银行/,
})
fireEvent.keyDown(selectButton, { key: "Enter" })
expect(
within(
screen.getByRole("complementary", { name: "当前股票详情" }),
).getByText("招商银行"),
).toBeInTheDocument()
const expandButton = screen.getAllByRole("button", { name: "查看详情" })[1]
fireEvent.keyDown(selectButton, { key: " " })
const expandButton = within(extraRecord).getByRole("button", {
name: "查看详情",
})
fireEvent.click(expandButton)
expect(expandButton).toHaveAttribute("aria-expanded", "true")
expect(screen.getAllByText("MACD").length).toBeGreaterThan(1)