factorial-form
Advanced tools
Comparing version 3.2.1 to 3.3.0
@@ -272,2 +272,56 @@ import { Form } from '../src' | ||
}) | ||
describe('hasErrors', () => { | ||
describe('when there are no errors', () => { | ||
it('returns false', () => { | ||
expect(form.hasErrors).toBe(false) | ||
}) | ||
}) | ||
describe('when there are errors', () => { | ||
beforeEach(() => | ||
form.setErrors({ | ||
age: 'Must be a positive integer' | ||
}) | ||
) | ||
it('returns true', () => { | ||
expect(form.hasErrors).toBe(true) | ||
}) | ||
}) | ||
}) | ||
describe('dirtyFieldsKeys', () => { | ||
describe('when there are dirty fields', () => { | ||
it('returns empty array', () => { | ||
expect(form.dirtyFieldsKeys.length).toBe(0) | ||
}) | ||
}) | ||
describe('when form has dirty fields', () => { | ||
beforeEach(() => form.setValues({ name: 'manolo', age: 40 })) | ||
it('returns an array with the keys of the fields that are dirty', () => { | ||
expect(form.dirtyFieldsKeys.sort()) | ||
.toEqual(["name", "age"].sort()); | ||
}) | ||
}) | ||
}) | ||
describe('fieldsWithValueKeys', () => { | ||
describe('when there are no fields with values', () => { | ||
beforeEach(() => form = new Form({}, types)) | ||
it('returns empty array', () => { | ||
expect(form.fieldsWithValueKeys.length).toBe(0) | ||
}) | ||
}) | ||
describe('when some of the fields have values', () => { | ||
beforeEach(() => form.setValues({name: null})) | ||
it('returns an array with the keys of the fields that have value', () => { | ||
expect(form.fieldsWithValueKeys.sort()) | ||
.toEqual( | ||
["id", "active", "age", "price", "country_metadata.social_security"].sort() | ||
); | ||
}) | ||
}) | ||
}) | ||
}) |
@@ -119,2 +119,3 @@ 'use strict'; | ||
isDirty: mobx.computed, | ||
hasValue: mobx.computed, | ||
mapAndSet: mobx.action, | ||
@@ -121,0 +122,0 @@ set: mobx.action, |
{ | ||
"name": "factorial-form", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"description": "Factorial form library", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
42276
1088
0