Files
expo-popcore-app/components/PaginationLoader.test.tsx
imeepos 3bc6789660 feat: add reusable PaginationLoader component with TDD
Add minimal PaginationLoader component for infinite scroll/pagination scenarios. Displays small ActivityIndicator with optional text, supports theme colors, and is designed for use in FlatList ListFooterComponent.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 11:33:49 +08:00

42 lines
1.3 KiB
TypeScript

import React from 'react'
import { render } from '@testing-library/react-native'
import PaginationLoader from './PaginationLoader'
describe('PaginationLoader Component', () => {
describe('Basic Rendering', () => {
it('should render ActivityIndicator', () => {
const { UNSAFE_root } = render(<PaginationLoader />)
expect(UNSAFE_root).toBeTruthy()
})
it('should render with optional text', () => {
const { getByText } = render(<PaginationLoader text="加载更多..." />)
expect(getByText('加载更多...')).toBeTruthy()
})
it('should render without text when not provided', () => {
const { queryByText } = render(<PaginationLoader />)
expect(queryByText(/./)).toBeNull()
})
})
describe('Theme Support', () => {
it('should use default color', () => {
const { UNSAFE_root } = render(<PaginationLoader />)
expect(UNSAFE_root).toBeTruthy()
})
it('should accept custom color', () => {
const { UNSAFE_root } = render(<PaginationLoader color="#FF0000" />)
expect(UNSAFE_root).toBeTruthy()
})
})
describe('Props', () => {
it('should accept testID prop', () => {
const { getByTestId } = render(<PaginationLoader testID="pagination-loader" />)
expect(getByTestId('pagination-loader')).toBeTruthy()
})
})
})