Skip to content

Commit

Permalink
Failing test for #153.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 7, 2015
1 parent 3779f92 commit d24ab30
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/test-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,28 @@ test('create', function (t) {
t.end();
});

test('nested validation errors', function (t) {
var form = forms.create({
userDetails: {
username: forms.fields.string({ required: true }),
password: forms.fields.password({ required: true })
}
});

t.test('with subobject specified', function (st) {
st.plan(2);
form.handle({ userDetails: {} }, {
success: function (f) {
st.fail('Unexpected success callback');
st.notOk(f.isValid(), 'Form should not be valid');
},
other: function (f) {
st.equal(f.fields.userDetails.fields.username.error, 'Username is required.', 'validation failure on username field');
st.notOk(f.isValid(), 'Form should not be valid');
}
});
});

t.end();
});

0 comments on commit d24ab30

Please sign in to comment.