The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(chat): correct token count display in ComposerTokenStats
Steven Enamakel5eb164a494e6
diff --git a/app/src/components/chat/ComposerTokenStats.test.tsx b/app/src/components/chat/ComposerTokenStats.test.tsxindex d71a368c96..e21c9c71fc 100644--- a/app/src/components/chat/ComposerTokenStats.test.tsx+++ b/app/src/components/chat/ComposerTokenStats.test.tsx@@ -86,7 +86,7 @@ describe('<ComposerTokenStats />', () => {expect(ctx.className).toMatch(/bg-primary/);});- it('closes on Escape and on an outside click', () => {+ it('closes on Escape and on an outside click', async () => {renderWithUsage(oneTurn);fireEvent.click(screen.getByRole('button'));expect(screen.getByTestId('composer-token-breakdown')).toBeInTheDocument();@@ -96,7 +96,10 @@ describe('<ComposerTokenStats />', () => {fireEvent.click(screen.getByRole('button'));expect(screen.getByTestId('composer-token-breakdown')).toBeInTheDocument();// Radix's dismissable layer listens for `pointerdown`, not `mousedown` (the- // hand-rolled listener this used to have).+ // hand-rolled listener this used to have), and defers attaching that+ // listener by one macrotask (`setTimeout(…, 0)`) so the same pointerdown+ // that opened the popover can't immediately close it again.+ await new Promise(resolve => setTimeout(resolve, 0));fireEvent.pointerDown(document.body);expect(screen.queryByTestId('composer-token-breakdown')).not.toBeInTheDocument();});