feat(portfolio): add expanded layout for bond position cards
Add variant="bond" to PositionCard with bond-specific CSS classes (.bondCard, .bondMain, etc.) matching the stock expanded layout. PositionSection now passes variant based on section kind. Bond cards render 3-column grid (logo | identity | value) with meta row, identical to stock cards.
This commit is contained in:
@@ -165,9 +165,12 @@ describe("AccountPage states", () => {
|
||||
expect(screen.getByText("10 ₽")).toBeInTheDocument();
|
||||
expect(screen.getByText("-1 ₽")).toBeInTheDocument();
|
||||
expect(screen.queryByText(/Доход:/)).not.toBeInTheDocument();
|
||||
expect(screen.getByText("Средняя цена: 11 ₽")).toBeInTheDocument();
|
||||
expect(screen.getByText("Доля: 100 %")).toBeInTheDocument();
|
||||
expect(screen.getByText("RU000A0JX0J2")).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText("Средняя цена: 11 ₽ · Доля: 100 %"),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText("Количество: 1 · RU000A0JX0J2"),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.queryByText("—")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "Вторая" })).toHaveAttribute(
|
||||
"src",
|
||||
@@ -289,6 +292,34 @@ describe("AccountPage states", () => {
|
||||
expect(screen.queryByText(/Доход:/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders bond cards in expanded layout with bond-specific classes", () => {
|
||||
renderPage(
|
||||
<AccountPageLoaded
|
||||
{...loadedProps({
|
||||
...portfolio,
|
||||
positions: [
|
||||
{
|
||||
figi: "FIGI-BOND",
|
||||
displayName: "Облигация 2030",
|
||||
type: "BOND",
|
||||
quantity: "10",
|
||||
currentValue: { currency: "RUB", value: "1000" },
|
||||
averagePurchasePrice: { currency: "RUB", value: "950" },
|
||||
absoluteReturn: { currency: "RUB", value: "50" },
|
||||
isin: "RU000B0ND123",
|
||||
logoName: null,
|
||||
},
|
||||
],
|
||||
})}
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByText("О")).toBeInTheDocument();
|
||||
expect(screen.getByText("+50 ₽")).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText("Средняя цена: 950 ₽ · Доля: 100 %"),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders the bonds section as a single-column grid on any screen width", () => {
|
||||
renderPage(
|
||||
<AccountPageLoaded
|
||||
|
||||
Reference in New Issue
Block a user