Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

factorial-form

Package Overview
Dependencies
Maintainers
5
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

factorial-form - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

54

__tests__/Form.spec.ts

@@ -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()
);
})
})
})
})

1

lib/index.js

@@ -119,2 +119,3 @@ 'use strict';

isDirty: mobx.computed,
hasValue: mobx.computed,
mapAndSet: mobx.action,

@@ -121,0 +122,0 @@ set: mobx.action,

2

package.json
{
"name": "factorial-form",
"version": "3.2.1",
"version": "3.3.0",
"description": "Factorial form library",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc