kopia lustrzana https://github.com/shoelace-style/shoelace
add test for #869
rodzic
dfdd7c75c2
commit
23b2f9335b
|
@ -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`
|
||||
|
|
Ładowanie…
Reference in New Issue