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

@aofl/form-validate

Package Overview
Dependencies
Maintainers
2
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aofl/form-validate - npm Package Compare versions

Comparing version 1.4.1 to 2.0.0-alpha.5

4

package.json
{
"name": "@aofl/form-validate",
"version": "1.4.1",
"version": "2.0.0-alpha.5",
"description": "Form validation mixin for AoflElement",

@@ -32,3 +32,3 @@ "main": "index.js",

"license": "MIT",
"gitHead": "60297b316858cd061ea1c221a7e04406b910ef38"
"gitHead": "00d91514e0c953e8cd998150ed5705b87db20b39"
}

@@ -17,3 +17,3 @@ /* eslint no-invalid-this: "off" */

return function isEqualValidator(value) {
if (typeof this.target[propName] === 'undefined') return false;
if (typeof this.target[propName] === 'undefined') { return false; }
return this.target[propName] === value;

@@ -20,0 +20,0 @@ };

@@ -87,10 +87,10 @@ /**

promise
.then((valid) => {
if (this.cachedPromise === promise) { // latest update
this.valid = valid;
this.pending = false;
this.resolve();
this.target.requestUpdate();
}
});
.then((valid) => {
if (this.cachedPromise === promise) { // latest update
this.valid = valid;
this.pending = false;
this.resolve();
this.target.requestUpdate();
}
});
}

@@ -97,0 +97,0 @@

@@ -157,10 +157,10 @@ /**

Promise.all(promises)
.then(() => {
if (this.pending) {
return checkPendingPromises();
}
.then(() => {
if (this.pending) {
return checkPendingPromises();
}
this.resolve();
this.validateCompleteResolved = true;
});
this.resolve();
this.validateCompleteResolved = true;
});
};

@@ -167,0 +167,0 @@

@@ -27,3 +27,3 @@ /* eslint no-invalid-this: "off", require-jsdoc: "off" */

requestUpdate() {}
};
}
this.ValidationTest = ValidationTest;

@@ -36,3 +36,3 @@ });

