diff --git a/app/components/SuccessGuide.theme-contrast.test.tsx b/app/components/SuccessGuide.theme-contrast.test.tsx new file mode 100644 index 000000000..d1c93983e --- /dev/null +++ b/app/components/SuccessGuide.theme-contrast.test.tsx @@ -0,0 +1,87 @@ +import React from 'react'; +import { describe, it, expect, vi } from 'vitest'; +import { render, screen } from '@testing-library/react'; + +import { SuccessGuide } from './SuccessGuide'; + +vi.mock('@/context/TranslationContext', () => ({ + useTranslation: () => ({ + t: (key: string) => key, + }), +})); + +vi.mock('./Icons', () => ({ + CloseIcon: () => , +})); + +vi.mock('framer-motion', () => ({ + motion: { + div: ({ children, className, ...props }: React.ComponentProps<'div'>) => ( +
+ {children} +
+ ), + }, +})); + +describe('SuccessGuide Theme Contrast', () => { + const props = { + markdown: '[CommitPulse](https://commitpulse.io)', + onDismiss: vi.fn(), + }; + + it('renders dark theme background styles correctly', () => { + render(); + + const region = screen.getByRole('region'); + + expect(region.className).toContain('bg-[#050505]/80'); + expect(region.className).toContain('border-emerald-500/20'); + expect(region.className).toContain('backdrop-blur-2xl'); + }); + + it('renders readable high-contrast heading text', () => { + render(); + + const heading = screen.getByRole('heading'); + + expect(heading.className).toContain('text-white'); + expect(heading.className).toContain('font-extrabold'); + }); + + it('renders emerald accent colors for visual cohesion', () => { + render(); + + const codeSnippet = screen.getByLabelText('Your badge markdown snippet'); + + expect(codeSnippet.className).toContain('text-emerald-300'); + + const copiedLabel = screen.getByText('success_guide.markdown_copied'); + + expect(copiedLabel.className).toContain('text-emerald-400'); + }); + + it('renders interactive dismiss button with visible hover contrast styles', () => { + render(); + + const dismissButton = screen.getByRole('button', { + name: /dismiss guide/i, + }); + + expect(dismissButton.className).toContain('hover:text-white'); + + expect(dismissButton.className).toContain('hover:bg-white/5'); + }); + + it('renders overlay glow without hiding foreground content', () => { + render(); + + const overlay = document.querySelector('.blur-\\[80px\\]'); + + expect(overlay).toBeTruthy(); + + const snippet = screen.getByLabelText('Your badge markdown snippet'); + + expect(snippet).toBeVisible(); + }); +}); diff --git a/app/generator/components/sections/TechnologiesSection.theme-contrast.test.tsx b/app/generator/components/sections/TechnologiesSection.theme-contrast.test.tsx index af6a48388..34ec25a3e 100644 --- a/app/generator/components/sections/TechnologiesSection.theme-contrast.test.tsx +++ b/app/generator/components/sections/TechnologiesSection.theme-contrast.test.tsx @@ -1,8 +1,9 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { render, screen, fireEvent } from '@testing-library/react'; -import { TechnologiesSection } from './TechnologiesSection'; import React from 'react'; +import { TechnologiesSection } from './TechnologiesSection'; + describe('TechnologiesSection Theme Contrast & Visual Cohesion', () => { const defaultProps = { selected: ['react'], @@ -24,7 +25,9 @@ describe('TechnologiesSection Theme Contrast & Visual Cohesion', () => { render(); expect(screen.getByText('Technologies')).toBeInTheDocument(); + expect(screen.getByPlaceholderText('Search technologies...')).toBeInTheDocument(); + expect(screen.getByText(/Select your tech stack/i)).toBeInTheDocument(); }); @@ -34,7 +37,9 @@ describe('TechnologiesSection Theme Contrast & Visual Cohesion', () => { render(); expect(screen.getByText('Technologies')).toBeInTheDocument(); + expect(screen.getByPlaceholderText('Search technologies...')).toBeInTheDocument(); + expect(screen.getByText(/Select your tech stack/i)).toBeInTheDocument(); }); @@ -44,11 +49,6 @@ describe('TechnologiesSection Theme Contrast & Visual Cohesion', () => { render(); expect(screen.getByText('Technologies')).toBeVisible(); - const techCountEl = screen.getAllByText((content) => - content.toLowerCase().includes('technologies') - )[0]; - expect(techCountEl).toBeVisible(); - expect(screen.getByText(/Selected \(1\)/i)).toBeVisible(); }); it('ensures text remains visible in dark mode (contrast proxy check)', () => { @@ -57,10 +57,7 @@ describe('TechnologiesSection Theme Contrast & Visual Cohesion', () => { render(); expect(screen.getByText('Technologies')).toBeVisible(); - const techCountEl = screen.getAllByText((content) => - content.toLowerCase().includes('technologies') - )[0]; - expect(techCountEl).toBeVisible(); + expect(screen.getByText(/Selected \(1\)/i)).toBeVisible(); }); @@ -76,9 +73,7 @@ describe('TechnologiesSection Theme Contrast & Visual Cohesion', () => { }); expect(searchInput).toBeInTheDocument(); - const techCountEls = screen.getAllByText((content) => - content.toLowerCase().includes('technologies') - ); - expect(techCountEls.length).toBeGreaterThan(0); + + expect(screen.getByText(/Selected \(1\)/i)).toBeVisible(); }); });