[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/bootstrap/js/eternicode-bootstrap-datepicker/tests/suites/mouse_navigation/ -> 2011.js (source)

   1  module('Mouse Navigation 2011', {
   2      setup: function(){
   3          /*
   4              Tests start with picker on March 31, 2011.
   5          */
   6          this.input = $('<input type="text" value="31-03-2011">')
   7                          .appendTo('#qunit-fixture')
   8                          .datepicker({format: "dd-mm-yyyy"})
   9                          .focus(); // Activate for visibility checks
  10          this.dp = this.input.data('datepicker')
  11          this.picker = this.dp.picker;
  12      },
  13      teardown: function(){
  14          this.picker.remove();
  15      }
  16  });
  17  
  18  test('Selecting date from previous month while in January changes month and year displayed', function(){
  19      var target;
  20  
  21      this.input.val('01-01-2011');
  22      this.dp.update();
  23      datesEqual(this.dp.viewDate, new Date(2011, 0, 1))
  24      datesEqual(this.dp.date, new Date(2011, 0, 1))
  25  
  26      // Rendered correctly
  27      equal(this.dp.viewMode, 0);
  28      target = this.picker.find('.datepicker-days tbody td:first');
  29      equal(target.text(), '26'); // Should be Dec 26
  30      equal(this.picker.find('.datepicker-days thead th.switch').text(), 'January 2011');
  31  
  32      // Updated internally on click
  33      target.click();
  34      equal(this.picker.find('.datepicker-days thead th.switch').text(), 'December 2010');
  35      datesEqual(this.dp.viewDate, new Date(2010, 11, 26))
  36      datesEqual(this.dp.date, new Date(2010, 11, 26))
  37  
  38      // Re-rendered on click
  39      target = this.picker.find('.datepicker-days tbody td:first');
  40      equal(target.text(), '28'); // Should be Nov 28
  41  });
  42  
  43  test('Selecting date from next month while in December changes month and year displayed', function(){
  44      var target;
  45  
  46      this.input.val('01-12-2010');
  47      this.dp.update();
  48      datesEqual(this.dp.viewDate, new Date(2010, 11, 1))
  49      datesEqual(this.dp.date, new Date(2010, 11, 1))
  50  
  51      // Rendered correctly
  52      equal(this.dp.viewMode, 0);
  53      target = this.picker.find('.datepicker-days tbody td:last');
  54      equal(target.text(), '8'); // Should be Jan 8
  55      equal(this.picker.find('.datepicker-days thead th.switch').text(), 'December 2010');
  56  
  57      // Updated internally on click
  58      target.click();
  59      equal(this.picker.find('.datepicker-days thead th.switch').text(), 'January 2011');
  60      datesEqual(this.dp.viewDate, new Date(2011, 0, 8))
  61      datesEqual(this.dp.date, new Date(2011, 0, 8))
  62  
  63      // Re-rendered on click
  64      target = this.picker.find('.datepicker-days tbody td:first');
  65      equal(target.text(), '26'); // Should be Dec 26
  66  });


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1