test(ui): strengthen usage indicator position check

This commit is contained in:
vismaytiwari 2026-06-27 23:26:53 +05:30
parent 7a79b3e301
commit 4891c178ae
2 changed files with 5 additions and 4 deletions

View file

@ -41,11 +41,12 @@ describe("UsageIndicator", () => {
});
it("should not use fixed positioning that can cover sidebar items", async () => {
render(<UsageIndicator accessToken="token" width={220} />);
const { container } = render(<UsageIndicator accessToken="token" width={220} />);
const usageLabel = await screen.findByText("Usage");
await screen.findByText("Usage");
expect(usageLabel.closest(".fixed")).toBeNull();
expect(container.firstElementChild).not.toHaveClass("fixed");
expect(container.firstElementChild).not.toHaveStyle({ position: "fixed" });
});
it("should not show Near limit when users usage is below 80% (1/100 -> 1%)", async () => {

View file

@ -688,7 +688,7 @@ export default function UsageIndicator({ accessToken, width = 220 }: UsageIndica
}
return (
<div className="px-4 py-2" style={{ boxSizing: "border-box", width: `${Math.min(width, 220)}px` }}>
<div className="px-4 py-2" style={{ width: `${Math.min(width, 220)}px` }}>
<CardStyleView />
</div>
);