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

jenesius-vue-form

Package Overview
Dependencies
Maintainers
0
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jenesius-vue-form - npm Package Compare versions

Comparing version 3.0.16 to 3.0.17

tests/units/form/form-autonomic-values.spec.ts

1

dist/types/classes/DependencyQueue.d.ts

@@ -13,2 +13,3 @@ import Form from "./Form";

remove(object: T): void;
find(expression: (elem: T, index: number) => boolean): T | undefined;
forEach(callback: (elem: T) => void): void;

@@ -15,0 +16,0 @@ get length(): number;

@@ -43,2 +43,7 @@ import EventEmitter from "jenesius-event-emitter";

name?: string;
/**
* @description Класс является автономным, если не указан родитель или если свойство #autonomic установлено в true
*/
get autonomic(): boolean;
set autonomic(value: boolean);
get changes(): any;

@@ -55,2 +60,7 @@ get values(): any;

set parent(parent: Form | undefined);
/**
* !!!!!!!!!!!
* CONSTRUCTOR
* !!!!!!!!!!!
*/
constructor(params?: Partial<FormParams>);

@@ -175,2 +185,7 @@ setValues(values: any, options?: Partial<FormSetValuesOptions>): void;

parent: Form | null | false;
/**
* @description The form will be self-contained. They want and will have the opportunity to receive higher education
* from their parents, however values, changes, enabling and disabling will be stored inside this form.
*/
autonomic: boolean;
}

@@ -177,0 +192,0 @@ interface FormDependence {

@@ -13,2 +13,3 @@ export default class FormError extends Error {

static DependencyNotFounded(): FormError;
static AutonomicFormWithoutParent(): FormError;
}

2

package.json
{
"name": "jenesius-vue-form",
"version": "3.0.16",
"version": "3.0.17",
"description": "Heavy form system for Vue.js",

@@ -5,0 +5,0 @@ "main": "dist/jenesius-vue-form.cjs.js",

import Form from "../../../src/classes/Form";
import {utils} from "../../../src/index";

@@ -111,2 +112,62 @@ describe("Form clean changes by field", () => {

})
/**AUTONOMIC FORMS**/
test("Очистка изменений не должна иметь эффект на дочерние автономные(autonomic) классы.", () => {
const parentForm = new Form();
const childrenForm = new Form({
parent: parentForm,
name: "test",
autonomic: true
})
childrenForm.change({
username: "Jack",
age: 25
})
parentForm.change({
age: 100
})
/**
* Очищаем поле username в родительской форме. Поле username в childrenForm не должно
* быть затронуто.
*/
parentForm.cleanField( utils.concatName(childrenForm.name, 'username'))
expect(childrenForm.changes).toEqual({
username: "Jack",
age: 25
})
expect(parentForm.changes).toEqual({
age: 100
})
/**
* Очищаем поле age в childrenForm. Поле age не должно быть затронуто в parentForm.
*/
childrenForm.cleanField( utils.concatName('age') )
expect(childrenForm.changes).toEqual({
username: "Jack",
})
expect(parentForm.changes).toEqual({
age: 100
})
/**
* Предустанавливаем поле age в childrenForm. После очистки поля в parentForm, оно не должно
* иметь эффект над children.
*/
childrenForm.change({
age: 18
})
parentForm.cleanField( utils.concatName('age') )
expect(childrenForm.changes).toEqual({
username: "Jack",
age: 18
})
expect(parentForm.changes).toEqual({})
})
})

@@ -232,3 +232,46 @@ import Form from "../../../src/classes/Form";

})
test("Autonomic form: children enable has not effect to parent", () => {
const parent = new Form();
const child = new Form({
name: "test",
parent,
autonomic: true
});
child.disable("test");
expect(parent.checkFieldDisable('test')).toBe(false);
expect(child.checkFieldDisable('test')).toBe(true);
expect(child.disabled).toBe(false);
})
test("Autonomic form: parent enable/disable has not effect to children", () => {
const parent = new Form();
const child = new Form({
name: "test",
parent,
autonomic: true
});
parent.disable("test");
expect(parent.checkFieldDisable('test')).toBe(true);
expect(child.checkFieldDisable('test')).toBe(false);
expect(child.disabled).toBe(false);
})
test("Autonomic form: parent full disable has no effect for child", () => {
const parent = new Form();
const child = new Form({
name: "test",
parent,
autonomic: true
});
parent.disable()
expect(parent.disabled).toBe(true);
expect(child.disabled).toBe(false);
})
})

@@ -69,2 +69,36 @@ import Form from "../../../src/classes/Form";

test("Autonomic Form: revert from children form has not effect for parent", () => {
const parent = new Form();
const child = new Form({
name: "test",
parent,
autonomic: true
})
parent.change({ name: "Jack"} );
child.change({age: 20});
child.revert();
expect(parent.changes).toEqual({name: "Jack"});
expect(child.changes).toEqual({})
})
test("Autonomic Form: revert from parent form has not effect for children", () => {
const parent = new Form();
const child = new Form({
name: "test",
parent,
autonomic: true
})
parent.change({ name: "Jack"} );
child.change({age: 20});
parent.revert();
expect(parent.changes).toEqual({});
expect(child.changes).toEqual({age: 20})
})
})

@@ -555,2 +555,46 @@ import Form from "../../../src/classes/Form";

test("Autonomic form: Set values only in children form", () => {
const parentForm = new Form();
const childrenForm = new Form({
parent: parentForm,
name: "test",
autonomic: true
})
childrenForm.change({
username: "Jack",
age: 25
})
expect(childrenForm.changes).toEqual({
username: "Jack",
age: 25
})
expect(parentForm.changes).toEqual({})
})
test("Autonomic form: Set values in parent form", () => {
const parentForm = new Form();
const childrenForm = new Form({
parent: parentForm,
name: "test",
autonomic: true
})
parentForm.change({
"test.username": "Jack",
test: {
name: "Jenesius"
}
})
expect(childrenForm.changes).toEqual({})
expect(parentForm.changes).toEqual({
test:{
name: "Jenesius",
username: "Jack"
}
})
})
})

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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