test(input-stepper): fix tests

This commit is contained in:
Hardik Pithva 2020-10-26 17:28:22 +01:00
parent 6c510e7a1f
commit 51670bd881

View file

@ -24,7 +24,7 @@ describe('<lion-input-stepper>', () => {
it('should increment the value to 1 on + button click', async () => { it('should increment the value to 1 on + button click', async () => {
const el = await fixture(defaultInputStepper); const el = await fixture(defaultInputStepper);
expect(el.value).to.equal(''); expect(el.value).to.equal('');
const incrementButton = el.shadowRoot?.querySelector('[name=increment]'); const incrementButton = el.querySelector('[slot=suffix]');
incrementButton?.dispatchEvent(new Event('click')); incrementButton?.dispatchEvent(new Event('click'));
expect(el.value).to.equal('1'); expect(el.value).to.equal('1');
}); });
@ -32,8 +32,8 @@ describe('<lion-input-stepper>', () => {
it('should decrement the value to -1 on - button click', async () => { it('should decrement the value to -1 on - button click', async () => {
const el = await fixture(defaultInputStepper); const el = await fixture(defaultInputStepper);
expect(el.value).to.equal(''); expect(el.value).to.equal('');
const incrementButton = el.shadowRoot?.querySelector('[name=decrement]'); const decrementButton = el.querySelector('[slot=prefix]');
incrementButton?.dispatchEvent(new Event('click')); decrementButton?.dispatchEvent(new Event('click'));
expect(el.value).to.equal('-1'); expect(el.value).to.equal('-1');
}); });
@ -66,7 +66,7 @@ describe('<lion-input-stepper>', () => {
it('updates aria-valuenow when stepper is changed', async () => { it('updates aria-valuenow when stepper is changed', async () => {
const el = await fixture(inputStepperWithAttrs); const el = await fixture(inputStepperWithAttrs);
const incrementButton = el.shadowRoot?.querySelector('[name=increment]'); const incrementButton = el.querySelector('[slot=suffix]');
incrementButton?.dispatchEvent(new Event('click')); incrementButton?.dispatchEvent(new Event('click'));
expect(el).to.have.attribute('aria-valuenow', '1'); expect(el).to.have.attribute('aria-valuenow', '1');
}); });