mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #31493 -- Replaced var with const and let keywords in JavaScript.
The eslint configuration and the admin script compress.py have been updated for ES6. The unused fallback of globals.django in jquery.init.js was removed. It is always included before jsi18n-mocks.test.js and it always sets the global value.
This commit is contained in:
committed by
Carlton Gibson
parent
0dafadadb9
commit
5d37cc703b
@@ -5,8 +5,8 @@
|
||||
QUnit.module('gis.OLMapWidget');
|
||||
|
||||
QUnit.test('MapWidget.featureAdded', function(assert) {
|
||||
var options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
|
||||
var widget = new MapWidget(options);
|
||||
const options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
|
||||
const widget = new MapWidget(options);
|
||||
assert.equal(widget.featureCollection.getLength(), 1);
|
||||
widget.serializeFeatures();
|
||||
assert.equal(
|
||||
@@ -17,14 +17,14 @@ QUnit.test('MapWidget.featureAdded', 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);
|
||||
const options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
|
||||
const widget = new MapWidget(options);
|
||||
assert.equal(widget.map.getView().getProjection().getCode(), 'EPSG:3857', 'SRID 3857');
|
||||
});
|
||||
|
||||
QUnit.test('MapWidget.defaultCenter', function(assert) {
|
||||
var options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
|
||||
var widget = new MapWidget(options);
|
||||
const options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
|
||||
let widget = new MapWidget(options);
|
||||
assert.equal(widget.defaultCenter().toString(), '0,0', 'Default center at 0, 0');
|
||||
options.default_lat = 47.08;
|
||||
options.default_lon = 6.81;
|
||||
@@ -38,32 +38,32 @@ QUnit.test('MapWidget.defaultCenter', function(assert) {
|
||||
});
|
||||
|
||||
QUnit.test('MapWidget.interactions', function(assert) {
|
||||
var options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
|
||||
var widget = new MapWidget(options);
|
||||
const options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
|
||||
const widget = new MapWidget(options);
|
||||
assert.equal(Object.keys(widget.interactions).length, 2);
|
||||
assert.equal(widget.interactions.draw.getActive(), false, "Draw is inactive with an existing point");
|
||||
assert.equal(widget.interactions.modify.getActive(), true, "Modify is active with an existing point");
|
||||
});
|
||||
|
||||
QUnit.test('MapWidget.clearFeatures', function(assert) {
|
||||
var options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
|
||||
var widget = new MapWidget(options);
|
||||
var initial_value = document.getElementById('id_point').value;
|
||||
const options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
|
||||
const widget = new MapWidget(options);
|
||||
const initial_value = document.getElementById('id_point').value;
|
||||
widget.clearFeatures();
|
||||
assert.equal(document.getElementById('id_point').value, "");
|
||||
document.getElementById('id_point').value = initial_value;
|
||||
});
|
||||
|
||||
QUnit.test('MapWidget.multipolygon', function(assert) {
|
||||
var options = {id: 'id_multipolygon', map_id: 'id_multipolygon_map', geom_name: 'MultiPolygon'};
|
||||
var widget = new MapWidget(options);
|
||||
const options = {id: 'id_multipolygon', map_id: 'id_multipolygon_map', geom_name: 'MultiPolygon'};
|
||||
const widget = new MapWidget(options);
|
||||
assert.ok(widget.options.is_collection);
|
||||
assert.equal(widget.interactions.draw.getActive(), true, "Draw is active with no existing content");
|
||||
});
|
||||
|
||||
QUnit.test('MapWidget.IsCollection', function(assert) {
|
||||
var options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
|
||||
var widget = new MapWidget(options);
|
||||
const options = {id: 'id_point', map_id: 'id_point_map', geom_name: 'Point'};
|
||||
let widget = new MapWidget(options);
|
||||
assert.notOk(widget.options.is_collection);
|
||||
// Empty the default initial Point
|
||||
document.getElementById('id_point').value = "";
|
||||
|
||||
Reference in New Issue
Block a user