chore: remove GitHub Actions workflows, use Woodpecker CI exclusively
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
import { describe, it, expect } from '@jest/globals';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom';
|
||||
import {
|
||||
Skeleton,
|
||||
CardSkeleton,
|
||||
ServiceCardSkeleton,
|
||||
CaseCardSkeleton,
|
||||
ProductCardSkeleton,
|
||||
NewsCardSkeleton,
|
||||
SectionSkeleton,
|
||||
} from './loading-skeleton';
|
||||
|
||||
describe('Loading Skeleton Components', () => {
|
||||
describe('Skeleton', () => {
|
||||
it('should render skeleton element', () => {
|
||||
const { container } = render(<Skeleton />);
|
||||
expect(container.firstChild).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should apply default styles', () => {
|
||||
const { container } = render(<Skeleton />);
|
||||
const skeleton = container.firstChild as HTMLElement;
|
||||
expect(skeleton).toHaveClass('animate-pulse');
|
||||
expect(skeleton).toHaveClass('bg-[#F5F5F5]');
|
||||
});
|
||||
|
||||
it('should apply custom className', () => {
|
||||
const { container } = render(<Skeleton className="custom-class" />);
|
||||
const skeleton = container.firstChild as HTMLElement;
|
||||
expect(skeleton).toHaveClass('custom-class');
|
||||
});
|
||||
});
|
||||
|
||||
describe('CardSkeleton', () => {
|
||||
it('should render card skeleton', () => {
|
||||
const { container } = render(<CardSkeleton />);
|
||||
expect(container.firstChild).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should have correct structure', () => {
|
||||
const { container } = render(<CardSkeleton />);
|
||||
const skeletonElements = container.querySelectorAll('.animate-pulse');
|
||||
expect(skeletonElements.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ServiceCardSkeleton', () => {
|
||||
it('should render service card skeleton', () => {
|
||||
const { container } = render(<ServiceCardSkeleton />);
|
||||
expect(container.firstChild).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should have full height', () => {
|
||||
const { container } = render(<ServiceCardSkeleton />);
|
||||
const card = container.firstChild as HTMLElement;
|
||||
expect(card).toHaveClass('h-full');
|
||||
});
|
||||
});
|
||||
|
||||
describe('CaseCardSkeleton', () => {
|
||||
it('should render case card skeleton', () => {
|
||||
const { container } = render(<CaseCardSkeleton />);
|
||||
expect(container.firstChild).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should have image placeholder', () => {
|
||||
const { container } = render(<CaseCardSkeleton />);
|
||||
const imageSkeleton = container.querySelector('.h-48');
|
||||
expect(imageSkeleton).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('ProductCardSkeleton', () => {
|
||||
it('should render product card skeleton', () => {
|
||||
const { container } = render(<ProductCardSkeleton />);
|
||||
expect(container.firstChild).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should have flex column layout', () => {
|
||||
const { container } = render(<ProductCardSkeleton />);
|
||||
const card = container.firstChild as HTMLElement;
|
||||
expect(card).toHaveClass('flex');
|
||||
expect(card).toHaveClass('flex-col');
|
||||
});
|
||||
});
|
||||
|
||||
describe('NewsCardSkeleton', () => {
|
||||
it('should render news card skeleton', () => {
|
||||
const { container } = render(<NewsCardSkeleton />);
|
||||
expect(container.firstChild).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should have image placeholder', () => {
|
||||
const { container } = render(<NewsCardSkeleton />);
|
||||
const imageSkeleton = container.querySelector('.h-48');
|
||||
expect(imageSkeleton).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('SectionSkeleton', () => {
|
||||
it('should render section skeleton', () => {
|
||||
const { container } = render(<SectionSkeleton />);
|
||||
expect(container.firstChild).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render multiple service card skeletons', () => {
|
||||
const { container } = render(<SectionSkeleton />);
|
||||
const cards = container.querySelectorAll('.bg-white');
|
||||
expect(cards.length).toBe(4);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Accessibility', () => {
|
||||
it('should not have any accessible content', () => {
|
||||
const { container } = render(<CardSkeleton />);
|
||||
const textContent = container.textContent;
|
||||
expect(textContent).toBe('');
|
||||
});
|
||||
|
||||
it('should be purely decorative', () => {
|
||||
const { container } = render(<SectionSkeleton />);
|
||||
const elements = container.querySelectorAll('*');
|
||||
elements.forEach(element => {
|
||||
expect(element).not.toHaveAttribute('aria-label');
|
||||
expect(element).not.toHaveAttribute('aria-labelledby');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Animation', () => {
|
||||
it('should have pulse animation', () => {
|
||||
const { container } = render(<Skeleton />);
|
||||
const skeleton = container.firstChild as HTMLElement;
|
||||
expect(skeleton).toHaveClass('animate-pulse');
|
||||
});
|
||||
|
||||
it('should apply animation to all skeleton elements', () => {
|
||||
const { container } = render(<CardSkeleton />);
|
||||
const skeletons = container.querySelectorAll('.animate-pulse');
|
||||
expect(skeletons.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user