jenesius-vue-form
Advanced tools
Comparing version 3.0.0-rc.5 to 3.0.0
@@ -56,2 +56,6 @@ import EventEmitter from "jenesius-event-emitter"; | ||
/** | ||
* @description Метод для принятия изменения и переноса их в pureValues | ||
* */ | ||
acceptChanges(name?: string): void; | ||
/** | ||
* @description Метод проецирует цепочку изменений на форму. | ||
@@ -58,0 +62,0 @@ * @param compareResult {CompareItem[]} массив изменений, которые необходимо спроецировать |
{ | ||
"name": "jenesius-vue-form", | ||
"version": "3.0.0-rc.5", | ||
"version": "3.0.0", | ||
"description": "Heavy form system for Vue.js", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -25,3 +25,3 @@ <p align="center"><a href="https://form.jenesius.com/" target="_blank" rel="noopener noreferrer"><img height="100" src="https://form.jenesius.com/images/logo.svg" alt="Vue logo"></a></p> | ||
![Alt Text](./gif-example.gif) | ||
![Alt Text](./readme-example.gif) | ||
@@ -33,6 +33,7 @@ ## Usage | ||
<template> | ||
<form-field name = "login"/> | ||
<form-field name = "password" type = "password"/> | ||
<button @click = "handleLogin">Login</button> | ||
<form-field name = "login"/> | ||
<form-field name = "password" type = "password"/> | ||
<button @click = "handleLogin">Login</button> | ||
</template> | ||
<script setup> | ||
@@ -43,3 +44,3 @@ import {FormField, Form} from "jenesius-vue-form"; | ||
function handleLogin() { | ||
console.log(form.values) // { login: "", password: "" } | ||
console.log(form.values) // { login: "", password: "" } | ||
} | ||
@@ -46,0 +47,0 @@ </script> |
@@ -132,4 +132,2 @@ import {mount} from "@vue/test-utils"; | ||
console.log(input.element.name, input.element.classList) | ||
expect(input.element.disabled).toBe(true) | ||
@@ -136,0 +134,0 @@ }) |
@@ -196,2 +196,27 @@ import Form from "../../../src/classes/Form"; | ||
}) | ||
test("Setting the same value should not execute event", () => { | ||
const form = new Form(); | ||
const mockOninput = jest.fn(x => x); | ||
form.oninput('age', mockOninput); | ||
form.setValues({age: 1}) | ||
form.setValues({age: 3}) | ||
form.setValues({age: 3}); | ||
form.setValues({age: 3}); | ||
expect(mockOninput.mock.results.length).toBe(2) | ||
expect(mockOninput.mock.results[0].value).toBe(1) | ||
expect(mockOninput.mock.results[1].value).toBe(3) | ||
}) | ||
test("Setting the same value after change should not execute event", () => { | ||
const form = new Form(); | ||
const mockOninput = jest.fn(x => x); | ||
form.oninput('age', mockOninput); | ||
form.change({age: 23}) | ||
form.setValues({age: 24}) | ||
expect(mockOninput.mock.results.length).toBe(2) | ||
expect(mockOninput.mock.results[0].value).toBe(23) | ||
expect(mockOninput.mock.results[1].value).toBe(24) | ||
}) | ||
}) |
@@ -506,3 +506,15 @@ import Form from "../../../src/classes/Form"; | ||
}) | ||
test("Setting equal object using setValues after change", () => { | ||
const form = new Form() | ||
form.change({ | ||
username: "Jack" | ||
}) | ||
form.setValues({ | ||
username: "Jack" | ||
}) | ||
expect(form.changes).toEqual({}) | ||
expect(form.values).toEqual({ username: "Jack" }) | ||
}) | ||
}) |
@@ -44,3 +44,2 @@ import Form from "../../../src/classes/Form"; | ||
validate() { | ||
console.log(this.index > 0) | ||
@@ -47,0 +46,0 @@ return this.index++ > 0 |
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 not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2408824
122
10518
0
55