Co-authored-by: Mikhail Bashkirov <mikhail.bashkirov@ing.com> Co-authored-by: Thijs Louisse <thijs.louisse@ing.com> Co-authored-by: Joren Broekema <joren.broekema@ing.com> Co-authored-by: Gerjan van Geest <gerjan.van.geest@ing.com> Co-authored-by: Erik Kroes <erik.kroes@ing.com> Co-authored-by: Lars den Bakker <lars.den.bakker@ing.com>
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
/* eslint-env mocha */
|
|
/* eslint-disable no-underscore-dangle */
|
|
import { expect, fixture, html } from '@open-wc/testing';
|
|
|
|
import '@lion/input/lion-input.js';
|
|
import '@lion/fieldset/lion-fieldset.js';
|
|
|
|
import '../lion-form.js';
|
|
|
|
describe('<lion-form>', () => {
|
|
it.skip('has a custom reset that gets triggered by native reset', async () => {
|
|
const withDefaults = await fixture(html`
|
|
<lion-form
|
|
><form>
|
|
<lion-input name="firstName" .modelValue="${'Foo'}"></lion-input>
|
|
<input type="reset" value="reset-button" /></form
|
|
></lion-form>
|
|
`);
|
|
const resetButton = withDefaults.querySelector('input[type=reset]');
|
|
|
|
withDefaults.formElements.firstName.modelValue = 'updatedFoo';
|
|
expect(withDefaults.modelValue).to.deep.equal({
|
|
firstName: 'updatedFoo',
|
|
});
|
|
|
|
withDefaults.reset();
|
|
expect(withDefaults.modelValue).to.deep.equal({
|
|
firstName: 'Foo',
|
|
});
|
|
|
|
// use button
|
|
withDefaults.formElements.firstName.modelValue = 'updatedFoo';
|
|
expect(withDefaults.modelValue).to.deep.equal({
|
|
firstName: 'updatedFoo',
|
|
});
|
|
|
|
resetButton.click();
|
|
expect(withDefaults.modelValue).to.deep.equal({
|
|
firstName: 'Foo',
|
|
});
|
|
});
|
|
});
|