// Generated, do not edit. sha256:c59345089e27fb5a471d676d1783b760f5131e156f381aef6e04e76979a27c21 import { describe, it } from 'node:test'; import assert from 'node:assert/strict'; const { alertHtml } = await import('../../client/ui/alert.js'); describe('alertHtml: the four kinds', () => { it('renders kind, icon, title and body in the shape the stylesheet expects', () => { const html = alertHtml({ kind: 'error', title: 'Mislukt', body: 'Bestand onleesbaar.' }); assert.match(html, /^
⚠️<\/span>/); assert.match(html, /
Mislukt<\/div>/); assert.match(html, /
Bestand onleesbaar\.<\/div><\/div><\/div>$/); }); it('gives each kind its own icon, and neutral none', () => { assert.match(alertHtml({ kind: 'info', body: 'x' }), /alert-icon">ℹ️✓⚠️ { assert.match(alertHtml({ kind: 'info', icon: '✨', body: 'x' }), /alert-icon">✨ { assert.throws(() => alertHtml({ kind: 'warning', body: 'x' }), /Unknown alert kind/); }); }); describe('alertHtml: what is left out leaves nothing behind', () => { it('writes no title element without a title', () => { assert.doesNotMatch(alertHtml({ kind: 'error', body: 'x' }), /alert-title/); }); it('writes no body element without a body', () => { assert.doesNotMatch(alertHtml({ kind: 'error', title: 'x' }), /alert-body/); }); it('still renders the content wrapper, because the flex layout needs it', () => { assert.match(alertHtml({ kind: 'neutral', body: 'x' }), /
/); }); it('adds an extra class only when asked', () => { assert.match(alertHtml({ kind: 'info', className: 'mt-lg', body: 'x' }), /"alert alert-info mt-lg"/); assert.match(alertHtml({ kind: 'info', body: 'x' }), /"alert alert-info"/); }); }); describe('alertHtml: title and body are text, extra is markup', () => { it('escapes the title and the body', () => { const html = alertHtml({ kind: 'error', title: 't', body: '' }); assert.doesNotMatch(html, /| { assert.doesNotMatch(alertHtml({ kind: 'error', body: 'no such column: