import { getFormValues, setFormValues } from '../../src'; import * as utils from '../utils' describe('fieldset', () => { describe('basic', () => { beforeEach(utils.setup(` Text/Basic
Fieldset
`)) it('should have single form value', () => { utils.test({ querySubmitter: (cy: any) => cy.get('[type="submit"]'), onSubmitted: (form: HTMLFormElement, submitter: any, search: any) => { const before = utils.makeSearchParams(getFormValues(form, { submitter })) .toString(); const after = utils.makeSearchParams(search) .toString(); expect(before) .toEqual(after); }, expectedStaticValue: { hello: 'Hi', }, }); }); }); describe('disabled', () => { beforeEach(utils.setup(` Text/Disabled
Fieldset
`)) it('should have blank form value', () => { utils.test({ querySubmitter: (cy: any) => cy.get('[type="submit"]'), onSubmitted: (form: HTMLFormElement, submitter: any, search: any) => { const before = utils.makeSearchParams(getFormValues(form, { submitter })) .toString(); const after = utils.makeSearchParams(search) .toString(); expect(before) .toEqual(after); }, expectedStaticValue: {}, }); }); }) describe('outside', () => { beforeEach(utils.setup(` Text/Outside
Fieldset
`)) it('should have single form value', () => { utils.test({ querySubmitter: (cy: any) => cy.get('[type="submit"]'), onSubmitted: (form: HTMLFormElement, submitter: any, search: any) => { const before = utils.makeSearchParams(getFormValues(form, { submitter })) .toString(); const after = utils.makeSearchParams(search) .toString(); expect(before) .toEqual(after); }, expectedStaticValue: { hello: 'Hi', }, }); }); }); describe('outside disabled', () => { beforeEach(utils.setup(` Text/Outside
Fieldset
`)) it('should have blank form value', () => { utils.test({ querySubmitter: (cy: any) => cy.get('[type="submit"]'), onSubmitted: (form: HTMLFormElement, submitter: any, search: any) => { const before = utils.makeSearchParams(getFormValues(form, { submitter })) .toString(); const after = utils.makeSearchParams(search) .toString(); expect(before) .toEqual(after); }, expectedStaticValue: {}, }); }); }); });