1
0
mirror of https://github.com/django/django.git synced 2024-12-27 03:25:58 +00:00
django/js_tests/admin/DateTimeShortcuts.test.js
2016-12-19 12:43:47 -05:00

24 lines
798 B
JavaScript

/* global QUnit, DateTimeShortcuts */
/* eslint global-strict: 0, strict: 0 */
'use strict';
QUnit.module('admin.DateTimeShortcuts');
QUnit.test('init', function(assert) {
var $ = django.jQuery;
var dateField = $('<input type="text" class="vDateField" value="2015-03-16"><br>');
$('#qunit-fixture').append(dateField);
DateTimeShortcuts.init();
var shortcuts = $('.datetimeshortcuts');
assert.equal(shortcuts.length, 1);
assert.equal(shortcuts.find('a:first').text(), 'Today');
assert.equal(shortcuts.find('a:last .date-icon').length, 1);
// To prevent incorrect timezone warnings on date/time widgets, timezoneOffset
// should be 0 when a timezone offset isn't set in the HTML body attribute.
assert.equal(DateTimeShortcuts.timezoneOffset, 0);
});