Skip to content

Commit 80494d6

Browse files
Merge pull request #61 from KidSysco/Development
AltField and SelectedMonth Tests Added
2 parents 438df4b + 3340f0f commit 80494d6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/test.js

Lines changed: 24 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,29 @@ 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+
var selectedVal = field.MonthPicker('Validate');
654+
655+
assert.equal($('#MonthPicker_Validation_MainAltField').css('display'), 'inline', 'A Validate API call showed a validation message about a bad date on #MainAltField.');
656+
657+
assert.equal(selectedVal, null, 'Validate API call returned null when there was no date selected as expected.');
658+
659+
assert.equal(field.MonthPicker('GetSelectedMonthYear'), null, 'GetSelectedMonthYear API call returned null when there was no date selected as expected.');
660+
661+
assert.equal($('#MonthPicker_Validation_MainAltField').css('display'), 'inline', '#MainAltField showed a validation message about a bad date.');
662+
663+
field.MonthPicker('option', 'SelectedMonth', '06/2016');
664+
665+
assert.ok($('#MonthPicker_Validation_MainAltField').is(':hidden'), '#MainAltField cleared the validation error message by setting the SelectedMonth option.');
642666

643667
});
644668

0 commit comments

Comments
 (0)