Skip to content
Merged
Prev Previous commit
Next Next commit
Adds Toggle method test + Fixes issues with README.md
  • Loading branch information
benjamin-albert committed Oct 31, 2015
commit 05bea0dc831bcbce5dddd35c0f4676eb9f95438c
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>The jQuery UI Month Picker Version 2.6.1</h1>
<h1>The jQuery UI Month Picker Version 2.6.2</h1>
<p>The jQuery UI Month Picker Plugin is designed to allow user input for only a month and year when only that input is
required. Clicking on the year, allows the user to jump ahead or back 5 years at a time. Clicking anywhere on the
page, except on the month picker menu itself, will cause the month picker to hide. The Month Picker has lots of options
Expand Down Expand Up @@ -141,7 +141,7 @@ However this is <b>not supported</b> and might stop working in future releases i
</p>
<p>
Set the option upon init.
<pre>$('.selector').MonthPicker({ ShowIcon: true });</pre>
<pre>$('.selector').MonthPicker({ Disabled: true });</pre>

Get or set the option, after init.
<pre>
Expand Down Expand Up @@ -276,8 +276,8 @@ $('.selector').MonthPicker({
</pre>

Create a button with different images for enabled and disabled state.
<pre>
$('.selector').MonthPicker({
<pre id='disabledimgbtn'>
$('.selector').MonthPicker({
Button: function(opts) {
var src = 'images/calendar_' + (opts.Disabled ? 'disabled' : 'enabled') + '.gif';
return '&lt;img src="' + src + '" title="Select date" />';
Expand Down Expand Up @@ -987,11 +987,11 @@ $('.selector').MonthPicker('option', 'OnAfterChooseYear', function(){ ... } );

Get or set the callback function, after init.
<pre>
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterChooseYears');
//setter
$('.selector').MonthPicker('option', 'OnAfterChooseYears', function(){ ... } );
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterChooseYears');

//setter
$('.selector').MonthPicker('option', 'OnAfterChooseYears', function(){ ... } );
</pre>
</p>

Expand Down
4 changes: 4 additions & 0 deletions test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ <h2 id='apiVersion'>Version @VERSION</h2>
<p class="demo"> <b>Right to left</b> Choose a Month:
<input id="RTLField" />
</p>

<p class="demo"> <b>Toggle method test</b> Choose a Month:
<input id="ToggleField" />
</p>

<p class="demo"> <b>Only one picker open test</b> First picker:
<input id="FirstField" />
Expand Down
22 changes: 22 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,28 @@ QUnit.test('Right to left', function (assert) {
field.MonthPicker('Close');
});

QUnit.test('Toggle method', function (assert) {
var field = $(ToggleField).MonthPicker({
Animation: 'none', // Disable animation to make sure opening and closing the menu is synchronous.
});

field.MonthPicker('Toggle');

var menu = $(MonthPicker_ToggleField);

assert.ok(menu.is(':visible'), 'The menu was opened');

field.MonthPicker('Toggle');

assert.ok(!menu.is(':visible'), 'The menu was closed');

field.MonthPicker('Toggle');

assert.ok(menu.is(':visible'), 'The menu was again');

field.MonthPicker('Close');
});

QUnit.module("Button option");

QUnit.test('Plain HTML Button test', function (assert) {
Expand Down