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: 'success', body: 'x' }), /alert-icon">✓);
assert.match(alertHtml({ kind: 'error', body: 'x' }), /alert-icon">⚠️);
assert.doesNotMatch(alertHtml({ kind: 'neutral', body: 'x' }), /alert-icon/);
});
it('lets a caller override the icon, and suppress it with null', () => {
assert.match(alertHtml({ kind: 'info', icon: '✨', body: 'x' }), /alert-icon">✨);
assert.doesNotMatch(alertHtml({ kind: 'error', icon: null, body: 'x' }), /alert-icon/);
});
it('REFUSES a kind that does not exist', () => {
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: