diff --git a/packages/cli/src/ui/components/Banner.tsx b/packages/cli/src/ui/components/Banner.tsx index 8003abc949..460bef540f 100644 --- a/packages/cli/src/ui/components/Banner.tsx +++ b/packages/cli/src/ui/components/Banner.tsx @@ -5,8 +5,7 @@ */ import { Box, Text } from 'ink'; -import Gradient from 'ink-gradient'; -import { theme } from '../semantic-colors.js'; +import { ThemedGradient } from './ThemedGradient.js'; interface BannerProps { bannerText: string; @@ -14,20 +13,17 @@ interface BannerProps { width: number; } -export const Banner = ({ bannerText, color, width }: BannerProps) => { - const gradient = theme.ui.gradient; - return ( - - - {bannerText} - - - ); -}; +export const Banner = ({ bannerText, color, width }: BannerProps) => ( + + + {bannerText} + + +); diff --git a/packages/cli/src/ui/components/GradientRegression.test.tsx b/packages/cli/src/ui/components/GradientRegression.test.tsx index 1b4bc8a4f7..af6d5c1df0 100644 --- a/packages/cli/src/ui/components/GradientRegression.test.tsx +++ b/packages/cli/src/ui/components/GradientRegression.test.tsx @@ -6,10 +6,13 @@ import { describe, it, expect, vi } from 'vitest'; import { renderWithProviders } from '../../test-utils/render.js'; -import { Footer } from './Footer.js'; -import { StatsDisplay } from './StatsDisplay.js'; import * as SessionContext from '../contexts/SessionContext.js'; import type { SessionStatsState } from '../contexts/SessionContext.js'; +import { Banner } from './Banner.js'; +import { Footer } from './Footer.js'; +import { Header } from './Header.js'; +import { ModelDialog } from './ModelDialog.js'; +import { StatsDisplay } from './StatsDisplay.js'; // Mock the theme module vi.mock('../semantic-colors.js', async (importOriginal) => { @@ -63,6 +66,36 @@ useSessionStatsMock.mockReturnValue({ }); describe('Gradient Crash Regression Tests', () => { + it('
should not crash when theme.ui.gradient is empty', () => { + const { lastFrame } = renderWithProviders( +
, + { + width: 120, + }, + ); + expect(lastFrame()).toBeDefined(); + }); + + it(' should not crash when theme.ui.gradient is empty', () => { + const { lastFrame } = renderWithProviders( + {}} />, + { + width: 120, + }, + ); + expect(lastFrame()).toBeDefined(); + }); + + it(' should not crash when theme.ui.gradient is empty', () => { + const { lastFrame } = renderWithProviders( + , + { + width: 120, + }, + ); + expect(lastFrame()).toBeDefined(); + }); + it('