Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions app/components/SuccessGuide.theme-contrast.test.tsx
Original file line number Diff line number Diff line change
@@ -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: () => <svg data-testid="close-icon" />,
}));

vi.mock('framer-motion', () => ({
motion: {
div: ({ children, className, ...props }: React.ComponentProps<'div'>) => (
<div className={className} {...props}>
{children}
</div>
),
},
}));

describe('SuccessGuide Theme Contrast', () => {
const props = {
markdown: '[CommitPulse](https://commitpulse.io)',
onDismiss: vi.fn(),
};

it('renders dark theme background styles correctly', () => {
render(<SuccessGuide {...props} />);

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(<SuccessGuide {...props} />);

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(<SuccessGuide {...props} />);

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(<SuccessGuide {...props} />);

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(<SuccessGuide {...props} />);

const overlay = document.querySelector('.blur-\\[80px\\]');

expect(overlay).toBeTruthy();

const snippet = screen.getByLabelText('Your badge markdown snippet');

expect(snippet).toBeVisible();
});
});
Original file line number Diff line number Diff line change
@@ -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'],
Expand All @@ -24,7 +25,9 @@ describe('TechnologiesSection Theme Contrast & Visual Cohesion', () => {
render(<TechnologiesSection {...defaultProps} />);

expect(screen.getByText('Technologies')).toBeInTheDocument();

expect(screen.getByPlaceholderText('Search technologies...')).toBeInTheDocument();

expect(screen.getByText(/Select your tech stack/i)).toBeInTheDocument();
});

Expand All @@ -34,7 +37,9 @@ describe('TechnologiesSection Theme Contrast & Visual Cohesion', () => {
render(<TechnologiesSection {...defaultProps} />);

expect(screen.getByText('Technologies')).toBeInTheDocument();

expect(screen.getByPlaceholderText('Search technologies...')).toBeInTheDocument();

expect(screen.getByText(/Select your tech stack/i)).toBeInTheDocument();
});

Expand All @@ -44,11 +49,6 @@ describe('TechnologiesSection Theme Contrast & Visual Cohesion', () => {
render(<TechnologiesSection {...defaultProps} />);

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)', () => {
Expand All @@ -57,10 +57,7 @@ describe('TechnologiesSection Theme Contrast & Visual Cohesion', () => {
render(<TechnologiesSection {...defaultProps} />);

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();
});

Expand All @@ -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();
});
});
Loading