[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 module('Keyboard Navigation 2011', { 2 setup: function(){ 3 /* 4 Tests start with picker on March 31, 2011. Fun facts: 5 6 * March 1, 2011 was on a Tuesday 7 * March 31, 2011 was on a Thursday 8 */ 9 this.input = $('<input type="text" value="31-03-2011">') 10 .appendTo('#qunit-fixture') 11 .datepicker({format: "dd-mm-yyyy"}) 12 .focus(); // Activate for visibility checks 13 this.dp = this.input.data('datepicker') 14 this.picker = this.dp.picker; 15 }, 16 teardown: function(){ 17 this.picker.remove(); 18 } 19 }); 20 21 test('Regression: by week (up/down arrows); up from Mar 6, 2011 should go to Feb 27, 2011', function(){ 22 var target; 23 24 this.input.val('06-03-2011').datepicker('update'); 25 26 equal(this.dp.viewMode, 0); 27 target = this.picker.find('.datepicker-days thead th.switch'); 28 equal(target.text(), 'March 2011', 'Title is "March 2011"'); 29 datesEqual(this.dp.viewDate, new Date(2011, 2, 6)); 30 datesEqual(this.dp.date, new Date(2011, 2, 6)); 31 32 // Navigation: -1 week, up arrow key 33 this.input.trigger({ 34 type: 'keydown', 35 keyCode: 38 36 }); 37 datesEqual(this.dp.viewDate, new Date(2012, 1, 27)); 38 datesEqual(this.dp.date, new Date(2012, 1, 27)); 39 target = this.picker.find('.datepicker-days thead th.switch'); 40 equal(target.text(), 'February 2011', 'Title is "February 2011"'); 41 }); 42 43 test('Regression: by day (left/right arrows); left from Mar 1, 2011 should go to Feb 28, 2011', function(){ 44 var target; 45 46 this.input.val('01-03-2011').datepicker('update'); 47 48 equal(this.dp.viewMode, 0); 49 target = this.picker.find('.datepicker-days thead th.switch'); 50 equal(target.text(), 'March 2011', 'Title is "March 2011"'); 51 datesEqual(this.dp.viewDate, new Date(2011, 2, 1)); 52 datesEqual(this.dp.date, new Date(2011, 2, 1)); 53 54 // Navigation: -1 day left arrow key 55 this.input.trigger({ 56 type: 'keydown', 57 keyCode: 37 58 }); 59 datesEqual(this.dp.viewDate, new Date(2012, 1, 28)); 60 datesEqual(this.dp.date, new Date(2012, 1, 28)); 61 target = this.picker.find('.datepicker-days thead th.switch'); 62 equal(target.text(), 'February 2011', 'Title is "February 2011"'); 63 }); 64 65 test('Regression: by month (shift + left/right arrows); left from Mar 15, 2011 should go to Feb 15, 2011', function(){ 66 var target; 67 68 this.input.val('15-03-2011').datepicker('update'); 69 70 equal(this.dp.viewMode, 0); 71 target = this.picker.find('.datepicker-days thead th.switch'); 72 equal(target.text(), 'March 2011', 'Title is "March 2011"'); 73 datesEqual(this.dp.viewDate, new Date(2011, 2, 15)); 74 datesEqual(this.dp.date, new Date(2011, 2, 15)); 75 76 // Navigation: -1 month, shift + left arrow key 77 this.input.trigger({ 78 type: 'keydown', 79 keyCode: 37, 80 shiftKey: true 81 }); 82 datesEqual(this.dp.viewDate, new Date(2012, 1, 15)); 83 datesEqual(this.dp.date, new Date(2012, 1, 15)); 84 target = this.picker.find('.datepicker-days thead th.switch'); 85 equal(target.text(), 'February 2011', 'Title is "February 2011"'); 86 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |