Skip to content

Commit

Permalink
Added test for DateTimeShortcuts.js time zone warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
claudep authored and timgraham committed Jul 20, 2018
1 parent b004bd6 commit 9bcbda4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions js_tests/admin/DateTimeShortcuts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = $('<input type="text" name="time_test" class="vTimeField">');
$('#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.');
});

0 comments on commit 9bcbda4

Please sign in to comment.