|
| 1 | +import { fixture } from '@sl-design-system/vitest-browser-lit'; |
| 2 | +import { html } from 'lit'; |
| 3 | +import { beforeEach, describe, expect, it } from 'vitest'; |
| 4 | +import '../register.js'; |
| 5 | +import { Callout } from './callout.js'; |
| 6 | + |
| 7 | +describe('sl-callout', () => { |
| 8 | + let el: Callout; |
| 9 | + |
| 10 | + describe('defaults', () => { |
| 11 | + beforeEach(async () => { |
| 12 | + el = await fixture(html`<sl-callout>Callout component</sl-callout>`); |
| 13 | + }); |
| 14 | + |
| 15 | + it('should not have an explicit density', () => { |
| 16 | + expect(el).not.to.have.attribute('density'); |
| 17 | + expect(el.density).to.be.undefined; |
| 18 | + }); |
| 19 | + |
| 20 | + it('should not have an explicit variant', () => { |
| 21 | + expect(el).not.to.have.attribute('variant'); |
| 22 | + expect(el.variant).to.be.undefined; |
| 23 | + }); |
| 24 | + |
| 25 | + it('should have positive variant when set', async () => { |
| 26 | + el.variant = 'positive'; |
| 27 | + await el.updateComplete; |
| 28 | + |
| 29 | + expect(el).to.have.attribute('variant', 'positive'); |
| 30 | + }); |
| 31 | + }); |
| 32 | + |
| 33 | + describe('no title', () => { |
| 34 | + beforeEach(async () => { |
| 35 | + el = await fixture(html`<sl-callout>Callout component text</sl-callout>`); |
| 36 | + }); |
| 37 | + |
| 38 | + it('should not display a title', () => { |
| 39 | + const title = el.renderRoot.querySelector('[part="title"]')!; |
| 40 | + |
| 41 | + expect(title).to.exist; |
| 42 | + expect(title).to.have.style('display', 'none'); |
| 43 | + }); |
| 44 | + |
| 45 | + it('should have the no-title attribute set', () => { |
| 46 | + expect(el).to.have.attribute('no-title'); |
| 47 | + }); |
| 48 | + }); |
| 49 | +}); |
0 commit comments