summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Vance <steve@vance.com>2013-07-12 23:16:29 -0400
committerStephen Vance <steve@vance.com>2013-07-12 23:16:29 -0400
commitb23be92bd506eb4655d1d159fa34f12a29969ed2 (patch)
tree87103ea4d222b276db8effffce1c0beb19358346
parent7c389bad1574d50f5fe6f1f3bdf7056eb8f1e2b9 (diff)
downloadjQuery-Timepicker-Addon-b23be92bd506eb4655d1d159fa34f12a29969ed2.zip
jQuery-Timepicker-Addon-b23be92bd506eb4655d1d159fa34f12a29969ed2.tar.gz
jQuery-Timepicker-Addon-b23be92bd506eb4655d1d159fa34f12a29969ed2.tar.bz2
Test timepicker.timezoneAdjust()
-rw-r--r--test/jquery-ui-timepicker-addon_spec.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/jquery-ui-timepicker-addon_spec.js b/test/jquery-ui-timepicker-addon_spec.js
index 7efc023..9e1fd6e 100644
--- a/test/jquery-ui-timepicker-addon_spec.js
+++ b/test/jquery-ui-timepicker-addon_spec.js
@@ -266,6 +266,29 @@ describe('datetimepicker', function() {
});
});
+ describe('timezoneAdjust', function() {
+ it('does not change the date if the timezone yields NaN for an offset', function() {
+ var expectedDate = new Date();
+
+ expect($.timepicker.timezoneAdjust(expectedDate, NaN)).toEqual(expectedDate);
+ });
+
+ it('changes the minutes by the time zone offset minutes', function() {
+ var inputDate,
+ originalMillis,
+ expectedDifference,
+ adjustedDate;
+
+ inputDate = new Date();
+ originalMillis = inputDate.getTime();
+ expectedDifference = -(inputDate.getTimezoneOffset() + 60) * 60 * 1000;
+
+ adjustedDate = $.timepicker.timezoneAdjust(inputDate, '+0100');
+
+ expect(adjustedDate.getTime() - originalMillis).toBe(expectedDifference);
+ });
+ });
+
describe('log', function() {
it('calls console.log with the message if the console exists', function() {
var expectedMessage = "Just what I expected!";