compose-form-up
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -86,2 +86,15 @@ var toolbox = require( 'compose-toolbox' ), | ||
function checkRadioLabel ( input ) { | ||
var input = ( input.target || input ) | ||
var inputName = input.name | ||
var radioGroup = document.querySelectorAll('input[name=' + inputName + ']') | ||
radioGroup.forEach(function(radioInput) { | ||
var label = toolbox.getClosest( radioInput, 'label' ) | ||
return (radioInput.checked === true ? label.classList.add('checked-radio') : label.classList.remove('checked-radio')); | ||
}) | ||
} | ||
function watch () { | ||
@@ -93,2 +106,3 @@ if ( watching ) { return } | ||
toolbox.each( document.querySelectorAll('input[type=range],input[type=number]'), trackState ) | ||
toolbox.each( document.querySelectorAll('input[type=radio]'), checkRadioLabel ) | ||
}) | ||
@@ -98,2 +112,3 @@ | ||
Event.on( document, 'input', inputSelectors, inputChange ) | ||
Event.on( document, 'input', 'input[type=radio]', checkRadioLabel ) | ||
@@ -100,0 +115,0 @@ // Form.reset() doesn't fire input events. This ensures those events are fired. |
{ | ||
"name": "compose-form-up", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "A lightweight HTML5 form utility including validation, progressive forms, and other handy tools.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -55,2 +55,8 @@ var u = require('./_utils.js') | ||
it( 'adds checked class to initially checked radio option', async () => { | ||
await u.findElement( '#label-radio-1.checked-radio' ) | ||
await u.isNull( '#label-radio-2.checked-radio' ) | ||
await u.isNull( '#label-radio-3.checked-radio' ) | ||
}) | ||
it( 'detects changes to a radio input', async () => { | ||
@@ -60,2 +66,7 @@ await u.isNull( '[type="radio"].changed-value' ) | ||
await expect( page ).toClick( '#radio-2' ) | ||
await u.isNull( '#label-radio-1.checked-radio' ) | ||
await u.findElement( '#label-radio-2.checked-radio' ) | ||
await u.isNull( '#label-radio-3.checked-radio' ) | ||
await u.findElement( '#radio-1.changed-value' ) | ||
@@ -65,2 +76,7 @@ await u.isNull( '#radio-3.changed-value' ) | ||
await expect( page ).toClick( '#radio-1' ) | ||
await u.findElement( '#label-radio-1.checked-radio' ) | ||
await u.isNull( '#label-radio-2.checked-radio' ) | ||
await u.isNull( '#label-radio-3.checked-radio' ) | ||
await u.isNull( '#radio-1.changed-value' ) | ||
@@ -67,0 +83,0 @@ await u.isNull( '#radio-2.changed-value' ) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
309280
2192
1