[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/libraries/jquery.ui/tests/unit/datepicker/ -> datepicker_core.js (source)

   1  /*

   2   * datepicker_core.js

   3   */
   4  
   5  function equalsDate(d1, d2, message) {
   6      if (!d1 || !d2) {
   7          ok(false, message + ' - missing date');
   8          return;
   9      }
  10      d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate());
  11      d2 = new Date(d2.getFullYear(), d2.getMonth(), d2.getDate());
  12      equals(d1.toString(), d2.toString(), message);
  13  }
  14  
  15  function equalsDateArray(a1, a2, message) {
  16      if (!a1 || !a2) {
  17          ok(false, message + ' - missing dates');
  18          return;
  19      }
  20      a1[0] = (a1[0] ? new Date(a1[0].getFullYear(), a1[0].getMonth(), a1[0].getDate()) : '');
  21      a1[1] = (a1[1] ? new Date(a1[1].getFullYear(), a1[1].getMonth(), a1[1].getDate()) : '');
  22      a2[0] = (a2[0] ? new Date(a2[0].getFullYear(), a2[0].getMonth(), a2[0].getDate()) : '');
  23      a2[1] = (a2[1] ? new Date(a2[1].getFullYear(), a2[1].getMonth(), a2[1].getDate()) : '');
  24      same(a1, a2, message);
  25  }
  26  
  27  function init(id, options) {
  28      $.datepicker.setDefaults($.datepicker.regional['']);
  29      var inp = $(id);
  30      inp.datepicker($.extend({duration: ''}, options || {}));
  31      return inp;
  32  }
  33  
  34  var PROP_NAME = 'datepicker';
  35  
  36  (function($) {
  37  
  38  module("datepicker: core");
  39  
  40  test('baseStructure', function() {
  41      var dp = $('#ui-datepicker-div');
  42      var inp = init('#inp');
  43      inp.focus();
  44      var iframe = ($.browser.msie && parseInt($.browser.version) < 7);
  45      ok(dp.is(':visible'), 'Structure - datepicker visible');
  46      ok(!dp.is('.ui-datepicker-rtl'), 'Structure - not right-to-left');
  47      ok(!dp.is('.ui-datepicker-multi'), 'Structure - not multi-month');
  48      equals(dp.children().length, 2 + (iframe ? 1 : 0), 'Structure - child count');
  49      
  50      var header = dp.children(':first');
  51      ok(header.is('div.ui-datepicker-header'), 'Structure - header division');
  52      equals(header.children().length, 3, 'Structure - header child count');
  53      ok(header.children(':first').is('a.ui-datepicker-prev') && header.children(':first').html() != '', 'Structure - prev link');
  54      ok(header.children(':eq(1)').is('a.ui-datepicker-next') && header.children(':eq(1)').html() != '', 'Structure - next link');
  55      
  56      var title = header.children(':last');
  57      ok(title.is('div.ui-datepicker-title') && title.html() != '','Structure - title division');
  58      equals(title.children().length, 2, 'Structure - title child count');
  59      ok(title.children(':first').is('span.ui-datepicker-month') && title.children(':first').text() != '', 'Structure - month text')
  60      ok(title.children(':last').is('span.ui-datepicker-year') && title.children(':last').text() != '', 'Structure - year text')
  61      
  62      var table = dp.children(':eq(1)');
  63      ok(table.is('table.ui-datepicker-calendar'), 'Structure - month table');
  64      ok(table.children(':first').is('thead'), 'Structure - month table thead');
  65      var thead = table.children(':first').children(':first');
  66      ok(thead.is('tr'), 'Structure - month table title row');
  67      equals(thead.find('th').length, 7, 'Structure - month table title cells');
  68      ok(table.children(':eq(1)').is('tbody'), 'Structure - month table body');
  69      ok(table.children(':eq(1)').children('tr').length >= 4, 'Structure - month table week count');
  70      var week = table.children(':eq(1)').children(':first');
  71      ok(week.is('tr'), 'Structure - month table week row');
  72      equals(week.children().length, 7, 'Structure - week child count');
  73      ok(week.children(':first').is('td.ui-datepicker-week-end'), 'Structure - month table first day cell');
  74      ok(week.children(':last').is('td.ui-datepicker-week-end'), 'Structure - month table second day cell');
  75      ok(dp.children('iframe').length == (iframe ? 1 : 0), 'Structure - iframe');
  76      inp.datepicker('hide').datepicker('destroy');
  77      
  78      // Editable month/year and button panel

  79      inp = init('#inp', {changeMonth: true, changeYear: true, showButtonPanel: true});
  80      inp.focus();
  81  
  82      var title = dp.find('div.ui-datepicker-title');
  83      ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure - month selector');
  84      ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure - year selector');
  85          
  86      var panel = dp.children(':last');
  87      ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure - button panel division');
  88      equals(panel.children().length, 2, 'Structure - button panel child count');
  89      ok(panel.children(':first').is('button.ui-datepicker-current'), 'Structure - today button');
  90      ok(panel.children(':last').is('button.ui-datepicker-close'), 'Structure - close button');
  91      inp.datepicker('hide').datepicker('destroy');
  92      
  93      // Multi-month 2

  94      inp = init('#inp', {numberOfMonths: 2});
  95      inp.focus();
  96      ok(dp.is('.ui-datepicker-multi'), 'Structure multi [2] - multi-month');
  97      equals(dp.children().length, 2 + (iframe ? 1 : 0), 'Structure multi [2] - child count');
  98      month = dp.children(':first');
  99      ok(month.is('div.ui-datepicker-group') && month.is('div.ui-datepicker-group-first'), 'Structure multi [2] - first month division');
 100      month = dp.children(':eq(1)');
 101      ok(month.is('div.ui-datepicker-group') && month.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
 102      inp.datepicker('hide').datepicker('destroy');
 103      
 104      // Multi-month [2, 2]

 105      inp = init('#inp', {numberOfMonths: [2, 2]});
 106      inp.focus();
 107      ok(dp.is('.ui-datepicker-multi'), 'Structure multi - multi-month');
 108      equals(dp.children().length, 4 + (iframe ? 1 : 0), 'Structure multi [2,2] - child count');
 109      month = dp.children(':first');
 110      ok(month.is('div.ui-datepicker-group') && month.is('div.ui-datepicker-group-first'), 'Structure multi [2,2] - first month division');
 111      month = dp.children(':eq(1)');
 112      ok(month.is('div.ui-datepicker-group') && month.is('div.ui-datepicker-group-last'), 'Structure multi [2,2] - second month division');
 113      month = dp.children(':eq(2)');
 114      ok(month.is('div.ui-datepicker-group') && month.is('div.ui-datepicker-group-first'), 'Structure multi [2,2] - third month division');
 115      month = dp.children(':eq(3)');
 116      ok(month.is('div.ui-datepicker-group') && month.is('div.ui-datepicker-group-last'), 'Structure multi [2,2] - fourth month division');
 117      inp.datepicker('hide').datepicker('destroy');
 118      
 119      // Inline

 120      var inl = init('#inl');
 121      dp = inl.children();
 122      ok(dp.is('.ui-datepicker-inline'), 'Structure inline - main div');
 123      ok(!dp.is('.ui-datepicker-rtl'), 'Structure inline - not right-to-left');
 124      ok(!dp.is('.ui-datepicker-multi'), 'Structure inline - not multi-month');
 125      equals(dp.children().length, 2, 'Structure inline - child count');
 126      var header = dp.children(':first');
 127      ok(header.is('div.ui-datepicker-header'), 'Structure inline - header division');
 128      equals(header.children().length, 3, 'Structure inline - header child count');
 129      var table = month.children(':eq(1)');
 130      ok(table.is('table.ui-datepicker-calendar'), 'Structure inline - month table');
 131      ok(table.children(':first').is('thead'), 'Structure inline - month table thead');
 132      ok(table.children(':eq(1)').is('tbody'), 'Structure inline - month table body');
 133      inl.datepicker('destroy');
 134      
 135      // Inline multi-month

 136      inl = init('#inl', {numberOfMonths: 2});
 137      dp = inl.children();
 138      ok(dp.is('.ui-datepicker-inline') && dp.is('.ui-datepicker-multi'), 'Structure inline multi - main div');    
 139      equals(dp.children().length, 2 + (iframe ? 1 : 0), 'Structure multi - child count');
 140      month = dp.children(':first');
 141      ok(month.is('div.ui-datepicker-group') && month.is('div.ui-datepicker-group-first'), 'Structure multi - first month division');
 142      month = dp.children(':eq(1)');
 143      ok(month.is('div.ui-datepicker-group') && month.is('div.ui-datepicker-group-last'), 'Structure multi - second month division');
 144      inl.datepicker('destroy');
 145  });
 146  
 147  test('customStructure', function() {
 148      var dp = $('#ui-datepicker-div');
 149      // Check right-to-left localisation

 150      var inp = init('#inp', $.datepicker.regional['he']);
 151      inp.data('showButtonPanel.datepicker',true);
 152      inp.focus();
 153      var iframe = ($.browser.msie && parseInt($.browser.version) < 7);
 154      ok(dp.is('.ui-datepicker-rtl'), 'Structure RTL - right-to-left');
 155      var header = dp.children(':first');
 156      ok(header.is('div.ui-datepicker-header'), 'Structure RTL - header division');
 157      equals(header.children().length, 3, 'Structure RTL - header child count');
 158      ok(header.children(':first').is('a.ui-datepicker-next'), 'Structure RTL - prev link');
 159      ok(header.children(':eq(1)').is('a.ui-datepicker-prev'), 'Structure RTL - next link');    
 160      var panel = dp.children(':last');
 161      ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure RTL - button division');
 162      equals(panel.children().length, 2, 'Structure RTL - button panel child count');
 163      ok(panel.children(':first').is('button.ui-datepicker-close'), 'Structure RTL - close button');
 164      ok(panel.children(':last').is('button.ui-datepicker-current'), 'Structure RTL - today button');
 165      inp.datepicker('hide').datepicker('destroy');
 166  
 167      // Hide prev/next

 168      inp = init('#inp', {hideIfNoPrevNext: true, minDate: new Date(2008, 2 - 1, 4), maxDate: new Date(2008, 2 - 1, 14)});
 169      inp.val('02/10/2008').focus();
 170      var header = dp.children(':first');
 171      ok(header.is('div.ui-datepicker-header'), 'Structure hide prev/next - header division');
 172      equals(header.children().length, 1, 'Structure hide prev/next - links child count');
 173      ok(header.children(':first').is('div.ui-datepicker-title'), 'Structure hide prev/next - title division');
 174      inp.datepicker('hide').datepicker('destroy');
 175      
 176      // Changeable Month with read-only year

 177      inp = init('#inp', {changeMonth: true});
 178      inp.focus();
 179      var title = dp.children(':first').children(':last');
 180      equals(title.children().length, 2, 'Structure changeable month - title child count');
 181      ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure changeable month - month selector');
 182      ok(title.children(':last').is('span.ui-datepicker-year'), 'Structure changeable month - read-only year');
 183      inp.datepicker('hide').datepicker('destroy');
 184      
 185      // Changeable year with read-only month

 186      inp = init('#inp', {changeYear: true});
 187      inp.focus();
 188      var title = dp.children(':first').children(':last');
 189      equals(title.children().length, 2, 'Structure changeable year - title child count');
 190      ok(title.children(':first').is('span.ui-datepicker-month'), 'Structure changeable year - read-only month');
 191      ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure changeable year - year selector');
 192      inp.datepicker('hide').datepicker('destroy');
 193  
 194      // Read-only first day of week

 195      inp = init('#inp', {changeFirstDay: false});
 196      inp.focus();
 197      var thead = dp.find('.ui-datepicker-calendar thead tr');
 198      equals(thead.children().length, 7, 'Structure read-only first day - thead child count');
 199      equals(thead.find('a').length, 0, 'Structure read-only first day - thead links count');
 200      inp.datepicker('hide').datepicker('destroy');
 201  });
 202  
 203  test('keystrokes', function() {
 204      var inp = init('#inp');
 205      var date = new Date();
 206      inp.val('').datepicker('show').
 207          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 208      equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter');
 209      inp.val('02/04/2008').datepicker('show').
 210          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 211      equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
 212          'Keystroke enter - preset');
 213      inp.val('02/04/2008').datepicker('show').
 214          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}).
 215          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 216      equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+home');
 217      inp.val('02/04/2008').datepicker('show').
 218          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END});
 219      ok(inp.datepicker('getDate') == null, 'Keystroke ctrl+end');
 220      inp.val('').datepicker('show').
 221          simulate('keydown', {keyCode: $.simulate.VK_ESC});
 222      ok(inp.datepicker('getDate') == null, 'Keystroke esc');
 223      inp.val('02/04/2008').datepicker('show').
 224          simulate('keydown', {keyCode: $.simulate.VK_ESC});
 225      equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
 226          'Keystroke esc - preset');
 227      inp.val('02/04/2008').datepicker('show').
 228          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
 229          simulate('keydown', {keyCode: $.simulate.VK_ESC});
 230      equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
 231          'Keystroke esc - abandoned');
 232      // Moving by day or week

 233      inp.val('').datepicker('show').
 234          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_LEFT}).
 235          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 236      date.setDate(date.getDate() - 1);
 237      equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+left');
 238      inp.val('').datepicker('show').
 239          simulate('keydown', {keyCode: $.simulate.VK_LEFT}).
 240          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 241      date.setDate(date.getDate() + 1);
 242      equalsDate(inp.datepicker('getDate'), date, 'Keystroke left');
 243      inp.val('').datepicker('show').
 244          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_RIGHT}).
 245          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 246      date.setDate(date.getDate() + 1);
 247      equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+right');
 248      inp.val('').datepicker('show').
 249          simulate('keydown', {keyCode: $.simulate.VK_RIGHT}).
 250          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 251      date.setDate(date.getDate() - 1);
 252      equalsDate(inp.datepicker('getDate'), date, 'Keystroke right');
 253      inp.val('').datepicker('show').
 254          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_UP}).
 255          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 256      date.setDate(date.getDate() - 7);
 257      equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+up');
 258      inp.val('').datepicker('show').
 259          simulate('keydown', {keyCode: $.simulate.VK_UP}).
 260          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 261      date.setDate(date.getDate() + 7);
 262      equalsDate(inp.datepicker('getDate'), date, 'Keystroke up');
 263      inp.val('').datepicker('show').
 264          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}).
 265          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 266      date.setDate(date.getDate() + 7);
 267      equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+down');
 268      inp.val('').datepicker('show').
 269          simulate('keydown', {keyCode: $.simulate.VK_DOWN}).
 270          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 271      date.setDate(date.getDate() - 7);
 272      equalsDate(inp.datepicker('getDate'), date, 'Keystroke down');
 273      // Moving by month or year

 274      inp.val('02/04/2008').datepicker('show').
 275          simulate('keydown', {keyCode: $.simulate.VK_PGUP}).
 276          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 277      equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 4),
 278          'Keystroke pgup');
 279      inp.val('02/04/2008').datepicker('show').
 280          simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
 281          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 282      equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 4),
 283          'Keystroke pgdn');
 284      inp.val('02/04/2008').datepicker('show').
 285          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
 286          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 287      equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 4),
 288          'Keystroke ctrl+pgup');
 289      inp.val('02/04/2008').datepicker('show').
 290          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
 291          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 292      equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 4),
 293          'Keystroke ctrl+pgdn');
 294      // Check for moving to short months

 295      inp.val('03/31/2008').datepicker('show').
 296          simulate('keydown', {keyCode: $.simulate.VK_PGUP}).
 297          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 298      equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29),
 299          'Keystroke pgup - Feb');
 300      inp.val('01/30/2008').datepicker('show').
 301          simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
 302          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 303      equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29), 
 304          'Keystroke pgdn - Feb');
 305      inp.val('02/29/2008').datepicker('show').
 306          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}).
 307          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 308      equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 28),
 309          'Keystroke ctrl+pgup - Feb');
 310      inp.val('02/29/2008').datepicker('show').
 311          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}).
 312          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 313      equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 28),
 314          'Keystroke ctrl+pgdn - Feb');
 315      // Goto current

 316      inp.datepicker('option', {gotoCurrent: true}).
 317          datepicker('hide').val('02/04/2008').datepicker('show').
 318          simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
 319          simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}).
 320          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 321      equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
 322          'Keystroke ctrl+home');
 323      // Change steps

 324      inp.datepicker('option', {stepMonths: 2, gotoCurrent: false}).
 325          datepicker('hide').val('02/04/2008').datepicker('show').
 326          simulate('keydown', {keyCode: $.simulate.VK_PGUP}).
 327          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 328      equalsDate(inp.datepicker('getDate'), new Date(2007, 12 - 1, 4),
 329          'Keystroke pgup step 2');
 330      inp.val('02/04/2008').datepicker('show').
 331          simulate('keydown', {keyCode: $.simulate.VK_PGDN}).
 332          simulate('keydown', {keyCode: $.simulate.VK_ENTER});
 333      equalsDate(inp.datepicker('getDate'), new Date(2008, 4 - 1, 4),
 334          'Keystroke pgdn step 2');
 335  });
 336  
 337  test('mouse', function() {
 338      var inp = init('#inp');
 339      var dp = $('#ui-datepicker-div');
 340      var date = new Date();
 341      inp.val('').datepicker('show');
 342      $('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
 343      date.setDate(10);
 344      equalsDate(inp.datepicker('getDate'), date, 'Mouse click');
 345      inp.val('02/04/2008').datepicker('show');
 346      $('.ui-datepicker-calendar tbody a:contains(12)', dp).simulate('click', {});
 347      equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 12),
 348          'Mouse click - preset');
 349      inp.val('02/04/2008').datepicker('show');
 350      inp.val('').datepicker('show');
 351      $('button.ui-datepicker-close', dp).simulate('click', {});
 352      ok(inp.datepicker('getDate') == null, 'Mouse click - close');
 353      inp.val('02/04/2008').datepicker('show');
 354      $('button.ui-datepicker-close', dp).simulate('click', {});
 355      equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
 356          'Mouse click - close + preset');
 357      inp.val('02/04/2008').datepicker('show');
 358      $('a.ui-datepicker-prev', dp).simulate('click', {});
 359      $('button.ui-datepicker-close', dp).simulate('click', {});
 360      equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4),
 361          'Mouse click - abandoned');
 362      // Current/previous/next

 363      inp.val('02/04/2008').datepicker('option', {showButtonPanel: true}).datepicker('show');
 364      $('.ui-datepicker-current', dp).simulate('click', {});
 365      $('.ui-datepicker-calendar tbody a:contains(14)', dp).simulate('click', {});
 366      date.setDate(14);
 367      equalsDate(inp.datepicker('getDate'), date, 'Mouse click - current');
 368      inp.val('02/04/2008').datepicker('show');
 369      $('.ui-datepicker-prev', dp).simulate('click');
 370      $('.ui-datepicker-calendar tbody a:contains(16)', dp).simulate('click');
 371      equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 16),
 372          'Mouse click - previous');
 373      inp.val('02/04/2008').datepicker('show');
 374      $('.ui-datepicker-next', dp).simulate('click');
 375      $('.ui-datepicker-calendar tbody a:contains(18)', dp).simulate('click');
 376      equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 18),
 377          'Mouse click - next');
 378      // Previous/next with minimum/maximum

 379      inp.datepicker('option', {minDate: new Date(2008, 2 - 1, 2),
 380          maxDate: new Date(2008, 2 - 1, 26)}).val('02/04/2008').datepicker('show');
 381      $('.ui-datepicker-prev', dp).simulate('click');
 382      $('.ui-datepicker-calendar tbody a:contains(16)', dp).simulate('click');
 383      equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 16),
 384          'Mouse click - previous + min/max');
 385      inp.val('02/04/2008').datepicker('show');
 386      $('.ui-datepicker-next', dp).simulate('click');
 387      $('.ui-datepicker-calendar tbody a:contains(18)', dp).simulate('click');
 388      equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 18),
 389          'Mouse click - next + min/max');
 390      // Inline

 391      var inl = init('#inl');
 392      var dp = $('.ui-datepicker-inline', inl);
 393      var date = new Date();
 394      inl.datepicker('setDate', date);
 395      $('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
 396      date.setDate(10);
 397      equalsDate(inl.datepicker('getDate'), date, 'Mouse click inline');
 398      inl.datepicker('option', {showButtonPanel: true}).datepicker('setDate', new Date(2008, 2 - 1, 4));
 399      $('.ui-datepicker-calendar tbody a:contains(12)', dp).simulate('click', {});
 400      equalsDate(inl.datepicker('getDate'), new Date(2008, 2 - 1, 12), 'Mouse click inline - preset');
 401      inl.datepicker('option', {showButtonPanel: true});
 402      $('.ui-datepicker-current', dp).simulate('click', {});
 403      $('.ui-datepicker-calendar tbody a:contains(14)', dp).simulate('click', {});
 404      date.setDate(14);
 405      equalsDate(inl.datepicker('getDate'), date, 'Mouse click inline - current');
 406      inl.datepicker('setDate', new Date(2008, 2 - 1, 4));
 407      $('.ui-datepicker-prev', dp).simulate('click');
 408      $('.ui-datepicker-calendar tbody a:contains(16)', dp).simulate('click');
 409      equalsDate(inl.datepicker('getDate'), new Date(2008, 1 - 1, 16),
 410          'Mouse click inline - previous');
 411      inl.datepicker('setDate', new Date(2008, 2 - 1, 4));
 412      $('.ui-datepicker-next', dp).simulate('click');
 413      $('.ui-datepicker-calendar tbody a:contains(18)', dp).simulate('click');
 414      equalsDate(inl.datepicker('getDate'), new Date(2008, 3 - 1, 18),
 415          'Mouse click inline - next');
 416  });
 417  
 418  })(jQuery);


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7