Skip to content

Commit 2cc0d64

Browse files
Merge branch 'master' into bower
2 parents 4b6bf02 + 1958c63 commit 2cc0d64

File tree

5 files changed

+27
-24
lines changed

5 files changed

+27
-24
lines changed

demo/MonthPicker.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/MonthPicker.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/MonthPicker.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ to the Jump years menu.
124124
this also ensures that the entire menu dosen't resize itself
125125
in response to the slightly bigger buttons in the Jump years menu.
126126
*/
127-
.month-picker-month-table button {
128-
width: 4.3em;
127+
.month-picker-month-table .ui-button {
128+
width: 4.2em;
129129
margin: .2em;
130130
}
131131

src/MonthPicker.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,13 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
428428
var $table = $('.month-picker-month-table', _menu);
429429
for (var i = 0; i < 12; i++) {
430430
var $tr = !(i % 3) ? $('<tr />').appendTo($table) : $tr;
431-
$tr.append('<td><button class="button-' + (i + 1) + '" /></td>');
431+
432+
// Use <a> tag instead of <button> to avoid issues
433+
// only with Google Chrome (#50).
434+
$tr.append('<td><a class="button-' + (i + 1) + '" /></td>');
432435
}
433436

434-
this._buttons = $('button', $table).jqueryUIButton();
437+
this._buttons = $('a', $table).jqueryUIButton();
435438

436439
_menu.on(click, function (event) {
437440
return false;

test/test.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -985,11 +985,11 @@ QUnit.test('Month buttons are disabled', function (assert) {
985985
field.MonthPicker('Open');
986986

987987
var menu = $(MonthPicker_RistrictMonthField);
988-
var previousYearButton = menu.find('.month-picker-previous>a');
989-
var nextYearButton = menu.find('.month-picker-next>a');
988+
var previousYearButton = menu.find('.month-picker-previous>.ui-button');
989+
var nextYearButton = menu.find('.month-picker-next>.ui-button');
990990

991991
// Try to click the disabled buttons.
992-
var buttons = menu.find('.month-picker-month-table button');
992+
var buttons = menu.find('.month-picker-month-table .ui-button');
993993
$(buttons.slice(0, 8)).trigger('click');
994994

995995
assert.ok(previousYearButton.is('.ui-button-disabled'), 'The previous year button is disabled');
@@ -1066,7 +1066,7 @@ QUnit.test('Year buttons are disabled', function (assert) {
10661066
menu.find('.month-picker-title a').trigger('click');
10671067

10681068
// Make sure we are in years view.
1069-
var buttons = menu.find('.month-picker-month-table button');
1069+
var buttons = menu.find('.month-picker-month-table .ui-button');
10701070
var firstVisibleYear = parseInt($(buttons[0]).text(), 10);
10711071
assert.ok(firstVisibleYear, 'The menu is showing the year table');
10721072

@@ -1085,7 +1085,7 @@ QUnit.test('Year buttons are disabled', function (assert) {
10851085
assert.ok(firstVisibleYear, "Clciking the disabled buttons didn't take us to month view");
10861086

10871087
// Make sure the next years button is disabled.
1088-
var nextYearsButton = menu.find('.month-picker-next>a');
1088+
var nextYearsButton = menu.find('.month-picker-next>.ui-button');
10891089
var isDisabled = nextYearsButton
10901090
.trigger('click')
10911091
.is('.ui-button-disabled');
@@ -1094,7 +1094,7 @@ QUnit.test('Year buttons are disabled', function (assert) {
10941094
var newFirstYrar = parseInt($(buttons[0]).text(), 10);
10951095
assert.equal(newFirstYrar, firstVisibleYear, "Clicking next year didn't change the year");
10961096

1097-
var previousYearsButton = menu.find('.month-picker-previous>a');
1097+
var previousYearsButton = menu.find('.month-picker-previous>.ui-button');
10981098
// Keep going back until there are no disabled buttons.
10991099
// We count to 10 to avoid an infinite loop in case there's
11001100
// a bug where we are going back in time but the the buttons stay disabled.
@@ -1264,12 +1264,12 @@ QUnit.test('Today and selected months are highlighted', function (assert) {
12641264
field.MonthPicker('Open');
12651265
var menu = $(MonthPicker_highlightedField);
12661266

1267-
var buttons = menu.find('.month-picker-month-table button');
1267+
var buttons = menu.find('.month-picker-month-table .ui-button');
12681268

12691269
var todaysButton = $(buttons[new Date().getMonth()]);
12701270

1271-
var nextYearButton = menu.find('.month-picker-next>a');
1272-
var previousYearButton = menu.find('.month-picker-previous>a');
1271+
var nextYearButton = menu.find('.month-picker-next>.ui-button');
1272+
var previousYearButton = menu.find('.month-picker-previous>.ui-button');
12731273

12741274
assert.ok(todaysButton.is('.ui-state-highlight'), "Today's month is highlighted");
12751275

@@ -1292,7 +1292,7 @@ QUnit.test('Today and selected months are highlighted', function (assert) {
12921292
assert.equal( selectedButton.length, 1, 'There is one selected button');
12931293
assert.equal( selectedButton[0], buttons[4], 'The selected month is highlighted');
12941294

1295-
menu.find('.month-picker-title a').trigger('click');
1295+
menu.find('.month-picker-title .ui-button').trigger('click');
12961296

12971297
var selectdBtn = buttons.filter('.ui-state-active');
12981298
assert.equal( selectdBtn.jqueryUIButton( "option", "label" ), _today.getFullYear(), 'The selected year is highlighted');
@@ -1330,10 +1330,10 @@ QUnit.test('Number of months from today', function (assert) {
13301330
var menu = $(MonthPicker_RistrictMonthField);
13311331

13321332
// Make sure we are in years view.
1333-
var buttons = menu.find('.month-picker-month-table button');
1333+
var buttons = menu.find('.month-picker-month-table .ui-button');
13341334

1335-
var nextYearButton = menu.find('.month-picker-next>a');
1336-
var previousYearButton = menu.find('.month-picker-previous>a');
1335+
var nextYearButton = menu.find('.month-picker-next>.ui-button');
1336+
var previousYearButton = menu.find('.month-picker-previous>.ui-button');
13371337

13381338
var enabledMonths = 0;
13391339

@@ -1387,9 +1387,9 @@ QUnit.test('Relative month periods', function (assert) {
13871387
var menu = $(MonthPicker_RistrictMonthField);
13881388

13891389
// Make sure we are in years view.
1390-
var buttons = menu.find('.month-picker-month-table button');
1391-
var nextYearButton = menu.find('.month-picker-next>a');
1392-
var previousYearButton = menu.find('.month-picker-previous>a');
1390+
var buttons = menu.find('.month-picker-month-table .ui-button');
1391+
var nextYearButton = menu.find('.month-picker-next>.ui-button');
1392+
var previousYearButton = menu.find('.month-picker-previous>.ui-button');
13931393
var enabledMonths = 0;
13941394

13951395
// Make sure that 18 buttons + 1 for today are disabled.
@@ -1437,7 +1437,7 @@ QUnit.test('JavaScript Date objects', function (assert) {
14371437
field.val('05/2015');
14381438

14391439
var menu = $(MonthPicker_RistrictMonthField);
1440-
var buttons = menu.find('.month-picker-month-table button');
1440+
var buttons = menu.find('.month-picker-month-table .ui-button');
14411441

14421442
field.MonthPicker('Open');
14431443
assert.equal(buttons.not('.ui-button-disabled').length, 10, '10 month buttons are enabled');
@@ -1535,7 +1535,7 @@ QUnit.test('Back to 2015 button', function (assert) {
15351535
// Keep clicking next until today's year is not visible.
15361536
// We count to 10 to avoid an infinite loop in case there's
15371537
// a bug where the next button is not going to the next year.
1538-
var buttons = menu.find('.month-picker-month-table button');
1538+
var buttons = menu.find('.month-picker-month-table .ui-button');
15391539
var hasNext = buttons.is('.ui-state-highlight');
15401540
assert.ok( hasNext, "Today's year is highlighted" );
15411541
var i = 0;

0 commit comments

Comments
 (0)