Skip to content

Commit 3e8231b

Browse files
committed
AltField and SelectedMonth Tests Added
#60 - Added tests for synching the altField when the SelectedMonth option is set as well as clearing any validation message. Also added a test for passing null to the SelectedMonth option.
1 parent 438df4b commit 3e8231b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ QUnit.test('AltField and AltFormat tests', function( assert ) {
608608
SelectedMonth: '05/2010',
609609
Animation: 'none', // Disable animation to make sure opening and closing the menu is synchronous.
610610
AltField: hiddenField,
611+
ValidationErrorMessage: 'Invalid Date!',
611612
AltFormat: 'yy-mm'
612613
});
613614

@@ -639,6 +640,23 @@ QUnit.test('AltField and AltFormat tests', function( assert ) {
639640

640641
assert.equal($(SecondaryAltField).val(), '', "The secondary field was cleared.");
641642

643+
field.MonthPicker('option', 'SelectedMonth', '06/2016');
644+
645+
assert.equal(field.val(), '06/2016', 'The main field was populated correctly using the SelectedMonth option.');
646+
assert.equal($(SecondaryAltField).val(), '06/2016', "The secondary field was populated correctly using the SelectedMonth option.");
647+
648+
field.MonthPicker('option', 'SelectedMonth', null);
649+
650+
assert.equal(field.val(), '', 'The main field was cleared by passing null to the SelectedMonth option.');
651+
assert.equal($(SecondaryAltField).val(), '', "The secondary field was cleared by passing null to the SelectedMonth option..");
652+
653+
assert.equal(field.MonthPicker('GetSelectedMonthYear'), null, 'GetSelectedMonthYear API call returned null when there was no date selected as expected.');
654+
655+
assert.equal($('#MonthPicker_Validation_MainAltField').css('display'), 'inline', '#MainAltField showed a validation message about a bad date.');
656+
657+
field.MonthPicker('option', 'SelectedMonth', '06/2016');
658+
659+
assert.ok($('#MonthPicker_Validation_MainAltField').is(':hidden'), '#MainAltField cleared the validation error message by setting the SelectedMonth option.');
642660

643661
});
644662

0 commit comments

Comments
 (0)