import type { EvaluatedBlock } from '@ministryofjustice/hmpps-forge/core/components' import { GovUKList } from './govukList' const render = (props: Record) => GovUKList.render(props as EvaluatedBlock) describe('GovUKList', () => { describe('block building', () => { it('should stamp the govukList variant when called as a builder', () => { // Arrange & Act const built = GovUKList({ items: ['one', 'two'] }) // Assert expect(built.variant).toBe('govukList') }) }) describe('rendering', () => { it('should render a plain ul by default', () => { // Arrange & Act const output = render({ items: ['First', 'Second'] }) // Assert expect(output).toBe('') }) it('should render a bullet list', () => { // Arrange & Act const output = render({ items: ['First'], style: 'bullet' }) // Assert expect(output).toBe('') }) it('should render a numbered list with an ol tag', () => { // Arrange & Act const output = render({ items: ['First'], style: 'number' }) // Assert expect(output).toBe('
  1. First
') }) it('should apply the spaced modifier', () => { // Arrange & Act const output = render({ items: ['First'], style: 'bullet', spaced: true }) // Assert expect(output).toBe('') }) it('should append additional classes and attributes', () => { // Arrange & Act const output = render({ items: [], classes: 'app-list', attributes: { 'data-qa': 'suggestions' } }) // Assert expect(output).toBe('') }) it('should embed rendered child blocks verbatim as items', () => { // Arrange const items = [ 'A plain string', { block: { variant: 'govukBody' }, html: '

A block item

' }, { block: { variant: 'html' }, html: 'A link item' }, ] // Act const output = render({ items }) // Assert expect(output).toBe( '', ) }) it('should render HTML in string items unescaped', () => { // Arrange & Act const output = render({ items: ['Get help'] }) // Assert expect(output).toBe('') }) }) })