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

compose-form-up

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compose-form-up - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

6

lib/validation.js

@@ -31,3 +31,3 @@ // Dependencies

Event.on( document, 'blur', '[required]', checkValidation )
Event.on( document, 'keydown', '[required]', Event.debounce( checkValidation, 200 ) )
Event.on( document, 'input', '[required]', Event.debounce( checkValidation, 200 ) )

@@ -40,3 +40,3 @@ }

// Scoped variables
var invalidInput = form.querySelector( 'input:invalid, textarea:invalid' )
var invalidInput = form.querySelector( 'input:invalid, textarea:invalid, select:invalid' )

@@ -80,3 +80,3 @@ // The form is valid, skip it

valid = isValid( input ),
neutral = !valid && event == 'keydown';
neutral = !valid && event == 'input';

@@ -83,0 +83,0 @@ // Don't trigger invalid style while typing

{
"name": "compose-form-up",
"version": "1.1.0",
"version": "1.1.1",
"description": "A lightweight HTML5 form validation utility",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -26,13 +26,13 @@ var assert = require('chai').assert

addInput: function( form, options ) {
addInput: function( form, options, tag ) {
options = options || {}
tag = tag || '<input type="text">'
defaults = {
required: true,
type: 'text'
}
var label = Utils.injectHTML( form, '<label></label>' )
var input = Utils.injectHTML( label, '<input>' )
var input = Utils.injectHTML( label, tag )

@@ -55,2 +55,13 @@ for ( var attr in defaults ) { input.setAttribute( attr, defaults[attr] ) }

selectOption: function( select, index ) {
select.selectedIndex = index
// Shabby test code justification: It's really hard to trigger events in tests, so this
// short circuits the system. It's not ideal but for now
// it'll do.
select.parentNode.classList.toggle( 'invalid', !select.checkValidity() )
select.parentNode.classList.toggle( 'valid', select.checkValidity() )
},
isValid: function( input ) {

@@ -57,0 +68,0 @@ assert.isTrue( input.checkValidity() == true && input.parentNode.classList.contains( 'valid' ) )

@@ -8,2 +8,3 @@

setValue = utils.setValue,
selectOption = utils.selectOption,
Event = require( 'compose-event' )

@@ -98,2 +99,15 @@

it( 'tests select elements', function() {
var select = utils.addInput( fieldsetOne, {}, '<select><option value="">Select something</option><option value="1">Something</option></select>')
utils.submit( form )
isInvalid( select )
selectOption( select, 1 )
isValid( select )
fieldsetOne.removeChild( fieldsetOne.lastChild )
})
})

@@ -100,0 +114,0 @@

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