PHP Classes

File: tests/unit/components/Badge.test.tsx

Recommend this page to a friend!
  Classes of Maniruzzaman Akash   Maniruzzaman WordPress Frontend Editor   tests/unit/components/Badge.test.tsx   Download  
File: tests/unit/components/Badge.test.tsx
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Maniruzzaman WordPress Frontend Editor
WordPress plugin for visual front-end development
Author: By
Last change:
Date: 8 months ago
Size: 1,112 bytes
 

Contents

Class file image Download
import { render } from '@testing-library/react'; import Badge from '../../../src/components/badge'; describe('Badge', () => { it('renders the correct background color for the active status', () => { const { container } = render(<Badge status="active" />); expect(container.firstChild).toHaveStyle(`background: #2ea043`); }); it('renders the correct background color for the retired status', () => { const { container } = render(<Badge status="retired" />); expect(container.firstChild).toHaveStyle(`background: red`); }); it('renders the correct background color for the unknown status', () => { const { container } = render(<Badge status="unknown" />); expect(container.firstChild).toHaveStyle(`background: #ccc`); }); it('renders the correct text color', () => { const { container } = render(<Badge status="active" />); expect(container.firstChild).toHaveStyle(`color: #fff`); }); it('renders the correct text transformation', () => { const { container } = render(<Badge status="active" />); expect(container.textContent).toBe('active'); }); });