diff --git a/cypress/integration/checkbox.test.ts b/cypress/integration/checkbox.test.ts
index 62042e8..ca291ac 100644
--- a/cypress/integration/checkbox.test.ts
+++ b/cypress/integration/checkbox.test.ts
@@ -100,7 +100,7 @@ describe('checkbox', () => {
- Text/Basic
+ Checkbox/Duplicate
+
+
+ `))
+
+ it('should have single form value', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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: '2003-04-06',
+ },
+ });
+ });
+ })
+
+ describe('disabled', () => {
+ beforeEach(utils.setup(`
+
+
+
+
+ Date/Disabled
+
+
+
+
+
+ `))
+
+ it('should have blank form value', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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(`
+
+
+
+
+ Date/Outside
+
+
+
+
+
+
+ `))
+
+ it('should have single form value', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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: '2003-04-20',
+ },
+ });
+ });
+ });
+
+ describe('readonly', () => {
+ beforeEach(utils.setup(`
+
+
+
+
+ Text/Readonly
+
+
+
+
+
+ `))
+
+ it('should have single form value', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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: '2003-11-11',
+ },
+ });
+ });
+ });
+
+ describe('programmatic value setting', () => {
+ beforeEach(utils.setup(`
+
+
+
+
+ Text/Basic
+
+
+
+
+
+ `));
+
+ it('should have form values set', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ preAction: (form: HTMLFormElement) => {
+ setFormValues(form, { hello: new Date('2000-01-01'), })
+ },
+ test: (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: '2000-01-01',
+ },
+ });
+ });
+ });
+
+ describe('duplicate', () => {
+ beforeEach(utils.setup(`
+
+
+
+
+ Date/Duplicate
+
+
+
+
+
+ `));
+
+ it('should get both values', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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: ['2007-07-07', '2008-08-08'],
+ },
+ });
+ });
+
+ it('should set both values', () => {
+ utils.test({
+ preAction: (form: HTMLFormElement) => {
+ setFormValues(form, {
+ hello: ['2006-06-06', '2005-05-05'],
+ })
+ },
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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: ['2006-06-06', '2005-05-05'],
+ },
+ });
+ });
+ });
+})
diff --git a/cypress/integration/datetime-local.test.ts b/cypress/integration/datetime-local.test.ts
new file mode 100644
index 0000000..141d6fa
--- /dev/null
+++ b/cypress/integration/datetime-local.test.ts
@@ -0,0 +1,265 @@
+import { getFormValues, setFormValues } from '../../src';
+import * as utils from '../utils'
+
+describe('date', () => {
+ describe('basic', () => {
+ beforeEach(utils.setup(`
+
+
+
+
+ Datetime-Local/Basic
+
+
+
+
+
+ `))
+
+ it('should have single form value', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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: '2003-04-06T13:37',
+ },
+ });
+ });
+ })
+
+ describe('disabled', () => {
+ beforeEach(utils.setup(`
+
+
+
+
+ Datetime-Local/Disabled
+
+
+
+
+
+ `))
+
+ it('should have blank form value', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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(`
+
+
+
+
+ Datetime-Local/Outside
+
+
+
+
+
+
+ `))
+
+ it('should have single form value', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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: '2003-04-20T13:37',
+ },
+ });
+ });
+ });
+
+ describe('readonly', () => {
+ beforeEach(utils.setup(`
+
+
+
+
+ Text/Readonly
+
+
+
+
+
+ `))
+
+ it('should have single form value', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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: '2003-11-11T13:37',
+ },
+ });
+ });
+ });
+
+ describe('programmatic value setting', () => {
+ beforeEach(utils.setup(`
+
+
+
+
+ Text/Basic
+
+
+
+
+
+ `));
+
+ it('should have form values set', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ preAction: (form: HTMLFormElement) => {
+ setFormValues(form, { hello: new Date('2000-01-01T13:37'), })
+ },
+ test: (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: '2000-01-01T13:37',
+ },
+ });
+ });
+ });
+
+ describe('duplicate', () => {
+ beforeEach(utils.setup(`
+
+
+
+
+ Datetime-Local/Duplicate
+
+
+
+
+
+ `));
+
+ it('should get both values', () => {
+ utils.test({
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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: ['2007-07-07T13:37', '2008-08-08T13:37'],
+ },
+ });
+ });
+
+ it('should set both values', () => {
+ utils.test({
+ preAction: (form: HTMLFormElement) => {
+ setFormValues(form, {
+ hello: ['2006-06-06T13:37', '2005-05-05T13:37'],
+ })
+ },
+ action: (cy: any) => cy.get('[type="submit"]'),
+ test: (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: ['2006-06-06T13:37', '2005-05-05T13:37'],
+ },
+ });
+ });
+ });
+})
diff --git a/cypress/integration/text.test.ts b/cypress/integration/text.test.ts
index df1a626..4403567 100644
--- a/cypress/integration/text.test.ts
+++ b/cypress/integration/text.test.ts
@@ -164,7 +164,7 @@ describe('text', () => {
- Text/Basic
+ Text/Programmatic Value Setting