import { html, fixture, expect } from '@open-wc/testing';
import type { MonoTextComp } from '../src/MonoTextComp';
import '../src/MonoTextComp';
describe('MonoTextComp', () => {
it('handle as, size, family, weight, tracking, tone, inline props and accept a default slot', async () => {
const el = await fixture(
html`Hey there`,
);
expect(el.textContent).to.equal('Hey there');
expect(el.as).to.equal('h3');
expect(el.size).to.equal('xl');
expect(el.family).to.equal('mono');
expect(el.weight).to.equal('bold');
expect(el.tracking).to.equal('wider');
expect(el.tone).to.equal('neutral-2');
expect(el.inline).to.equal(true);
expect(el.truncate).to.equal(true);
expect(el.alignText).to.equal('right');
});
it('inline and truncate should be by default false', async () => {
const el = await fixture(
html`Hey there`,
);
expect(el.inline).to.equal(false);
expect(el.truncate).to.equal(false);
});
it('alignText should be by default not set', async () => {
const el = await fixture(
html`Hey there`,
);
expect(el.alignText).to.equal(undefined);
});
it('as will throw if not allowed tag name', async () => {
let caught = false;
try {
await fixture(
html`Hey there`,
);
} catch (_e) {
caught = true;
}
expect(caught).to.equal(true);
});
it('should spreads other attributes', async () => {
const el = await fixture(
html``,
);
expect(el.shadowRoot?.firstElementChild?.getAttribute('fake')).to.equal(
'test',
);
});
it('passes the a11y audit', async () => {
const el = await fixture(html`Hola`);
await expect(el).shadowDom.to.be.accessible();
});
});