Updated to QUnit 2.0.1.

This commit is contained in:
Tim Graham 2016-12-19 12:43:47 -05:00 committed by GitHub
parent a85e84212e
commit 620dcdde6e
11 changed files with 709 additions and 496 deletions

View File

@ -1,10 +1,10 @@
/* global module, test, DateTimeShortcuts */
/* global QUnit, DateTimeShortcuts */
/* eslint global-strict: 0, strict: 0 */
'use strict';
module('admin.DateTimeShortcuts');
QUnit.module('admin.DateTimeShortcuts');
test('init', function(assert) {
QUnit.test('init', function(assert) {
var $ = django.jQuery;
var dateField = $('<input type="text" class="vDateField" value="2015-03-16"><br>');

View File

@ -1,16 +1,16 @@
/* global module, test, id_to_windowname,
/* global QUnit, id_to_windowname,
windowname_to_id */
/* eslint global-strict: 0, strict: 0 */
'use strict';
module('admin.RelatedObjectLookups');
QUnit.module('admin.RelatedObjectLookups');
test('id_to_windowname', function(assert) {
QUnit.test('id_to_windowname', function(assert) {
assert.equal(id_to_windowname('.test'), '__dot__test');
assert.equal(id_to_windowname('misc-test'), 'misc__dash__test');
});
test('windowname_to_id', function(assert) {
QUnit.test('windowname_to_id', function(assert) {
assert.equal(windowname_to_id('__dot__test'), '.test');
assert.equal(windowname_to_id('misc__dash__test'), 'misc-test');
});

View File

@ -1,17 +1,17 @@
/* global module, test, SelectBox */
/* global QUnit, SelectBox */
/* eslint global-strict: 0, strict: 0 */
'use strict';
module('admin.SelectBox');
QUnit.module('admin.SelectBox');
test('init: no options', function(assert) {
QUnit.test('init: no options', function(assert) {
var $ = django.jQuery;
$('<select id="id"></select>').appendTo('#qunit-fixture');
SelectBox.init('id');
assert.equal(SelectBox.cache.id.length, 0);
});
test('filter', function(assert) {
QUnit.test('filter', function(assert) {
var $ = django.jQuery;
$('<select id="id"></select>').appendTo('#qunit-fixture');
$('<option value="0">A</option>').appendTo('#id');

View File

@ -1,10 +1,10 @@
/* global module, test, SelectFilter */
/* global QUnit, SelectFilter */
/* eslint global-strict: 0, strict: 0 */
'use strict';
module('admin.SelectFilter2');
QUnit.module('admin.SelectFilter2');
test('init', function(assert) {
QUnit.test('init', function(assert) {
var $ = django.jQuery;
$('<form><select id="id"></select></form>').appendTo('#qunit-fixture');
$('<option value="0">A</option>').appendTo('#id');

View File

@ -1,8 +1,8 @@
/* global module, test */
/* global QUnit */
/* eslint global-strict: 0, strict: 0 */
'use strict';
module('admin.actions', {
QUnit.module('admin.actions', {
beforeEach: function() {
// Number of results shown on page
/* eslint-disable */
@ -16,7 +16,7 @@ module('admin.actions', {
}
});
test('check', function(assert) {
QUnit.test('check', function(assert) {
var $ = django.jQuery;
assert.notOk($('.action-select').is(':checked'));
$('#action-toggle').click();

View File

@ -1,63 +1,63 @@
/* global module, test */
/* global QUnit */
/* eslint global-strict: 0, strict: 0 */
'use strict';
module('admin.core');
QUnit.module('admin.core');
test('Date.getTwelveHours', function(assert) {
QUnit.test('Date.getTwelveHours', function(assert) {
assert.equal(new Date(2011, 0, 1, 0, 0).getTwelveHours(), 12, '0:00');
assert.equal(new Date(2011, 0, 1, 11, 0).getTwelveHours(), 11, '11:00');
assert.equal(new Date(2011, 0, 1, 16, 0).getTwelveHours(), 4, '16:00');
});
test('Date.getTwoDigitMonth', function(assert) {
QUnit.test('Date.getTwoDigitMonth', function(assert) {
assert.equal(new Date(2011, 0, 1).getTwoDigitMonth(), '01', 'jan 1');
assert.equal(new Date(2011, 9, 1).getTwoDigitMonth(), '10', 'oct 1');
});
test('Date.getTwoDigitDate', function(assert) {
QUnit.test('Date.getTwoDigitDate', function(assert) {
assert.equal(new Date(2011, 0, 1).getTwoDigitDate(), '01', 'jan 1');
assert.equal(new Date(2011, 0, 15).getTwoDigitDate(), '15', 'jan 15');
});
test('Date.getTwoDigitTwelveHour', function(assert) {
QUnit.test('Date.getTwoDigitTwelveHour', function(assert) {
assert.equal(new Date(2011, 0, 1, 0, 0).getTwoDigitTwelveHour(), '12', '0:00');
assert.equal(new Date(2011, 0, 1, 4, 0).getTwoDigitTwelveHour(), '04', '4:00');
assert.equal(new Date(2011, 0, 1, 22, 0).getTwoDigitTwelveHour(), '10', '22:00');
});
test('Date.getTwoDigitHour', function(assert) {
QUnit.test('Date.getTwoDigitHour', function(assert) {
assert.equal(new Date(2014, 6, 1, 9, 0).getTwoDigitHour(), '09', '9:00 am is 09');
assert.equal(new Date(2014, 6, 1, 11, 0).getTwoDigitHour(), '11', '11:00 am is 11');
});
test('Date.getTwoDigitMinute', function(assert) {
QUnit.test('Date.getTwoDigitMinute', function(assert) {
assert.equal(new Date(2014, 6, 1, 0, 5).getTwoDigitMinute(), '05', '12:05 am is 05');
assert.equal(new Date(2014, 6, 1, 0, 15).getTwoDigitMinute(), '15', '12:15 am is 15');
});
test('Date.getTwoDigitSecond', function(assert) {
QUnit.test('Date.getTwoDigitSecond', function(assert) {
assert.equal(new Date(2014, 6, 1, 0, 0, 2).getTwoDigitSecond(), '02', '12:00:02 am is 02');
assert.equal(new Date(2014, 6, 1, 0, 0, 20).getTwoDigitSecond(), '20', '12:00:20 am is 20');
});
test('Date.getHourMinute', function(assert) {
QUnit.test('Date.getHourMinute', function(assert) {
assert.equal(new Date(2014, 6, 1, 11, 0).getHourMinute(), '11:00', '11:00 am is 11:00');
assert.equal(new Date(2014, 6, 1, 13, 25).getHourMinute(), '13:25', '1:25 pm is 13:25');
});
test('Date.getHourMinuteSecond', function(assert) {
QUnit.test('Date.getHourMinuteSecond', function(assert) {
assert.equal(new Date(2014, 6, 1, 11, 0, 0).getHourMinuteSecond(), '11:00:00', '11:00 am is 11:00:00');
assert.equal(new Date(2014, 6, 1, 17, 45, 30).getHourMinuteSecond(), '17:45:30', '5:45:30 pm is 17:45:30');
});
test('Date.strftime', function(assert) {
QUnit.test('Date.strftime', function(assert) {
var date = new Date(2014, 6, 1, 11, 0, 5);
assert.equal(date.strftime('%Y-%m-%d %H:%M:%S'), '2014-07-01 11:00:05');
assert.equal(date.strftime('%B %d, %Y'), 'July 01, 2014');
});
test('String.strptime', function(assert) {
QUnit.test('String.strptime', function(assert) {
// Use UTC functions for extracting dates since the calendar uses them as
// well. Month numbering starts with 0 (January).
var firstParsedDate = '1988-02-26'.strptime('%Y-%m-%d');

View File

@ -1,8 +1,8 @@
/* global module, test */
/* global QUnit */
/* eslint global-strict: 0, strict: 0 */
'use strict';
module('admin.inlines: tabular formsets', {
QUnit.module('admin.inlines: tabular formsets', {
beforeEach: function() {
var $ = django.jQuery;
var that = this;
@ -19,19 +19,19 @@ module('admin.inlines: tabular formsets', {
}
});
test('no forms', function(assert) {
QUnit.test('no forms', function(assert) {
assert.ok(this.inlineRow.hasClass('dynamic-first'));
assert.equal(this.table.find('.add-row a').text(), this.addText);
});
test('add form', function(assert) {
QUnit.test('add form', function(assert) {
var addButton = this.table.find('.add-row a');
assert.equal(addButton.text(), this.addText);
addButton.click();
assert.ok(this.table.find('#first-1').hasClass('row2'));
});
test('add/remove form events', function(assert) {
QUnit.test('add/remove form events', function(assert) {
assert.expect(6);
var $ = django.jQuery;
var $document = $(document);
@ -52,7 +52,7 @@ test('add/remove form events', function(assert) {
deleteLink.click();
});
test('existing add button', function(assert) {
QUnit.test('existing add button', function(assert) {
var $ = django.jQuery;
$('#qunit-fixture').empty(); // Clear the table added in beforeEach
$('#qunit-fixture').append($('#tabular-formset').text());

View File

@ -1,10 +1,10 @@
/* global module, test, parseTimeString */
/* global QUnit, parseTimeString */
/* eslint global-strict: 0, strict: 0 */
'use strict';
module('admin.timeparse');
QUnit.module('admin.timeparse');
test('parseTimeString', function(assert) {
QUnit.test('parseTimeString', function(assert) {
function time(then, expected) {
assert.equal(parseTimeString(then), expected);
}

View File

@ -1,10 +1,10 @@
/* global module, test, MapWidget */
/* global QUnit, MapWidget */
/* eslint global-strict: 0, strict: 0 */
'use strict';
module('gis.OLMapWidget');
QUnit.module('gis.OLMapWidget');
test('MapWidget.featureAdded', function(assert) {
QUnit.test('MapWidget.featureAdded', function(assert) {
var options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
var widget = new MapWidget(options);
assert.equal(widget.layers.vector.features.length, 1);
@ -15,13 +15,13 @@ test('MapWidget.featureAdded', function(assert) {
);
});
test('MapWidget.map_srid', function(assert) {
QUnit.test('MapWidget.map_srid', function(assert) {
var options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
var widget = new MapWidget(options);
assert.equal(widget.options.map_srid, 4326, 'SRID 4326');
});
test('MapWidget.defaultCenter', function(assert) {
QUnit.test('MapWidget.defaultCenter', function(assert) {
var options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
var widget = new MapWidget(options);
assert.equal(widget.defaultCenter().toString(), 'lon=0,lat=0', 'Default center at 0, 0');
@ -35,7 +35,7 @@ test('MapWidget.defaultCenter', function(assert) {
);
});
test('MapWidget.getControls', function(assert) {
QUnit.test('MapWidget.getControls', function(assert) {
var options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
var widget = new MapWidget(options);
widget.getControls(widget.layers.vector);
@ -45,7 +45,7 @@ test('MapWidget.getControls', function(assert) {
assert.equal(widget.controls[2].displayClass, 'olControlModifyFeature', 'Modify control');
});
test('MapWidget.IsCollection', function(assert) {
QUnit.test('MapWidget.IsCollection', function(assert) {
var options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
var widget = new MapWidget(options);
assert.notOk(widget.options.is_collection);

View File

@ -1,12 +1,12 @@
/*!
* QUnit 1.23.1
* QUnit 2.0.1
* https://qunitjs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2016-04-12T17:29Z
* Date: 2016-07-23T19:39Z
*/
/** Font Family and Sizes */
@ -27,7 +27,7 @@
}
/** Header */
/** Header (excluding toolbar) */
#qunit-header {
padding: 0.5em 0 0.5em 1em;
@ -52,51 +52,161 @@
color: #FFF;
}
#qunit-testrunner-toolbar label {
display: inline-block;
padding: 0 0.5em 0 0.1em;
}
#qunit-banner {
height: 5px;
}
#qunit-filteredTest {
padding: 0.5em 1em 0.5em 1em;
color: #366097;
background-color: #F4FF77;
}
#qunit-userAgent {
padding: 0.5em 1em 0.5em 1em;
color: #FFF;
background-color: #2B81AF;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
/** Toolbar */
#qunit-testrunner-toolbar {
padding: 0.5em 1em 0.5em 1em;
color: #5E740B;
background-color: #EEE;
overflow: hidden;
}
#qunit-filteredTest {
padding: 0.5em 1em 0.5em 1em;
background-color: #F4FF77;
color: #366097;
#qunit-testrunner-toolbar .clearfix {
height: 0;
clear: both;
}
#qunit-userAgent {
padding: 0.5em 1em 0.5em 1em;
background-color: #2B81AF;
color: #FFF;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
#qunit-modulefilter-container {
float: right;
padding: 0.2em;
}
.qunit-url-config {
#qunit-testrunner-toolbar label {
display: inline-block;
padding: 0.1em;
}
.qunit-filter {
display: block;
#qunit-testrunner-toolbar input[type=checkbox],
#qunit-testrunner-toolbar input[type=radio] {
margin: 3px;
vertical-align: -2px;
}
#qunit-testrunner-toolbar input[type=text] {
box-sizing: border-box;
height: 1.6em;
}
.qunit-url-config,
.qunit-filter,
#qunit-modulefilter {
display: inline-block;
line-height: 2.1em;
}
.qunit-filter,
#qunit-modulefilter {
float: right;
position: relative;
margin-left: 1em;
}
.qunit-url-config label {
margin-right: 0.5em;
}
#qunit-modulefilter-search {
box-sizing: border-box;
width: 400px;
}
#qunit-modulefilter-search-container:after {
position: absolute;
right: 0.3em;
content: "\25bc";
color: black;
}
#qunit-modulefilter-dropdown {
/* align with #qunit-modulefilter-search */
box-sizing: border-box;
width: 400px;
position: absolute;
right: 0;
top: 50%;
margin-top: 0.8em;
border: 1px solid #D3D3D3;
border-top: none;
border-radius: 0 0 .25em .25em;
color: #000;
background-color: #F5F5F5;
z-index: 99;
}
#qunit-modulefilter-dropdown a {
color: inherit;
text-decoration: none;
}
#qunit-modulefilter-dropdown .clickable.checked {
font-weight: bold;
color: #000;
background-color: #D2E0E6;
}
#qunit-modulefilter-dropdown .clickable:hover {
color: #FFF;
background-color: #0D3349;
}
#qunit-modulefilter-actions {
display: block;
overflow: auto;
/* align with #qunit-modulefilter-dropdown-list */
font: smaller/1.5em sans-serif;
}
#qunit-modulefilter-dropdown #qunit-modulefilter-actions > * {
box-sizing: border-box;
max-height: 2.8em;
display: block;
padding: 0.4em;
}
#qunit-modulefilter-dropdown #qunit-modulefilter-actions > button {
float: right;
font: inherit;
}
#qunit-modulefilter-dropdown #qunit-modulefilter-actions > :last-child {
/* insert padding to align with checkbox margins */
padding-left: 3px;
}
#qunit-modulefilter-dropdown-list {
max-height: 200px;
overflow-y: auto;
margin: 0;
border-top: 2px groove threedhighlight;
padding: 0.4em 0 0;
font: smaller/1.5em sans-serif;
}
#qunit-modulefilter-dropdown-list li {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#qunit-modulefilter-dropdown-list .clickable {
display: block;
padding-left: 0.15em;
}
/** Tests: Pass/Fail */
#qunit-tests {
@ -202,14 +312,14 @@
}
#qunit-tests del {
background-color: #E0F2BE;
color: #374E0C;
background-color: #E0F2BE;
text-decoration: none;
}
#qunit-tests ins {
background-color: #FFCACA;
color: #500;
background-color: #FFCACA;
text-decoration: none;
}

File diff suppressed because it is too large Load Diff