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

@lion/validate

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lion/validate - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [0.4.2](https://github.com/ing-bank/lion/compare/@lion/validate@0.4.1...@lion/validate@0.4.2) (2019-11-27)
### Bug Fixes
* make success message disappear ([4b9ca1e](https://github.com/ing-bank/lion/commit/4b9ca1e3566f7402f76d60f0863d4c0e859e6ac9))
## [0.4.1](https://github.com/ing-bank/lion/compare/@lion/validate@0.4.0...@lion/validate@0.4.1) (2019-11-27)

@@ -8,0 +19,0 @@

4

package.json
{
"name": "@lion/validate",
"version": "0.4.1",
"version": "0.4.2",
"description": "Validate your form elements",

@@ -45,3 +45,3 @@ "author": "ing-bank",

},
"gitHead": "3abb65da3333e23316072fe151028e6d8dc6b997"
"gitHead": "fd475157006049663dae012555830630ddddad9c"
}

@@ -29,3 +29,11 @@ import { html, LitElement } from '@lion/core';

this.setAttribute('type', this.feedbackData[0].type);
} else {
this.currentType = this.feedbackData[0].type;
window.clearTimeout(this.removeMessage);
if (this.currentType === 'success') {
this.removeMessage = window.setTimeout(() => {
this.removeAttribute('type');
this.feedbackData = '';
}, 3000);
}
} else if (this.currentType !== 'success') {
this.removeAttribute('type');

@@ -32,0 +40,0 @@ }

/* eslint-disable no-unused-vars, no-param-reassign */
import sinon from 'sinon';
import { fixture, html, expect } from '@open-wc/testing';
import '../lion-validation-feedback.js';
import { AlwaysInvalid } from '../test-helpers.js';
import { AlwaysInvalid, AlwaysValid } from '../test-helpers.js';

@@ -33,2 +34,47 @@ describe('lion-validation-feedback', () => {

});
it('success message clears after 3s', async () => {
const el = await fixture(
html`
<lion-validation-feedback></lion-validation-feedback>
`,
);
const clock = sinon.useFakeTimers();
el.feedbackData = [{ message: 'hello', type: 'success', validator: new AlwaysValid() }];
await el.updateComplete;
expect(el.getAttribute('type')).to.equal('success');
clock.tick(2900);
expect(el.getAttribute('type')).to.equal('success');
clock.tick(200);
expect(el).to.not.have.attribute('type');
clock.restore();
});
it('does not clear error messages', async () => {
const el = await fixture(
html`
<lion-validation-feedback></lion-validation-feedback>
`,
);
const clock = sinon.useFakeTimers();
el.feedbackData = [{ message: 'hello', type: 'success', validator: new AlwaysValid() }];
await el.updateComplete;
expect(el.getAttribute('type')).to.equal('success');
el.feedbackData = [{ message: 'hello', type: 'error', validator: new AlwaysInvalid() }];
await el.updateComplete;
clock.tick(3100);
expect(el.getAttribute('type')).to.equal('error');
clock.restore();
});
});
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