From 9bcbda43dc6c5fc739bcfde35a6c4e18254471c2 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Fri, 20 Jul 2018 11:13:12 -0400 Subject: [PATCH] Added test for DateTimeShortcuts.js time zone warning. --- js_tests/admin/DateTimeShortcuts.test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js_tests/admin/DateTimeShortcuts.test.js b/js_tests/admin/DateTimeShortcuts.test.js index 4e534954f3..7cc0bda60c 100644 --- a/js_tests/admin/DateTimeShortcuts.test.js +++ b/js_tests/admin/DateTimeShortcuts.test.js @@ -30,3 +30,14 @@ QUnit.test('custom time shortcuts', function(assert) { DateTimeShortcuts.init(); assert.equal($('.clockbox').find('a').first().text(), '3 a.m.'); }); + +QUnit.test('time zone offset warning', function(assert) { + var $ = django.jQuery; + var savedOffset = $('body').attr('data-admin-utc-offset'); + var timeField = $(''); + $('#qunit-fixture').append(timeField); + $('body').attr('data-admin-utc-offset', new Date().getTimezoneOffset() * -60 + 3600); + DateTimeShortcuts.init(); + $('body').attr('data-admin-utc-offset', savedOffset); + assert.equal($('.timezonewarning').text(), 'Note: You are 1 hour behind server time.'); +});