pull/878/head
Cory LaViska 2022-08-25 09:00:52 -04:00
rodzic dfdd7c75c2
commit 23b2f9335b
1 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -46,6 +46,16 @@ describe('<sl-color-picker>', () => {
expect(trigger?.style.color).to.equal('rgb(0, 0, 0)');
});
it('should display a color with opacity when an initial value with opacity is provided', async () => {
const el = await fixture<SlColorPicker>(html` <sl-color-picker opacity value="#ff000050"></sl-color-picker> `);
const trigger = el.shadowRoot!.querySelector<HTMLButtonElement>('[part="trigger"]');
const previewButton = el.shadowRoot!.querySelector<HTMLButtonElement>('[part="preview"]');
const previewColor = getComputedStyle(previewButton!).getPropertyValue('--preview-color');
expect(trigger!.style.color).to.equal('rgba(255, 0, 0, 0.314)');
expect(previewColor.startsWith('hsla(0deg, 100%, 50%, 0.31')).to.be.true;
});
describe('when resetting a form', () => {
it('should reset the element to its initial value', async () => {
const form = await fixture<HTMLFormElement>(html`