diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-04-07 10:55:52 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-04-09 09:27:00 -0400 |
commit | bde431bb449b1d957d4e0b736111ff342f2a919d (patch) | |
tree | 27fd40037c30dbff8ef3b6113e90817ab96b53bf /tests/unit/datepicker/helper.js | |
parent | dc4b015a8b9acdb5bff2d5dd89737b3d8b64097f (diff) | |
download | jquery-ui-bde431bb449b1d957d4e0b736111ff342f2a919d.tar.gz jquery-ui-bde431bb449b1d957d4e0b736111ff342f2a919d.zip |
Tests: Rename files
Ref gh-1528
Diffstat (limited to 'tests/unit/datepicker/helper.js')
-rw-r--r-- | tests/unit/datepicker/helper.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/unit/datepicker/helper.js b/tests/unit/datepicker/helper.js new file mode 100644 index 000000000..4cd9b48ff --- /dev/null +++ b/tests/unit/datepicker/helper.js @@ -0,0 +1,38 @@ +define( [ + "jquery", + "lib/helper", + "ui/datepicker" +], function( $, helper ) { + +return $.extend( helper, { + addMonths: function(date, offset) { + var maxDay = 32 - new Date(date.getFullYear(), date.getMonth() + offset, 32).getDate(); + date.setDate(Math.min(date.getDate(), maxDay)); + date.setMonth(date.getMonth() + offset); + return date; + }, + + equalsDate: function(d1, d2, message) { + if (!d1 || !d2) { + ok(false, message + " - missing date"); + return; + } + d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate()); + d2 = new Date(d2.getFullYear(), d2.getMonth(), d2.getDate()); + equal(d1.toString(), d2.toString(), message); + }, + + init: function( id, options ) { + $.datepicker.setDefaults( $.datepicker.regional[ "" ] ); + return $( id ).datepicker( $.extend( { showAnim: "" }, options || {} ) ); + }, + + initNewInput: function( options ) { + var id = $( "<input>" ).appendTo( "#qunit-fixture" ); + return this.init( id, options ); + }, + + PROP_NAME: "datepicker" +} ); + +} ); |