New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ampersand-input-view

Package Overview
Dependencies
Maintainers
4
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-input-view - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

3

ampersand-input-view.js

@@ -103,2 +103,3 @@ /*$AMPERSAND_VERSION*/

valid: {
cache: false,
deps: ['inputValue'],

@@ -138,3 +139,3 @@ fn: function () {

}
this.inputValue = this.input.value;
this.inputValue = this.clean(this.input.value);
if (!skipValidation && !this.getErrorMessage()) {

@@ -141,0 +142,0 @@ this.shouldValidate = true;

{
"name": "ampersand-input-view",
"description": "A view module for intelligently rendering and validating input. Works well with ampersand-form-view.",
"version": "4.0.0",
"version": "4.0.1",
"author": "Henrik Joreteg <henrik@andyet.net>",

@@ -6,0 +6,0 @@ "browserify": {

@@ -42,2 +42,16 @@ var test = require('tape');

test('initialize with number value and type perserved after render', function (t) {
var position = 1;
var input = new InputView({
name: 'position',
value: position,
type: 'number'
});
input.render();
t.equal(input.value, position);
t.end();
});
test('can initialize with template without having to extend', function (t) {

@@ -375,1 +389,36 @@ var input = new InputView({

});
test('input that is dependent on another', function (t) {
var inputOne = new InputView({
name: 'foo',
required: true
});
var inputTwo = new InputView({
name: 'bar',
required: false,
tests: [
function () {
if (inputOne.valid) {
return 'Not valid';
}
}
]
});
inputOne.render();
inputTwo.render();
var inputElement = inputTwo.el.querySelector('input');
var messageContainer = inputTwo.el.querySelector('[data-hook=message-container]');
t.notOk(inputOne.valid);
t.ok(inputTwo.valid);
inputOne.setValue('something');
// Since the only thing parent form evaluates on submit is the valid entry,
// we can simulated that by evaluating valid on both
t.ok(inputOne.valid);
t.notOk(inputTwo.valid);
t.ok(isHidden(messageContainer), 'Message should not be visible');
t.notOk(hasClass(inputElement, 'input-invalid'), 'Does not have invalid class');
t.notOk(hasClass(inputElement, 'input-valid'), 'Doest not have valid class');
t.end();
});
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