import { jsOMS } from '../../Utils/oLib.js'; describe('FormViewTest', function () { 'use strict'; var testId = 'testForm'; it('Testing environment', function () { expect(true).toBeTrue(); }); if (typeof document === 'undefined') { return; } beforeEach(function () { document.body.innerHTML += `
`; }); afterEach(function () { let element = document.getElementById(testId); element.parentNode.removeChild(element); }); describe('testDefault', function () { it('Testing default functionality', function () { let form = new jsOMS.Views.FormView(testId); expect(form.getId()).toBe(testId); expect(form.getElementId()).toBe(testId); expect(form.getElement()).toBe(testId); expect(form.getMethod()).toBe('POST'); expect(form.getAction()).toBe('http://127.0.0.1/'); expect(form.getSubmit()).toBe(null); expect(form.getSuccess()).toBe(null); expect(form.getFormElements()).toBe(null); expect(form.getData()).toBe(null); expect(form.isValid()).toBeTruthy(); }); }); describe('testChanges', function () { it('Testing modifications', function () { let form = new FormView(testId); expect(form.getMethod()).toBe('POST'); form.getElement().method = 'GET'; expect(form.getMethod()).toBe('POST'); form.bind(); expect(form.getMethod()).toBe('GET'); }); }); });