diff --git a/index.js b/index.js index 1735f03..5dd0df5 100644 --- a/index.js +++ b/index.js @@ -40,9 +40,6 @@ module.exports = { value: 'yellow', }, ], - settings: { - empty: false, - }, }, }, html: '', diff --git a/lib/validation.js b/lib/validation.js index 7b4b031..bb9d88e 100644 --- a/lib/validation.js +++ b/lib/validation.js @@ -19,10 +19,6 @@ * @module checkboxValidation */ -module.exports = function checkboxValidation(input, settings) { - if (input.target.value === '' && !settings.target.empty) { - return `${input.target.name} cannot be left blank!`; - } - +module.exports = function checkboxValidation() { return true; }; diff --git a/tests/validation.js b/tests/validation.js index 2b5e521..c5759a2 100644 --- a/tests/validation.js +++ b/tests/validation.js @@ -1,37 +1,31 @@ import test from 'ava'; import validation from '../lib/validation'; -const input = { +const empty = { target: { name: 'checkbox', - value: 'foo bar baz', - }, - all: { - checkbox: 'foo bar baz', + value: '', }, }; -const settings = { +const input = { target: { - empty: false, + name: 'checkbox', + value: 'foo bar baz', }, all: { - checkbox: { - empty: false, - }, + checkbox: 'foo bar baz', }, }; +const settings = {}; + // Valid input -test('valid input', t => { - t.true(validation(input, settings), 'Valid input returns true'); +test('empty input', t => { + t.true(validation(empty, settings), 'empty input returns true'); }); -// Invalid input -test('validate correct input', t => { - const ip = input; - ip.target.value = ''; - - t.is(validation(ip, settings), 'checkbox cannot be left blank!', 'Return string if not valid'); +test('valid input', t => { + t.true(validation(input, settings), 'Any input returns true'); });