Skip to content

Commit

Permalink
Merge branch 'master' into greenkeeper-eslint-3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnath committed Sep 13, 2016
2 parents 80d2e96 + 41f6ee5 commit 35f83aa
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 37 deletions.
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module.exports = {
label: 'Choose a month',
type: 'select',
settings: {
empty: true,
size: '1',
months: {
'01': 'January',
Expand Down
6 changes: 1 addition & 5 deletions lib/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
* @module monthValidation
*/

module.exports = function monthValidation(input, settings) {
if (input.target.value === '' && !settings.target.empty) {
return `${input.target.name} cannot be left blank!`;
}

module.exports = function monthValidation() {
return true;
};
32 changes: 1 addition & 31 deletions tests/validation.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,7 @@
import test from 'ava';
import validation from '../lib/validation';

const input = {
target: {
name: 'month',
value: 'foo bar baz',
},
all: {
month: 'foo bar baz',
},
};

const settings = {
target: {
empty: false,
},
all: {
month: {
empty: false,
},
},
};


// Valid input
test('valid input', t => {
t.true(validation(input, settings), 'Valid input returns true');
});

// Invalid input
test('validate correct input', t => {
const ip = input;
ip.target.value = '';

t.is(validation(ip, settings), 'month cannot be left blank!', 'Return string if not valid');
t.true(validation(), 'Empty input returns true');
});

0 comments on commit 35f83aa

Please sign in to comment.