it('should have a property \'form\`', function() {
it('should have a property \'form\'', function() {
expect(this.testForm).to.have.property('form');

@@ -48,51 +48,51 @@ });

it('should have a property \'form\` with valid',
function() {
expect(this.testForm.form).to.have.property('valid', true);
});
it('should have a property \'form\' with valid',
function() {
expect(this.testForm.form).to.have.property('valid', true);
});
it('should have a property \'form\` with pending',
function() {
expect(this.testForm.form).to.have.property('pending', false);
});
it('should have a property \'form\' with pending',
function() {
expect(this.testForm.form).to.have.property('pending', false);
});
it('should have a property \'form\` with observed',
function() {
expect(this.testForm.form).to.have.property('observed', false);
});
it('should have a property \'form\' with observed',
function() {
expect(this.testForm.form).to.have.property('observed', false);
});
it('should have a property \'form\` with firstname',
function() {
expect(this.testForm.form).to.have.property('firstname');
});
it('should have a property \'form\' with firstname',
function() {
expect(this.testForm.form).to.have.property('firstname');
});
it('should have a property \'form\` with firstname with isRequired',
function() {
expect(this.testForm.form.firstname).to.have.property('isRequired');
});
it('should have a property \'form\' with firstname with isRequired',
function() {
expect(this.testForm.form.firstname).to.have.property('isRequired');
});
it('should have a property \'form\` with firstname with isRequired width valid',
function() {
expect(this.testForm.form.firstname.isRequired).to.have.property('valid', true);
});
it('should have a property \'form\' with firstname with isRequired width valid',
function() {
expect(this.testForm.form.firstname.isRequired).to.have.property('valid', true);
});
it('should have a property \'form\` with firstname with isRequired width pending',
function() {
expect(this.testForm.form.firstname.isRequired).to.have.property('pending', false);
});
it('should have a property \'form\' with firstname with isRequired width pending',
function() {
expect(this.testForm.form.firstname.isRequired).to.have.property('pending', false);
});
it('should have a property \'form\` with firstname with isRequired width observed',
function() {
expect(this.testForm.form.firstname.isRequired).to.have.property('observed', false);
});
it('should have a property \'form\' with firstname with isRequired width observed',
function() {
expect(this.testForm.form.firstname.isRequired).to.have.property('observed', false);
});
it('should have a property \'form\` with lastname',
function() {
expect(this.testForm.form).to.have.property('lastname');
});
it('should have a property \'form\' with lastname',
function() {
expect(this.testForm.form).to.have.property('lastname');
});
it('should have a property \'form\` with password',
function() {
expect(this.testForm.form).to.have.property('password');
});
it('should have a property \'form\' with password',
function() {
expect(this.testForm.form).to.have.property('password');
});

@@ -191,33 +191,33 @@

it('should have property form.firstname.isrequired.observe = true',
async function() {
try {
this.testForm.form.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname.isRequired).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
async function() {
try {
this.testForm.form.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname.isRequired).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
it('should have property form.firstname.observe = true',
async function() {
try {
this.testForm.form.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
async function() {
try {
this.testForm.form.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
it('should have property form.observe = true',
async function() {
try {
this.testForm.form.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
async function() {
try {
this.testForm.form.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
});

@@ -303,33 +303,33 @@

it('should have property form.firstname.isrequired.observe = true',
async function() {
try {
this.testForm.form.firstname.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname.isRequired).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
async function() {
try {
this.testForm.form.firstname.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname.isRequired).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
it('should have property form.firstname.observe = true',
async function() {
try {
this.testForm.form.firstname.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
async function() {
try {
this.testForm.form.firstname.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
it('should have property form.observe = false',
async function() {
try {
this.testForm.form.firstname.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form).to.have.property('observed', false);
} catch (e) {
return Promise.reject(e);
}
});
async function() {
try {
this.testForm.form.firstname.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form).to.have.property('observed', false);
} catch (e) {
return Promise.reject(e);
}
});
});

@@ -392,34 +392,34 @@

it('should have property form.firstname.isrequired.observe = true',
async function() {
try {
this.testForm.form.firstname.isRequired.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname.isRequired).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
async function() {
try {
this.testForm.form.firstname.isRequired.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname.isRequired).to.have.property('observed', true);
} catch (e) {
return Promise.reject(e);
}
});
it('should have property form.firstname.observe = false',
async function() {
try {
this.testForm.form.firstname.isRequired.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname).to.have.property('observed', false);
} catch (e) {
return Promise.reject(e);
}
});
async function() {
try {
this.testForm.form.firstname.isRequired.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname).to.have.property('observed', false);
} catch (e) {
return Promise.reject(e);
}
});
it('should have property form.observe = false',
async function() {
try {
this.testForm.form.firstname.isRequired.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form).to.have.property('observed', false);
} catch (e) {
return Promise.reject(e);
}
});
async function() {
try {
this.testForm.form.firstname.isRequired.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form).to.have.property('observed', false);
} catch (e) {
return Promise.reject(e);
}
});
});
});

@@ -22,3 +22,3 @@ /* eslint no-invalid-this: "off", require-jsdoc: "off" */

requestUpdate() {}
};
}
this.ValidationTest = ValidationTest;

@@ -25,0 +25,0 @@ });

@@ -14,3 +14,3 @@ /* eslint no-invalid-this: "off", require-jsdoc: "off" */

isAvailable(value) {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
setTimeout(() => {

@@ -24,3 +24,3 @@ resolve(value === 'hello');

isAvailable(value) {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
setTimeout(() => {

@@ -36,3 +36,3 @@ resolve(value === 'world');

requestUpdate() {}
};
}
this.ValidationTest = ValidationTest;

@@ -63,76 +63,72 @@ });

it('should not change the validateComplete promise if there\'s a pending promise', async function() {
try {
this.testForm.firstname = 'A';
this.testForm.form.validate();
const validateCompleteCached = this.testForm.form.validateComplete;
this.testForm.form.validate();
expect(this.testForm.form.validateComplete).to.equal(validateCompleteCached);
} catch (e) {
return Promise.reject(e);
}
it('should not change the validateComplete promise if there\'s a pending promise', function() {
this.testForm.firstname = 'A';
this.testForm.form.validate();
const validateCompleteCached = this.testForm.form.validateComplete;
this.testForm.form.validate();
expect(this.testForm.form.validateComplete).to.equal(validateCompleteCached);
});
it('should only resolve once with the status of the latest input(true)',
async function() {
try {
this.testForm.firstname = 'A';
this.testForm.form.validate();
this.testForm.firstname = 'hello';
this.testForm.form.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname.valid).to.be.true;
} catch (e) {
return Promise.reject(e);
}
});
async function() {
try {
this.testForm.firstname = 'A';
this.testForm.form.validate();
this.testForm.firstname = 'hello';
this.testForm.form.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname.valid).to.be.true;
} catch (e) {
return Promise.reject(e);
}
});
it('should only resolve once with the status of the latest input(false)',
async function() {
try {
this.testForm.firstname = 'hello';
this.testForm.form.validate();
this.testForm.firstname = 'A';
this.testForm.form.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname.valid).to.be.false;
} catch (e) {
return Promise.reject(e);
}
});
async function() {
try {
this.testForm.firstname = 'hello';
this.testForm.form.validate();
this.testForm.firstname = 'A';
this.testForm.form.validate();
await this.testForm.form.validateComplete;
expect(this.testForm.form.firstname.valid).to.be.false;
} catch (e) {
return Promise.reject(e);
}
});
it('should only resolve once with the status of the latest input even when a different field changes',
async function() {
try {
await new Promise((resolve) => {
this.testForm.firstname = 'hello';
this.testForm.form.firstname.validate();
this.testForm.form.validateComplete
.then(() => {
expect(this.testForm.form.observed).to.be.true;
resolve();
async function() {
try {
await new Promise((resolve) => {
this.testForm.firstname = 'hello';
this.testForm.form.firstname.validate();
this.testForm.form.validateComplete
.then(() => {
expect(this.testForm.form.observed).to.be.true;
resolve();
});
this.testForm.lastname = 'world';
this.testForm.form.lastname.validate();
});
} catch (e) {
return Promise.reject(e);
}
});
it('should create a new promise if previous validateComplete was resolved',
async function() {
try {
this.testForm.firstname = 'hello';
this.testForm.form.validate();
const cachedValidateComplete = this.testForm.form.validateComplete;
await cachedValidateComplete;
this.testForm.lastname = 'world';
this.testForm.form.lastname.validate();
});
} catch (e) {
return Promise.reject(e);
}
});
it('should create a new promise if previous validateComplete was resolved',
async function() {
try {
this.testForm.firstname = 'hello';
this.testForm.form.validate();
const cachedValidateComplete = this.testForm.form.validateComplete;
await cachedValidateComplete;
this.testForm.lastname = 'world';
this.testForm.form.validate();
expect(this.testForm.form.validateComplete).to.not.equal(cachedValidateComplete);
} catch (e) {
return Promise.reject(e);
}
});
this.testForm.form.validate();
expect(this.testForm.form.validateComplete).to.not.equal(cachedValidateComplete);
} catch (e) {
return Promise.reject(e);
}
});
});
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