22 lines
857 B
JavaScript
22 lines
857 B
JavaScript
// @vitest-environment jsdom
|
|
import { describe, it, expect } from 'vitest';
|
|
import { drossAvatar } from '../../public/components/dross_avatar.js';
|
|
|
|
describe('drossAvatar', () => {
|
|
it('renders the requested variant class', () => {
|
|
const eye = drossAvatar('soft-eye', 60);
|
|
expect(eye.classList.contains('dross-orb')).toBe(true);
|
|
expect(eye.querySelector('.av-eye')).toBeTruthy();
|
|
expect(drossAvatar('wisp', 30).querySelector('.b-core')).toBeTruthy();
|
|
expect(drossAvatar('motes', 30).querySelector('.d-core')).toBeTruthy();
|
|
});
|
|
it('falls back to soft-eye for unknown variants', () => {
|
|
expect(drossAvatar('bogus', 60).querySelector('.av-eye')).toBeTruthy();
|
|
});
|
|
it('sets the pixel size', () => {
|
|
const a = drossAvatar('wisp', 42);
|
|
expect(a.style.width).toBe('42px');
|
|
expect(a.style.height).toBe('42px');
|
|
});
|
|
});
|