Enforce quotes ESLint rule for the spec directory (#8686)

This commit is contained in:
Jon Koops
2022-11-30 11:59:18 +01:00
committed by GitHub
parent ece2b18444
commit be47f10d5f
40 changed files with 1363 additions and 1364 deletions

View File

@ -1,8 +1,7 @@
/** @type {import('eslint').Linter.Config } */
module.exports = {
rules: {
'no-console': 'off',
'quotes': 'off'
'no-console': 'off'
},
env: {
mocha: true,

View File

@ -6,15 +6,15 @@ module.exports = function (config) {
// var libSources = require(__dirname + '/../build/build.js').getFiles();
const files = [
"spec/before.js",
"src/LeafletWithGlobals.js",
"spec/after.js",
"node_modules/happen/happen.js",
"node_modules/prosthetic-hand/dist/prosthetic-hand.js",
"spec/suites/SpecHelper.js",
"spec/suites/**/*.js",
"dist/*.css",
{pattern: "dist/images/*.png", included: false, serve: true}
'spec/before.js',
'src/LeafletWithGlobals.js',
'spec/after.js',
'node_modules/happen/happen.js',
'node_modules/prosthetic-hand/dist/prosthetic-hand.js',
'spec/suites/SpecHelper.js',
'spec/suites/**/*.js',
'dist/*.css',
{pattern: 'dist/images/*.png', included: false, serve: true}
];
const preprocessors = {};

View File

@ -58,7 +58,7 @@ const touchEventType = L.Browser.touchNative ? 'touch' : 'pointer'; // eslint-di
function createContainer(width, height) { /* eslint-disable-line no-unused-vars */
width = width ? width : '400px';
height = height ? height : '400px';
const container = document.createElement("div");
const container = document.createElement('div');
container.style.position = 'absolute';
container.style.top = '0px';
container.style.left = '0px';

View File

@ -1,4 +1,4 @@
describe("Control.Attribution", () => {
describe('Control.Attribution', () => {
let map, control, container, controlContainer;
beforeEach(() => {
@ -23,7 +23,7 @@ describe("Control.Attribution", () => {
return layer;
}
it("contains just prefix if no attributions added", () => {
it('contains just prefix if no attributions added', () => {
expect(controlContainer.innerHTML).to.eql('prefix');
});

View File

@ -1,4 +1,4 @@
describe("Control.Layers", () => {
describe('Control.Layers', () => {
let container, map;
beforeEach(() => {
@ -12,25 +12,25 @@ describe("Control.Layers", () => {
removeMapContainer(map, container);
});
describe("baselayerchange event", () => {
it("is fired on input that changes the base layer", () => {
const baseLayers = {"Layer 1": L.tileLayer(''), "Layer 2": L.tileLayer('')},
describe('baselayerchange event', () => {
it('is fired on input that changes the base layer', () => {
const baseLayers = {'Layer 1': L.tileLayer(''), 'Layer 2': L.tileLayer('')},
layers = L.control.layers(baseLayers).addTo(map),
spy = sinon.spy();
map.on('baselayerchange', spy);
happen.click(layers._baseLayersList.getElementsByTagName("input")[0]);
happen.click(layers._baseLayersList.getElementsByTagName('input')[0]);
expect(spy.called).to.be.ok();
expect(spy.args[0][0].name).to.be("Layer 1");
expect(spy.args[0][0].layer).to.be(baseLayers["Layer 1"]);
happen.click(layers._baseLayersList.getElementsByTagName("input")[1]);
expect(spy.args[0][0].name).to.be('Layer 1');
expect(spy.args[0][0].layer).to.be(baseLayers['Layer 1']);
happen.click(layers._baseLayersList.getElementsByTagName('input')[1]);
expect(spy.calledTwice).to.be.ok();
expect(spy.args[1][0].name).to.be("Layer 2");
expect(spy.args[1][0].layer).to.be(baseLayers["Layer 2"]);
expect(spy.args[1][0].name).to.be('Layer 2');
expect(spy.args[1][0].layer).to.be(baseLayers['Layer 2']);
});
it("works after removing and readding the Control.Layers to the map", () => {
const baseLayers = {"Layer 1": L.tileLayer(''), "Layer 2": L.tileLayer('')},
it('works after removing and readding the Control.Layers to the map', () => {
const baseLayers = {'Layer 1': L.tileLayer(''), 'Layer 2': L.tileLayer('')},
layers = L.control.layers(baseLayers).addTo(map),
spy = sinon.spy();
@ -39,33 +39,33 @@ describe("Control.Layers", () => {
map.removeControl(layers);
map.addControl(layers);
happen.click(layers._baseLayersList.getElementsByTagName("input")[0]);
happen.click(layers._baseLayersList.getElementsByTagName('input')[0]);
expect(spy.called).to.be.ok();
expect(spy.args[0][0].name).to.be("Layer 1");
expect(spy.args[0][0].layer).to.be(baseLayers["Layer 1"]);
happen.click(layers._baseLayersList.getElementsByTagName("input")[1]);
expect(spy.args[0][0].name).to.be('Layer 1');
expect(spy.args[0][0].layer).to.be(baseLayers['Layer 1']);
happen.click(layers._baseLayersList.getElementsByTagName('input')[1]);
expect(spy.calledTwice).to.be.ok();
expect(spy.args[1][0].name).to.be("Layer 2");
expect(spy.args[1][0].layer).to.be(baseLayers["Layer 2"]);
expect(spy.args[1][0].name).to.be('Layer 2');
expect(spy.args[1][0].layer).to.be(baseLayers['Layer 2']);
});
it("is not fired on input that doesn't change the base layer", () => {
const overlays = {"Marker 1": L.marker([0, 0]), "Marker 2": L.marker([0, 0])},
it('is not fired on input that doesn\'t change the base layer', () => {
const overlays = {'Marker 1': L.marker([0, 0]), 'Marker 2': L.marker([0, 0])},
layers = L.control.layers({}, overlays).addTo(map),
spy = sinon.spy();
map.on('baselayerchange', spy);
happen.click(layers._overlaysList.getElementsByTagName("input")[0]);
happen.click(layers._overlaysList.getElementsByTagName('input')[0]);
expect(spy.called).to.not.be.ok();
});
});
describe("updates", () => {
it("when an included layer is added or removed from the map", () => {
describe('updates', () => {
it('when an included layer is added or removed from the map', () => {
const baseLayer = L.tileLayer(),
overlay = L.marker([0, 0]),
layers = L.control.layers({"Base": baseLayer}, {"Overlay": overlay}).addTo(map);
layers = L.control.layers({'Base': baseLayer}, {'Overlay': overlay}).addTo(map);
const spy = sinon.spy(layers, '_update');
@ -76,10 +76,10 @@ describe("Control.Layers", () => {
expect(spy.callCount).to.eql(2);
});
it("when an included layer is added or removed from the map, it's (un)checked", () => {
it('when an included layer is added or removed from the map, it\'s (un)checked', () => {
const baseLayer = L.tileLayer(),
overlay = L.marker([0, 0]);
L.control.layers({"Baselayer": baseLayer}, {"Overlay": overlay}).addTo(map);
L.control.layers({'Baselayer': baseLayer}, {'Overlay': overlay}).addTo(map);
function isChecked() {
return !!(map._container.querySelector('.leaflet-control-layers-overlays input').checked);
@ -92,10 +92,10 @@ describe("Control.Layers", () => {
expect(isChecked()).to.not.be.ok();
});
it("not when a non-included layer is added or removed", () => {
it('not when a non-included layer is added or removed', () => {
const baseLayer = L.tileLayer(),
overlay = L.marker([0, 0]),
layers = L.control.layers({"Base": baseLayer}).addTo(map);
layers = L.control.layers({'Base': baseLayer}).addTo(map);
const spy = sinon.spy(layers, '_update');
@ -105,10 +105,10 @@ describe("Control.Layers", () => {
expect(spy.called).to.not.be.ok();
});
it("updates when an included layer is removed from the control", () => {
it('updates when an included layer is removed from the control', () => {
const baseLayer = L.tileLayer(),
overlay = L.marker([0, 0]),
layers = L.control.layers({"Base": baseLayer}, {"Overlay": overlay}).addTo(map);
layers = L.control.layers({'Base': baseLayer}, {'Overlay': overlay}).addTo(map);
layers.removeLayer(overlay);
expect(map._container.querySelector('.leaflet-control-layers-overlays').children.length)
@ -125,9 +125,9 @@ describe("Control.Layers", () => {
expect(layers._layers.length).to.be.equal(1);
});
it("having repeated layers works as expected", () => {
it('having repeated layers works as expected', () => {
const layerA = L.tileLayer(''), layerB = L.tileLayer(''),
baseLayers = {"Layer 1": layerA, "Layer 2": layerB, "Layer 3": layerA},
baseLayers = {'Layer 1': layerA, 'Layer 2': layerB, 'Layer 3': layerA},
layers = L.control.layers(baseLayers).addTo(map);
function checkInputs(idx) {
@ -137,23 +137,23 @@ describe("Control.Layers", () => {
}
}
happen.click(layers._baseLayersList.getElementsByTagName("input")[1]);
happen.click(layers._baseLayersList.getElementsByTagName('input')[1]);
checkInputs(1);
expect(map._layers[L.Util.stamp(layerB)]).to.be.equal(layerB);
expect(map._layers[L.Util.stamp(layerA)]).to.be.equal(undefined);
happen.click(layers._baseLayersList.getElementsByTagName("input")[0]);
happen.click(layers._baseLayersList.getElementsByTagName('input')[0]);
checkInputs(0);
expect(map._layers[L.Util.stamp(layerA)]).to.be.equal(layerA);
expect(map._layers[L.Util.stamp(layerB)]).to.be.equal(undefined);
happen.click(layers._baseLayersList.getElementsByTagName("input")[2]);
happen.click(layers._baseLayersList.getElementsByTagName('input')[2]);
checkInputs(2);
expect(map._layers[L.Util.stamp(layerA)]).to.be.equal(layerA);
expect(map._layers[L.Util.stamp(layerB)]).to.be.equal(undefined);
});
});
describe("is removed cleanly", () => {
it("and layers in the control can still be removed", () => {
describe('is removed cleanly', () => {
it('and layers in the control can still be removed', () => {
const baseLayer = L.tileLayer('').addTo(map);
const layersCtrl = L.control.layers({'Base': baseLayer}).addTo(map);
map.removeControl(layersCtrl);
@ -163,7 +163,7 @@ describe("Control.Layers", () => {
}).to.not.throwException();
});
it("and layers in the control can still be removed when added after removing control from map", () => {
it('and layers in the control can still be removed when added after removing control from map', () => {
const baseLayer = L.tileLayer('').addTo(map);
const layersCtrl = L.control.layers().addTo(map);
map.removeControl(layersCtrl);
@ -175,19 +175,19 @@ describe("Control.Layers", () => {
});
});
describe("is created with an expand link", () => {
it("when collapsed", () => {
describe('is created with an expand link', () => {
it('when collapsed', () => {
L.control.layers(null, null, {collapsed: true}).addTo(map);
expect(map._container.querySelector('.leaflet-control-layers-toggle')).to.be.ok();
});
it("when not collapsed", () => {
it('when not collapsed', () => {
L.control.layers(null, null, {collapsed: false}).addTo(map);
expect(map._container.querySelector('.leaflet-control-layers-toggle')).to.be.ok();
});
});
describe("collapse when collapsed: true", () => {
describe('collapse when collapsed: true', () => {
it('expands on "Enter" keydown when toggle is focused', () => {
const layersCtrl = L.control.layers(null, null, {collapsed: true}).addTo(map);
const toggle = layersCtrl._container.querySelector('.leaflet-control-layers-toggle');
@ -230,7 +230,7 @@ describe("Control.Layers", () => {
});
});
describe("does not collapse when collapsed: false", () => {
describe('does not collapse when collapsed: false', () => {
it('does not collapse when mouse enters or leaves', () => {
const layersCtrl = L.control.layers(null, null, {collapsed: false}).addTo(map);
expect(map._container.querySelector('.leaflet-control-layers-expanded')).to.be.ok();
@ -292,8 +292,8 @@ describe("Control.Layers", () => {
});
});
describe("sortLayers", () => {
it("keeps original order by default", () => {
describe('sortLayers', () => {
it('keeps original order by default', () => {
const baseLayerOne = L.tileLayer('').addTo(map);
const baseLayerTwo = L.tileLayer('').addTo(map);
const markerC = L.marker([0, 2]).addTo(map);
@ -317,7 +317,7 @@ describe("Control.Layers", () => {
expect(elems[4].innerHTML.trim()).to.be.equal('Marker A');
});
it("sorts alphabetically if no function is specified", () => {
it('sorts alphabetically if no function is specified', () => {
const baseLayerOne = L.tileLayer('').addTo(map);
const baseLayerTwo = L.tileLayer('').addTo(map);
const markerA = L.marker([0, 0]).addTo(map);
@ -343,7 +343,7 @@ describe("Control.Layers", () => {
expect(elems[4].innerHTML.trim()).to.be.equal('Marker C');
});
it("uses the compare function to sort layers", () => {
it('uses the compare function to sort layers', () => {
const baseLayerOne = L.tileLayer('', {customOption: 999}).addTo(map);
const baseLayerTwo = L.tileLayer('', {customOption: 998}).addTo(map);
const markerA = L.marker([0, 0], {customOption: 102}).addTo(map);

View File

@ -1,5 +1,5 @@
describe("Control.Scale", () => {
it("can be added to an unloaded map", () => {
describe('Control.Scale', () => {
it('can be added to an unloaded map', () => {
const map = L.map(document.createElement('div'));
new L.Control.Scale().addTo(map);
});

View File

@ -1,4 +1,4 @@
describe("Control", () => {
describe('Control', () => {
function onAdd() {
return L.DomUtil.create('div', 'leaflet-test-control');
}
@ -21,31 +21,31 @@ describe("Control", () => {
removeMapContainer(map, container);
});
describe("#addTo", () => {
it("adds the container to the map", () => {
describe('#addTo', () => {
it('adds the container to the map', () => {
expect(map.getContainer().querySelector('.leaflet-test-control')).to.equal(control.getContainer());
});
it("removes the control from any existing map", () => {
it('removes the control from any existing map', () => {
control.addTo(map);
expect(map.getContainer().querySelectorAll('.leaflet-test-control').length).to.equal(1);
expect(map.getContainer().querySelector('.leaflet-test-control')).to.equal(control.getContainer());
});
});
describe("#remove", () => {
it("removes the container from the map", () => {
describe('#remove', () => {
it('removes the container from the map', () => {
control.remove();
expect(map.getContainer().querySelector('.leaflet-test-control')).to.equal(null);
});
it("calls onRemove if defined", () => {
it('calls onRemove if defined', () => {
control.onRemove = sinon.spy();
control.remove();
expect(control.onRemove.called).to.be(true);
});
it("is a no-op if the control has not been added", () => {
it('is a no-op if the control has not been added', () => {
const control = new L.Control();
expect(control.remove()).to.equal(control);
});

View File

@ -1,6 +1,6 @@
/* eslint no-new: 0 */
describe("Class", () => {
describe("#extend", () => {
describe('Class', () => {
describe('#extend', () => {
let Klass,
props,
constructor,
@ -21,7 +21,7 @@ describe("Class", () => {
Klass = L.Class.extend(props);
});
it("creates a class with the given constructor & properties", () => {
it('creates a class with the given constructor & properties', () => {
const a = new Klass();
expect(constructor.called).to.be.ok();
@ -32,7 +32,7 @@ describe("Class", () => {
expect(method.called).to.be.ok();
});
it("inherits parent classes' constructor & properties", () => {
it('inherits parent classes\' constructor & properties', () => {
const Klass2 = Klass.extend({baz: 2});
const b = new Klass2();
@ -48,7 +48,7 @@ describe("Class", () => {
expect(method.called).to.be.ok();
});
it("does not modify source props object", () => {
it('does not modify source props object', () => {
expect(props).to.eql({
statics: {bla: 1},
includes: {mixin: true},
@ -59,36 +59,36 @@ describe("Class", () => {
});
});
it("supports static properties", () => {
it('supports static properties', () => {
expect(Klass.bla).to.eql(1);
});
it("does not merge 'statics' property itself", () => {
it('does not merge \'statics\' property itself', () => {
expect('statics' in Klass.prototype).to.not.be.ok();
});
it("inherits parent static properties", () => {
it('inherits parent static properties', () => {
const Klass2 = Klass.extend({});
expect(Klass2.bla).to.eql(1);
});
it("overrides parent static properties", () => {
it('overrides parent static properties', () => {
const Klass2 = Klass.extend({statics: {bla: 2}});
expect(Klass2.bla).to.eql(2);
});
it("includes the given mixin", () => {
it('includes the given mixin', () => {
const a = new Klass();
expect(a.mixin).to.be.ok();
});
it("does not merge 'includes' property itself", () => {
it('does not merge \'includes\' property itself', () => {
expect('includes' in Klass.prototype).to.not.be.ok();
});
it("includes multiple mixins", () => {
it('includes multiple mixins', () => {
const Klass2 = L.Class.extend({
includes: [{mixin: true}, {mixin2: true}]
});
@ -98,14 +98,14 @@ describe("Class", () => {
expect(a.mixin2).to.be.ok();
});
it("grants the ability to include the given mixin", () => {
it('grants the ability to include the given mixin', () => {
Klass.include({mixin2: true});
const a = new Klass();
expect(a.mixin2).to.be.ok();
});
it("merges options instead of replacing them", () => {
it('merges options instead of replacing them', () => {
const KlassWithOptions1 = L.Class.extend({
options: {
foo1: 1,
@ -125,27 +125,27 @@ describe("Class", () => {
expect(a.options.foo3).to.eql(4);
});
it("gives new classes a distinct options object", () => {
it('gives new classes a distinct options object', () => {
const K1 = L.Class.extend({options: {}});
const K2 = K1.extend({});
expect(K2.prototype.options).not.to.equal(K1.prototype.options);
});
it("inherits options prototypally", () => {
it('inherits options prototypally', () => {
const K1 = L.Class.extend({options: {}});
const K2 = K1.extend({options: {}});
K1.prototype.options.foo = 'bar';
expect(K2.prototype.options.foo).to.eql('bar');
});
it("does not reuse original props.options", () => {
it('does not reuse original props.options', () => {
const props = {options: {}};
const K = L.Class.extend(props);
expect(K.prototype.options).not.to.be(props.options);
});
it("does not replace source props.options object", () => {
it('does not replace source props.options object', () => {
const K1 = L.Class.extend({options: {}});
const opts = {};
const props = {options: opts};
@ -154,13 +154,13 @@ describe("Class", () => {
expect(props.options).to.be(opts);
});
it("prevents change of prototype options", () => {
it('prevents change of prototype options', () => {
const Klass = L.Class.extend({options: {}});
const instance = new Klass();
expect(Klass.prototype.options).to.not.be(instance.options);
});
it("adds constructor hooks correctly", () => {
it('adds constructor hooks correctly', () => {
const spy1 = sinon.spy();
Klass.addInitHook(spy1);
@ -172,7 +172,7 @@ describe("Class", () => {
expect(method.calledWith(1, 2, 3));
});
it("inherits constructor hooks", () => {
it('inherits constructor hooks', () => {
const spy1 = sinon.spy(),
spy2 = sinon.spy();
@ -187,7 +187,7 @@ describe("Class", () => {
expect(spy2.called).to.be.ok();
});
it("does not call child constructor hooks", () => {
it('does not call child constructor hooks', () => {
const spy1 = sinon.spy(),
spy2 = sinon.spy();
@ -202,7 +202,7 @@ describe("Class", () => {
expect(spy2.called).to.eql(false);
});
it("calls parent constructor hooks when child has none", () => {
it('calls parent constructor hooks when child has none', () => {
const spy1 = sinon.spy();
Klass.addInitHook(spy1);
@ -214,14 +214,14 @@ describe("Class", () => {
});
});
describe("#include", () => {
describe('#include', () => {
let Klass;
beforeEach(() => {
Klass = L.Class.extend({});
});
it("returns the class with the extra methods", () => {
it('returns the class with the extra methods', () => {
const q = sinon.spy();
@ -237,7 +237,7 @@ describe("Class", () => {
expect(q.called).to.be.ok();
});
it("keeps parent options", () => { // #6070
it('keeps parent options', () => { // #6070
const Quux = L.Class.extend({
options: {foo: 'Foo!'}
@ -252,14 +252,14 @@ describe("Class", () => {
expect(q.options).to.have.property('bar');
});
it("does not reuse original props.options", () => {
it('does not reuse original props.options', () => {
const props = {options: {}};
const K = Klass.include(props);
expect(K.prototype.options).not.to.be(props.options);
});
it("does not replace source props.options object", () => {
it('does not replace source props.options object', () => {
const K1 = Klass.include({options: {}});
const opts = {};
const props = {options: opts};

View File

@ -453,18 +453,18 @@ describe('Events', () => {
spy = sinon.spy();
/* register without context */
obj.on("test", spy);
obj.on("test", spy);
obj.on('test', spy);
obj.on('test', spy);
/* Should be called once */
obj.fire("test");
obj.fire('test');
expect(spy.callCount).to.eql(1);
});
});
describe("#clearEventListeners", () => {
it("clears all registered listeners on an object", () => {
describe('#clearEventListeners', () => {
it('clears all registered listeners on an object', () => {
const spy = sinon.spy(),
obj = new L.Evented(),
otherObj = new L.Evented();
@ -518,7 +518,7 @@ describe('Events', () => {
expect(otherSpy.callCount).to.be.lessThan(2);
});
it("doesn't call listeners to events that have been removed", () => {
it('doesn\'t call listeners to events that have been removed', () => {
const obj = new L.Evented(),
spy = sinon.spy();
@ -530,7 +530,7 @@ describe('Events', () => {
expect(spy.called).to.be(false);
});
it("doesn't call once twice", () => {
it('doesn\'t call once twice', () => {
const obj = new L.Evented(),
spy = sinon.spy();
obj.once('test', () => {

View File

@ -160,7 +160,7 @@ describe('Util', () => {
expect(o.options).not.to.equal(opts);
});
it("doesn't create a distinct options object if object already has own options", () => {
it('doesn\'t create a distinct options object if object already has own options', () => {
const opts = {},
o = {options: opts};
L.Util.setOptions(o, {});

View File

@ -31,63 +31,63 @@ describe('DomUtil', () => {
expect(L.DomUtil.getStyle(el, 'color')).to.eql('green');
});
it("returns empty string if style isn't defined", () => {
it('returns empty string if style isn\'t defined', () => {
const e = document.createElement('div');
expect(L.DomUtil.getStyle(e, "position")).to.be('');
expect(L.DomUtil.getStyle(e, 'position')).to.be('');
});
it("returns undefined if style don't exist on HTML element or default css", () => {
expect(L.DomUtil.getStyle(el, "random_name_for_style")).to.be(undefined);
it('returns undefined if style don\'t exist on HTML element or default css', () => {
expect(L.DomUtil.getStyle(el, 'random_name_for_style')).to.be(undefined);
});
});
describe("#create", () => {
it("creates an HTML element div without any class name", () => {
const e = L.DomUtil.create("div");
describe('#create', () => {
it('creates an HTML element div without any class name', () => {
const e = L.DomUtil.create('div');
expect(e.className).to.eql('');
expect(e.tagName).to.eql("DIV");
expect(e.tagName).to.eql('DIV');
});
it("creates an HTML element div with specified class name", () => {
const e = L.DomUtil.create("div", "test");
it('creates an HTML element div with specified class name', () => {
const e = L.DomUtil.create('div', 'test');
expect(e.className).to.eql('test');
expect(e.tagName).to.eql("DIV");
expect(e.tagName).to.eql('DIV');
});
it("creates an p element with a div as parent", () => {
const parent = L.DomUtil.create("div");
it('creates an p element with a div as parent', () => {
const parent = L.DomUtil.create('div');
expect(parent.children.length).to.equal(0);
const child = L.DomUtil.create("p", "test", parent);
const child = L.DomUtil.create('p', 'test', parent);
expect(child.parentNode === parent).to.be(true);
expect(parent.children.length).to.equal(1);
});
});
describe("#remove", () => {
it("removes element", () => {
const e = L.DomUtil.create("div", "test", el);
describe('#remove', () => {
it('removes element', () => {
const e = L.DomUtil.create('div', 'test', el);
L.DomUtil.remove(e);
expect(el.contains(e)).to.be(false);
});
it("does nothing if element hasn't a parent", () => {
const e = L.DomUtil.create("div", "test");
it('does nothing if element hasn\'t a parent', () => {
const e = L.DomUtil.create('div', 'test');
L.DomUtil.remove(e);
expect(document.body.contains(e)).to.be(false);
});
});
describe("#empty", () => {
it("removes all children of element", () => {
L.DomUtil.create("div", "test", el);
L.DomUtil.create("div", "test1", el);
L.DomUtil.create("div", "test2", el);
describe('#empty', () => {
it('removes all children of element', () => {
L.DomUtil.create('div', 'test', el);
L.DomUtil.create('div', 'test1', el);
L.DomUtil.create('div', 'test2', el);
L.DomUtil.empty(el);
expect(el.childNodes.length).to.be(0);
});
it("does nothing if element doesn't have children", () => {
it('does nothing if element doesn\'t have children', () => {
expect(el.childNodes.length).to.be(0);
L.DomUtil.empty(el);
expect(el.childNodes.length).to.be(0);
@ -97,33 +97,33 @@ describe('DomUtil', () => {
describe('#toFront', () => {
it('moves el to last child position parent element', () => {
const elm = L.DomUtil.create('div', 'childContainer', el);
L.DomUtil.create("div", "test", el);
L.DomUtil.create("div", "test1", el);
L.DomUtil.create('div', 'test', el);
L.DomUtil.create('div', 'test1', el);
expect(el.children.length).to.equal(3);
expect(Array.from(el.children).indexOf(elm)).to.be(0);
L.DomUtil.toFront(elm);
expect(Array.from(el.children).indexOf(elm)).to.be(2);
});
it("doesn't move an element if he's already in the front", () => {
L.DomUtil.create("div", "test", el);
L.DomUtil.create("div", "test1", el);
const e1 = L.DomUtil.create("div", "test2", el);
it('doesn\'t move an element if he\'s already in the front', () => {
L.DomUtil.create('div', 'test', el);
L.DomUtil.create('div', 'test1', el);
const e1 = L.DomUtil.create('div', 'test2', el);
expect(el.lastChild).to.eql(e1);
L.DomUtil.toFront(e1);
expect(el.lastChild).to.eql(e1);
});
it("doesn't crash if element doesn't have a parent", () => {
const e = L.DomUtil.create("div");
it('doesn\'t crash if element doesn\'t have a parent', () => {
const e = L.DomUtil.create('div');
L.DomUtil.toFront(e);
});
});
describe('#toBack', () => {
it('moves el to first child position parent element', () => {
L.DomUtil.create("div", "test", el);
L.DomUtil.create("div", "test1", el);
L.DomUtil.create('div', 'test', el);
L.DomUtil.create('div', 'test1', el);
const elm = L.DomUtil.create('div', 'childContainer', el);
expect(el.children.length).to.equal(3);
expect(Array.from(el.children).indexOf(elm)).to.be(2);
@ -131,17 +131,17 @@ describe('DomUtil', () => {
expect(Array.from(el.children).indexOf(elm)).to.be(0);
});
it("doesn't move an element if it is already in the back", () => {
const e1 = L.DomUtil.create("div", "test", el);
L.DomUtil.create("div", "test1", el);
L.DomUtil.create("div", "test2", el);
it('doesn\'t move an element if it is already in the back', () => {
const e1 = L.DomUtil.create('div', 'test', el);
L.DomUtil.create('div', 'test1', el);
L.DomUtil.create('div', 'test2', el);
expect(el.firstChild).to.be(e1);
L.DomUtil.toBack(el);
expect(el.firstChild).to.be(e1);
});
it("doesn't crash if an element doesn't have a parent", () => {
const e = L.DomUtil.create("div");
it('doesn\'t crash if an element doesn\'t have a parent', () => {
const e = L.DomUtil.create('div');
L.DomUtil.toBack(e);
});
});
@ -242,16 +242,16 @@ describe('DomUtil', () => {
expect(el.style.opacity).to.equal('0');
});
it("replaces the class of SGV element by the specified argument", () => {
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
L.DomUtil.setClass(svg, "testclass");
expect(svg.className.baseVal).to.be("testclass");
it('replaces the class of SGV element by the specified argument', () => {
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
L.DomUtil.setClass(svg, 'testclass');
expect(svg.className.baseVal).to.be('testclass');
});
it("gets the class name of SVG element", () => {
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svg.className.baseVal = "testclass";
expect(L.DomUtil.getClass(svg)).to.be("testclass");
it('gets the class name of SVG element', () => {
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
svg.className.baseVal = 'testclass';
expect(L.DomUtil.getClass(svg)).to.be('testclass');
});
it('returns empty string if it has no classes', () => {
@ -265,13 +265,13 @@ describe('DomUtil', () => {
expect(hasProp).to.match(/(?:-webkit-transform|-webkit-transform|-ms-tranform|-o-transform)/);
});
it("returns false if property doesn't exist", () => {
expect(L.DomUtil.testProp(["testprop"])).to.be(false);
it('returns false if property doesn\'t exist', () => {
expect(L.DomUtil.testProp(['testprop'])).to.be(false);
});
});
describe('#setTransform', () => {
it("resets the transform style of an el.", () => {
it('resets the transform style of an el.', () => {
expect(L.DomUtil.getStyle(el, 'transform')).to.be.equal('none');
const offset = L.point(200, 200);
@ -286,29 +286,29 @@ describe('DomUtil', () => {
expect(L.DomUtil.getStyle(el, 'transform')).to.not.be.equal(transform);
});
it("reset the 3d CSS transform when offset and scale aren't specified", () => {
it('reset the 3d CSS transform when offset and scale aren\'t specified', () => {
L.DomUtil.setTransform(el);
expect(el.style[L.DomUtil.TRANSFORM]).to.be('translate3d(0px, 0px, 0px)');
});
it("set the 3d CSS transform with just the specified point if scale isn't specified", () => {
it('set the 3d CSS transform with just the specified point if scale isn\'t specified', () => {
L.DomUtil.setTransform(el, new L.Point(1, 1));
expect(el.style[L.DomUtil.TRANSFORM]).to.be('translate3d(1px, 1px, 0px)');
});
it("set 3d CSS transform to translate3d(0px, 0px, 0) and add to it scale(${scalevalue}) if only scale is specified", () => {
it('set 3d CSS transform to translate3d(0px, 0px, 0) and add to it scale(${scalevalue}) if only scale is specified', () => {
L.DomUtil.setTransform(el, undefined, 5);
expect(el.style[L.DomUtil.TRANSFORM]).to.be('translate3d(0px, 0px, 0px) scale(5)');
});
it("set the 3d CSS transform with the specified point ant the corresponding scale", () => {
it('set the 3d CSS transform with the specified point ant the corresponding scale', () => {
L.DomUtil.setTransform(el, new L.Point(1, 1), 5);
expect(el.style[L.DomUtil.TRANSFORM]).to.be('translate3d(1px, 1px, 0px) scale(5)');
});
});
describe('#setPosition, #getPosition', () => {
it("sets position of el to coordinates specified by position.", () => {
it('sets position of el to coordinates specified by position.', () => {
expect(L.DomUtil.getStyle(el, 'left')).to.be.equal('0px');
expect(L.DomUtil.getStyle(el, 'top')).to.be.equal('0px');
@ -325,7 +325,7 @@ describe('DomUtil', () => {
expect(L.DomUtil.getPosition(el)).to.be.eql({x: newX, y: newY});
});
it("returns position of an element positioned with setPosition.", () => {
it('returns position of an element positioned with setPosition.', () => {
const coordinates = {x: 333, y: 666};
const position = L.point(coordinates);
expect(L.DomUtil.getPosition(el)).to.not.eql(coordinates);
@ -334,7 +334,7 @@ describe('DomUtil', () => {
expect(L.DomUtil.getPosition(el)).to.eql(coordinates);
});
it("returns [0, 0] point if the HTML element wasn't positioned before", () => {
it('returns [0, 0] point if the HTML element wasn\'t positioned before', () => {
expect(L.DomUtil.getPosition(el)).to.eql(new L.Point(0, 0));
});
});
@ -349,7 +349,7 @@ describe('DomUtil', () => {
expect(L.DomUtil.getSizedParentNode(grandChild)).to.eql(child);
});
it("throws an error if the element hasn't a parent", () => {
it('throws an error if the element hasn\'t a parent', () => {
expect(() => {
L.DomUtil.getSizedParentNode(document.createElement('div'));
}).to.throwException();
@ -388,8 +388,8 @@ describe('DomUtil', () => {
expect(L.DomUtil.getScale(childEl).boundingClientRect.bottom).to.not.be.equal(scale.boundingClientRect.bottom);
});
it("returns x and y to 1 with all boundingClientRect's values to 0 for empty element not added yet to the body", () => {
const newElement = document.createElement("div");
it('returns x and y to 1 with all boundingClientRect\'s values to 0 for empty element not added yet to the body', () => {
const newElement = document.createElement('div');
const scale = L.DomUtil.getScale(newElement);
expect(scale.x).to.eql(1);
expect(scale.y).to.eql(1);

View File

@ -76,11 +76,11 @@ describe('LatLngBounds', () => {
expect(a.equals(null)).to.eql(false);
});
it("returns true if compared objects are equal within a certain margin", () => {
it('returns true if compared objects are equal within a certain margin', () => {
expect(a.equals([[15, 11], [29, 41]], 1)).to.eql(true);
});
it("returns false if compared objects are not equal within a certain margin", () => {
it('returns false if compared objects are not equal within a certain margin', () => {
expect(a.equals([[15, 11], [29, 41]], 0.5)).to.eql(false);
});
});
@ -126,7 +126,7 @@ describe('LatLngBounds', () => {
describe('#toBBoxString', () => {
it('returns a proper left,bottom,right,top bbox', () => {
expect(a.toBBoxString()).to.eql("12,14,40,30");
expect(a.toBBoxString()).to.eql('12,14,40,30');
});
});

View File

@ -1,6 +1,6 @@
describe('LatLng', () => {
describe('constructor', () => {
it("sets lat and lng", () => {
it('sets lat and lng', () => {
const a = L.latLng(25, 74);
expect(a.lat).to.eql(25);
expect(a.lng).to.eql(74);
@ -31,13 +31,13 @@ describe('LatLng', () => {
});
describe('#equals', () => {
it("returns true if compared objects are equal within a certain margin", () => {
it('returns true if compared objects are equal within a certain margin', () => {
const a = L.latLng(10, 20);
const b = L.latLng(10 + 1.0E-10, 20 - 1.0E-10);
expect(a.equals(b)).to.eql(true);
});
it("returns false if compared objects are not equal within a certain margin", () => {
it('returns false if compared objects are not equal within a certain margin', () => {
const a = L.latLng(10, 20);
const b = L.latLng(10, 23.3);
expect(a.equals(b)).to.eql(false);

View File

@ -1,27 +1,27 @@
describe("CRS.EPSG3857", () => {
describe('CRS.EPSG3857', () => {
const crs = L.CRS.EPSG3857;
describe("#latLngToPoint", () => {
it("projects a center point", () => {
describe('#latLngToPoint', () => {
it('projects a center point', () => {
expect(crs.latLngToPoint(L.latLng(0, 0), 0)).near([128, 128], 0.01);
});
it("projects the northeast corner of the world", () => {
it('projects the northeast corner of the world', () => {
expect(crs.latLngToPoint(L.latLng(85.0511287798, 180), 0)).near([256, 0]);
});
});
describe("#pointToLatLng", () => {
it("reprojects a center point", () => {
describe('#pointToLatLng', () => {
it('reprojects a center point', () => {
expect(crs.pointToLatLng(L.point(128, 128), 0)).nearLatLng([0, 0], 0.01);
});
it("reprojects the northeast corner of the world", () => {
it('reprojects the northeast corner of the world', () => {
expect(crs.pointToLatLng(L.point(256, 0), 0)).nearLatLng([85.0511287798, 180]);
});
});
describe("project", () => {
describe('project', () => {
it('projects geo coords into meter coords correctly', () => {
expect(crs.project(L.latLng(50, 30))).near([3339584.7238, 6446275.84102]);
expect(crs.project(L.latLng(85.0511287798, 180))).near([20037508.34279, 20037508.34278]);
@ -29,7 +29,7 @@ describe("CRS.EPSG3857", () => {
});
});
describe("unproject", () => {
describe('unproject', () => {
it('unprojects meter coords into geo coords correctly', () => {
expect(crs.unproject(L.point(3339584.7238, 6446275.84102))).nearLatLng([50, 30]);
expect(crs.unproject(L.point(20037508.34279, 20037508.34278))).nearLatLng([85.051129, 180]);
@ -37,8 +37,8 @@ describe("CRS.EPSG3857", () => {
});
});
describe("#getProjectedBounds", () => {
it("gives correct size", () => {
describe('#getProjectedBounds', () => {
it('gives correct size', () => {
let i,
worldSize = 256,
crsSize;
@ -52,7 +52,7 @@ describe("CRS.EPSG3857", () => {
});
describe('#wrapLatLng', () => {
it("wraps longitude to lie between -180 and 180 by default", () => {
it('wraps longitude to lie between -180 and 180 by default', () => {
expect(crs.wrapLatLng(L.latLng(0, 190)).lng).to.eql(-170);
expect(crs.wrapLatLng(L.latLng(0, 360)).lng).to.eql(0);
expect(crs.wrapLatLng(L.latLng(0, 380)).lng).to.eql(20);
@ -63,7 +63,7 @@ describe("CRS.EPSG3857", () => {
expect(crs.wrapLatLng(L.latLng(0, 180)).lng).to.eql(180);
});
it("does not drop altitude", () => {
it('does not drop altitude', () => {
expect(crs.wrapLatLng(L.latLng(0, 190, 1234)).lng).to.eql(-170);
expect(crs.wrapLatLng(L.latLng(0, 190, 1234)).alt).to.eql(1234);
@ -73,7 +73,7 @@ describe("CRS.EPSG3857", () => {
});
describe('#wrapLatLngBounds', () => {
it("does not wrap bounds between -180 and 180 longitude", () => {
it('does not wrap bounds between -180 and 180 longitude', () => {
let bounds1 = L.latLngBounds([-10, -10], [10, 10]);
let bounds2 = L.latLngBounds([-80, -180], [-70, -170]);
@ -100,7 +100,7 @@ describe("CRS.EPSG3857", () => {
});
it("wraps bounds when center longitude is less than -180", () => {
it('wraps bounds when center longitude is less than -180', () => {
let bounds1 = L.latLngBounds([0, -185], [10, -170]);
let bounds2 = L.latLngBounds([0, -190], [10, -175]);
@ -118,7 +118,7 @@ describe("CRS.EPSG3857", () => {
expect(bounds2.getEast()).to.eql(185);
});
it("wraps bounds when center longitude is larger than +180", () => {
it('wraps bounds when center longitude is larger than +180', () => {
let bounds1 = L.latLngBounds([0, 185], [10, 170]);
let bounds2 = L.latLngBounds([0, 190], [10, 175]);
@ -140,11 +140,11 @@ describe("CRS.EPSG3857", () => {
});
describe("CRS.EPSG4326", () => {
describe('CRS.EPSG4326', () => {
const crs = L.CRS.EPSG4326;
describe("#getSize", () => {
it("gives correct size", () => {
describe('#getSize', () => {
it('gives correct size', () => {
let i,
worldSize = 256,
crsSize;
@ -159,61 +159,61 @@ describe("CRS.EPSG4326", () => {
});
});
describe("CRS.EPSG3395", () => {
describe('CRS.EPSG3395', () => {
const crs = L.CRS.EPSG3395;
describe("#latLngToPoint", () => {
it("projects a center point", () => {
describe('#latLngToPoint', () => {
it('projects a center point', () => {
expect(crs.latLngToPoint(L.latLng(0, 0), 0)).near([128, 128], 0.01);
});
it("projects the northeast corner of the world", () => {
it('projects the northeast corner of the world', () => {
expect(crs.latLngToPoint(L.latLng(85.0840591556, 180), 0)).near([256, 0]);
});
});
describe("#pointToLatLng", () => {
it("reprojects a center point", () => {
describe('#pointToLatLng', () => {
it('reprojects a center point', () => {
expect(crs.pointToLatLng(L.point(128, 128), 0)).nearLatLng([0, 0], 0.01);
});
it("reprojects the northeast corner of the world", () => {
it('reprojects the northeast corner of the world', () => {
expect(crs.pointToLatLng(L.point(256, 0), 0)).nearLatLng([85.0840591556, 180]);
});
});
});
describe("CRS.Simple", () => {
describe('CRS.Simple', () => {
const crs = L.CRS.Simple;
describe("#latLngToPoint", () => {
it("converts LatLng coords to pixels", () => {
describe('#latLngToPoint', () => {
it('converts LatLng coords to pixels', () => {
expect(crs.latLngToPoint(L.latLng(0, 0), 0)).near([0, 0]);
expect(crs.latLngToPoint(L.latLng(700, 300), 0)).near([300, -700]);
expect(crs.latLngToPoint(L.latLng(-200, 1000), 1)).near([2000, 400]);
});
});
describe("#pointToLatLng", () => {
it("converts pixels to LatLng coords", () => {
describe('#pointToLatLng', () => {
it('converts pixels to LatLng coords', () => {
expect(crs.pointToLatLng(L.point(0, 0), 0)).nearLatLng([0, 0]);
expect(crs.pointToLatLng(L.point(300, -700), 0)).nearLatLng([700, 300]);
expect(crs.pointToLatLng(L.point(2000, 400), 1)).nearLatLng([-200, 1000]);
});
});
describe("getProjectedBounds", () => {
it("returns nothing", () => {
describe('getProjectedBounds', () => {
it('returns nothing', () => {
expect(crs.getProjectedBounds(5)).to.be(null);
});
});
describe("wrapLatLng", () => {
it("returns coords as is", () => {
describe('wrapLatLng', () => {
it('returns coords as is', () => {
expect(crs.wrapLatLng(L.latLng(270, 400)).equals(L.latLng(270, 400))).to.be(true);
});
it("wraps coords if configured", () => {
it('wraps coords if configured', () => {
const crs = L.extend({}, L.CRS.Simple, {
wrapLng: [-200, 200],
wrapLat: [-200, 200]
@ -224,11 +224,11 @@ describe("CRS.Simple", () => {
});
});
describe("CRS", () => {
describe('CRS', () => {
const crs = L.CRS;
describe("#zoom && #scale", () => {
it("convert zoom to scale and viceversa and return the same values", () => {
describe('#zoom && #scale', () => {
it('convert zoom to scale and viceversa and return the same values', () => {
const zoom = 2.5;
const scale = crs.scale(zoom);
const zoom2 = crs.zoom(scale);
@ -237,7 +237,7 @@ describe("CRS", () => {
});
});
describe("CRS.ZoomNotPowerOfTwo", () => {
describe('CRS.ZoomNotPowerOfTwo', () => {
const crs = L.extend({}, L.CRS, {
scale(zoom) {
return 256 * Math.pow(1.5, zoom);
@ -247,8 +247,8 @@ describe("CRS.ZoomNotPowerOfTwo", () => {
}
});
describe("#scale", () => {
it("of zoom levels are related by a power of 1.5", () => {
describe('#scale', () => {
it('of zoom levels are related by a power of 1.5', () => {
const zoom = 5;
const scale = crs.scale(zoom);
expect(crs.scale(zoom + 1)).to.eql(1.5 * scale);
@ -256,8 +256,8 @@ describe("CRS.ZoomNotPowerOfTwo", () => {
});
});
describe("#zoom && #scale", () => {
it("convert zoom to scale and viceversa and return the same values", () => {
describe('#zoom && #scale', () => {
it('convert zoom to scale and viceversa and return the same values', () => {
const zoom = 2;
const scale = crs.scale(zoom);
expect(crs.zoom(scale)).to.eql(zoom);
@ -265,8 +265,8 @@ describe("CRS.ZoomNotPowerOfTwo", () => {
});
});
describe("CRS.Earth", () => {
describe("#distance", () => {
describe('CRS.Earth', () => {
describe('#distance', () => {
// Test values from http://rosettacode.org/wiki/Haversine_formula,
// we assume using mean earth radius (https://en.wikipedia.org/wiki/Earth_radius#Mean_radius)
// is correct, since that's what International Union of Geodesy and Geophysics recommends,

View File

@ -1,21 +1,21 @@
describe("Projection.Mercator", () => {
describe('Projection.Mercator', () => {
const p = L.Projection.Mercator;
describe("#project", () => {
it("projects a center point", () => {
describe('#project', () => {
it('projects a center point', () => {
// edge cases
expect(p.project(L.latLng(0, 0))).near([0, 0]);
});
it("projects the northeast corner of the world", () => {
it('projects the northeast corner of the world', () => {
expect(p.project(L.latLng(85.0840591556, 180))).near([20037508, 20037508]);
});
it("projects the southwest corner of the world", () => {
it('projects the southwest corner of the world', () => {
expect(p.project(L.latLng(-85.0840591556, -180))).near([-20037508, -20037508]);
});
it("projects other points", () => {
it('projects other points', () => {
expect(p.project(L.latLng(50, 30))).near([3339584, 6413524]);
// from https://github.com/Leaflet/Leaflet/issues/1578
@ -24,16 +24,16 @@ describe("Projection.Mercator", () => {
});
});
describe("#unproject", () => {
describe('#unproject', () => {
function pr(point) {
return p.project(p.unproject(point));
}
it("unprojects a center point", () => {
it('unprojects a center point', () => {
expect(pr(L.point(0, 0))).near([0, 0]);
});
it("unprojects pi points", () => {
it('unprojects pi points', () => {
expect(pr(L.point(-Math.PI, Math.PI))).near([-Math.PI, Math.PI]);
expect(pr(L.point(-Math.PI, -Math.PI))).near([-Math.PI, -Math.PI]);
@ -47,24 +47,24 @@ describe("Projection.Mercator", () => {
});
});
describe("Projection.SphericalMercator", () => {
describe('Projection.SphericalMercator', () => {
const p = L.Projection.SphericalMercator;
describe("#project", () => {
it("projects a center point", () => {
describe('#project', () => {
it('projects a center point', () => {
// edge cases
expect(p.project(L.latLng(0, 0))).near([0, 0]);
});
it("projects the northeast corner of the world", () => {
it('projects the northeast corner of the world', () => {
expect(p.project(L.latLng(85.0511287798, 180))).near([20037508, 20037508]);
});
it("projects the southwest corner of the world", () => {
it('projects the southwest corner of the world', () => {
expect(p.project(L.latLng(-85.0511287798, -180))).near([-20037508, -20037508]);
});
it("projects other points", () => {
it('projects other points', () => {
expect(p.project(L.latLng(50, 30))).near([3339584, 6446275]);
// from https://github.com/Leaflet/Leaflet/issues/1578
@ -73,16 +73,16 @@ describe("Projection.SphericalMercator", () => {
});
});
describe("#unproject", () => {
describe('#unproject', () => {
function pr(point) {
return p.project(p.unproject(point));
}
it("unprojects a center point", () => {
it('unprojects a center point', () => {
expect(pr(L.point(0, 0))).near([0, 0]);
});
it("unprojects pi points", () => {
it('unprojects pi points', () => {
expect(pr(L.point(-Math.PI, Math.PI))).near([-Math.PI, Math.PI]);
expect(pr(L.point(-Math.PI, -Math.PI))).near([-Math.PI, -Math.PI]);

View File

@ -1,12 +1,12 @@
describe("Point", () => {
describe('Point', () => {
describe('constructor', () => {
it("creates a point with the given x and y", () => {
it('creates a point with the given x and y', () => {
const p = L.point(1.5, 2.5);
expect(p.x).to.eql(1.5);
expect(p.y).to.eql(2.5);
});
it("rounds the given x and y if the third argument is true", () => {
it('rounds the given x and y if the third argument is true', () => {
const p = L.point(1.3, 2.7, true);
expect(p.x).to.eql(1);
expect(p.y).to.eql(3);
@ -106,7 +106,7 @@ describe("Point", () => {
expect(L.point([50, 30])).to.eql(L.point(50, 30));
});
it("creates a point from an object with x and y properties", () => {
it('creates a point from an object with x and y properties', () => {
expect(L.point({x: 50, y: 30})).to.eql(L.point(50, 30));
});

View File

@ -1,4 +1,4 @@
describe("Transformation", () => {
describe('Transformation', () => {
let t, p;
beforeEach(() => {
@ -7,7 +7,7 @@ describe("Transformation", () => {
});
describe('#transform', () => {
it("performs a transformation", () => {
it('performs a transformation', () => {
const p2 = t.transform(p, 2);
expect(p2).to.eql(L.point(24, 128));
});
@ -19,7 +19,7 @@ describe("Transformation", () => {
});
describe('#untransform', () => {
it("performs a reverse transformation", () => {
it('performs a reverse transformation', () => {
const p2 = t.transform(p, 2);
const p3 = t.untransform(p2, 2);
expect(p3).to.eql(p);
@ -31,7 +31,7 @@ describe("Transformation", () => {
});
describe('#constructor', () => {
it("allows an array property for a", () => {
it('allows an array property for a', () => {
const t2 = L.transformation([1, 2, 3, 4]);
expect(t._a).to.eql(t2._a);
expect(t._b).to.eql(t2._b);

View File

@ -1,13 +1,13 @@
describe('FeatureGroup', () => {
describe("#_propagateEvent", () => {
describe('#_propagateEvent', () => {
let marker;
beforeEach(() => {
marker = L.marker([0, 0]);
});
describe("when a Marker is added to multiple FeatureGroups ", () => {
it("e.propagatedFrom should be the Marker", () => {
describe('when a Marker is added to multiple FeatureGroups ', () => {
it('e.propagatedFrom should be the Marker', () => {
const fg1 = L.featureGroup(),
fg2 = L.featureGroup();

View File

@ -1,5 +1,5 @@
describe("L.GeoJSON", () => {
describe("addData", () => {
describe('L.GeoJSON', () => {
describe('addData', () => {
const geojson = {
type: 'Feature',
properties: {},
@ -13,28 +13,28 @@ describe("L.GeoJSON", () => {
geometry: null
};
it("sets feature property on member layers", () => {
it('sets feature property on member layers', () => {
const layer = L.geoJSON();
layer.addData(geojson);
expect(layer.getLayers()[0].feature).to.eql(geojson);
});
it("normalizes a geometry to a Feature", () => {
it('normalizes a geometry to a Feature', () => {
const layer = L.geoJSON();
layer.addData(geojson.geometry);
expect(layer.getLayers()[0].feature).to.eql(geojson);
});
it("accepts geojson with null geometry", () => {
it('accepts geojson with null geometry', () => {
const layer = L.geoJSON();
layer.addData(geojsonEmpty);
expect(layer.getLayers().length).to.eql(0);
});
it("makes default marker inherit group options if explicitly requested", () => {
it('makes default marker inherit group options if explicitly requested', () => {
// Check first that it does not inherit group options by default
const options = {
customOption: "My Custom Option"
customOption: 'My Custom Option'
};
const layer = L.geoJSON(null, options);
layer.addData(geojson);
@ -98,8 +98,8 @@ describe("L.GeoJSON", () => {
});
});
describe("L.Marker#toGeoJSON", () => {
it("returns a 2D Point object", () => {
describe('L.Marker#toGeoJSON', () => {
it('returns a 2D Point object', () => {
const marker = L.marker([10, 20]);
expect(marker.toGeoJSON().geometry).to.eql({
type: 'Point',
@ -107,7 +107,7 @@ describe("L.Marker#toGeoJSON", () => {
});
});
it("returns a 3D Point object", () => {
it('returns a 3D Point object', () => {
const marker = L.marker([10, 20, 30]);
expect(marker.toGeoJSON().geometry).to.eql({
type: 'Point',
@ -124,8 +124,8 @@ describe("L.Marker#toGeoJSON", () => {
});
});
describe("L.Circle#toGeoJSON", () => {
it("returns a 2D Point object", () => {
describe('L.Circle#toGeoJSON', () => {
it('returns a 2D Point object', () => {
const circle = L.circle([10, 20], 100);
expect(circle.toGeoJSON().geometry).to.eql({
type: 'Point',
@ -133,7 +133,7 @@ describe("L.Circle#toGeoJSON", () => {
});
});
it("returns a 3D Point object", () => {
it('returns a 3D Point object', () => {
const circle = L.circle([10, 20, 30], 100);
expect(circle.toGeoJSON().geometry).to.eql({
type: 'Point',
@ -150,8 +150,8 @@ describe("L.Circle#toGeoJSON", () => {
});
});
describe("L.CircleMarker#toGeoJSON", () => {
it("returns a 2D Point object", () => {
describe('L.CircleMarker#toGeoJSON', () => {
it('returns a 2D Point object', () => {
const marker = L.circleMarker([10, 20]);
expect(marker.toGeoJSON().geometry).to.eql({
type: 'Point',
@ -159,7 +159,7 @@ describe("L.CircleMarker#toGeoJSON", () => {
});
});
it("returns a 3D Point object", () => {
it('returns a 3D Point object', () => {
const marker = L.circleMarker([10, 20, 30]);
expect(marker.toGeoJSON().geometry).to.eql({
type: 'Point',
@ -167,7 +167,7 @@ describe("L.CircleMarker#toGeoJSON", () => {
});
});
it("should allow specific precisions", () => {
it('should allow specific precisions', () => {
const marker = L.circleMarker([10.1234, 20.1234]);
expect(marker.toGeoJSON(3).geometry).to.eql({
type: 'Point',
@ -176,8 +176,8 @@ describe("L.CircleMarker#toGeoJSON", () => {
});
});
describe("L.Polyline#toGeoJSON", () => {
it("returns a 2D LineString object", () => {
describe('L.Polyline#toGeoJSON', () => {
it('returns a 2D LineString object', () => {
const polyline = L.polyline([[10, 20], [2, 5]]);
expect(polyline.toGeoJSON().geometry).to.eql({
type: 'LineString',
@ -185,7 +185,7 @@ describe("L.Polyline#toGeoJSON", () => {
});
});
it("returns a 3D LineString object", () => {
it('returns a 3D LineString object', () => {
const polyline = L.polyline([[10, 20, 30], [2, 5, 10]]);
expect(polyline.toGeoJSON().geometry).to.eql({
type: 'LineString',
@ -193,7 +193,7 @@ describe("L.Polyline#toGeoJSON", () => {
});
});
it("should allow specific precisions", () => {
it('should allow specific precisions', () => {
const polyline = L.polyline([[10.1234, 20.1234, 30.1234], [2.1234, 5.1234, 10.1234]]);
expect(polyline.toGeoJSON(3).geometry).to.eql({
type: 'LineString',
@ -202,8 +202,8 @@ describe("L.Polyline#toGeoJSON", () => {
});
});
describe("L.Polyline (multi) #toGeoJSON", () => {
it("returns a 2D MultiLineString object", () => {
describe('L.Polyline (multi) #toGeoJSON', () => {
it('returns a 2D MultiLineString object', () => {
const multiPolyline = L.polyline([[[10, 20], [2, 5]], [[1, 2], [3, 4]]]);
expect(multiPolyline.toGeoJSON().geometry).to.eql({
type: 'MultiLineString',
@ -214,7 +214,7 @@ describe("L.Polyline (multi) #toGeoJSON", () => {
});
});
it("returns a 3D MultiLineString object", () => {
it('returns a 3D MultiLineString object', () => {
const multiPolyline = L.polyline([[[10, 20, 30], [2, 5, 10]], [[1, 2, 3], [4, 5, 6]]]);
expect(multiPolyline.toGeoJSON().geometry).to.eql({
type: 'MultiLineString',
@ -225,7 +225,7 @@ describe("L.Polyline (multi) #toGeoJSON", () => {
});
});
it("should allow specific precisions", () => {
it('should allow specific precisions', () => {
const multiPolyline = L.polyline([[[10.1234, 20.1234, 30.1234], [2.1234, 5.1234, 10.1234]], [[1.1234, 2.1234, 3.1234], [4.1234, 5.1234, 6.1234]]]);
expect(multiPolyline.toGeoJSON(3).geometry).to.eql({
type: 'MultiLineString',
@ -237,8 +237,8 @@ describe("L.Polyline (multi) #toGeoJSON", () => {
});
});
describe("L.Polygon#toGeoJSON", () => {
it("returns a 2D Polygon object (no holes) from a flat LatLngs array", () => {
describe('L.Polygon#toGeoJSON', () => {
it('returns a 2D Polygon object (no holes) from a flat LatLngs array', () => {
const polygon = L.polygon([[1, 2], [3, 4], [5, 6]]);
expect(polygon.toGeoJSON().geometry).to.eql({
type: 'Polygon',
@ -246,7 +246,7 @@ describe("L.Polygon#toGeoJSON", () => {
});
});
it("returns a 3D Polygon object (no holes) from a flat LatLngs array", () => {
it('returns a 3D Polygon object (no holes) from a flat LatLngs array', () => {
const polygon = L.polygon([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);
expect(polygon.toGeoJSON().geometry).to.eql({
type: 'Polygon',
@ -254,7 +254,7 @@ describe("L.Polygon#toGeoJSON", () => {
});
});
it("returns a 2D Polygon object from a simple GeoJSON like input", () => {
it('returns a 2D Polygon object from a simple GeoJSON like input', () => {
const multiPolygon = L.polygon([[[1, 2], [3, 4], [5, 6]]]);
expect(multiPolygon.toGeoJSON().geometry).to.eql({
type: 'Polygon',
@ -264,7 +264,7 @@ describe("L.Polygon#toGeoJSON", () => {
});
});
it("returns a 3D MultiPolygon object from a simple GeoJSON like input", () => {
it('returns a 3D MultiPolygon object from a simple GeoJSON like input', () => {
const multiPolygon = L.polygon([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]);
expect(multiPolygon.toGeoJSON().geometry).to.eql({
type: 'Polygon',
@ -274,7 +274,7 @@ describe("L.Polygon#toGeoJSON", () => {
});
});
it("returns a 2D Polygon object (with holes)", () => {
it('returns a 2D Polygon object (with holes)', () => {
const polygon = L.polygon([[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11, 12]]]);
expect(polygon.toGeoJSON().geometry).to.eql({
type: 'Polygon',
@ -285,7 +285,7 @@ describe("L.Polygon#toGeoJSON", () => {
});
});
it("returns a 3D Polygon object (with holes)", () => {
it('returns a 3D Polygon object (with holes)', () => {
const polygon = L.polygon([[[1, 2, 3], [4, 5, 6], [7, 8, 9]], [[10, 11, 12], [13, 14, 15], [16, 17, 18]]]);
expect(polygon.toGeoJSON().geometry).to.eql({
type: 'Polygon',
@ -296,7 +296,7 @@ describe("L.Polygon#toGeoJSON", () => {
});
});
it("should allow specific precisions", () => {
it('should allow specific precisions', () => {
const polygon = L.polygon([[1.1234, 2.1234], [3.1234, 4.1234], [5.1234, 6.1234]]);
expect(polygon.toGeoJSON(3).geometry).to.eql({
type: 'Polygon',
@ -305,8 +305,8 @@ describe("L.Polygon#toGeoJSON", () => {
});
});
describe("L.Polygon (multi) #toGeoJSON", () => {
it("returns a 2D MultiPolygon object", () => {
describe('L.Polygon (multi) #toGeoJSON', () => {
it('returns a 2D MultiPolygon object', () => {
const multiPolygon = L.polygon([[[[1, 2], [3, 4], [5, 6]]]]);
expect(multiPolygon.toGeoJSON().geometry).to.eql({
type: 'MultiPolygon',
@ -316,7 +316,7 @@ describe("L.Polygon (multi) #toGeoJSON", () => {
});
});
it("returns a 3D MultiPolygon object", () => {
it('returns a 3D MultiPolygon object', () => {
const multiPolygon = L.polygon([[[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]]);
expect(multiPolygon.toGeoJSON().geometry).to.eql({
type: 'MultiPolygon',
@ -326,7 +326,7 @@ describe("L.Polygon (multi) #toGeoJSON", () => {
});
});
it("returns a 2D MultiPolygon object with two polygons", () => {
it('returns a 2D MultiPolygon object with two polygons', () => {
const multiPolygon = L.polygon([[[[1, 2], [3, 4], [5, 6]]], [[[7, 8], [9, 10], [11, 12]]]]);
expect(multiPolygon.toGeoJSON().geometry).to.eql({
type: 'MultiPolygon',
@ -337,7 +337,7 @@ describe("L.Polygon (multi) #toGeoJSON", () => {
});
});
it("returns a 2D MultiPolygon object with polygon having a hole", () => {
it('returns a 2D MultiPolygon object with polygon having a hole', () => {
const multiPolygon = L.polygon([[[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11, 12]]]]);
expect(multiPolygon.toGeoJSON().geometry).to.eql({
type: 'MultiPolygon',
@ -347,7 +347,7 @@ describe("L.Polygon (multi) #toGeoJSON", () => {
});
});
it("should allow specific precisions", () => {
it('should allow specific precisions', () => {
const multiPolygon = L.polygon([[[[1.1234, 2.1234], [3.1234, 4.1234], [5.1234, 6.1234]]]]);
expect(multiPolygon.toGeoJSON(3).geometry).to.eql({
type: 'MultiPolygon',
@ -358,8 +358,8 @@ describe("L.Polygon (multi) #toGeoJSON", () => {
});
});
describe("L.LayerGroup#toGeoJSON", () => {
it("returns a 2D FeatureCollection object", () => {
describe('L.LayerGroup#toGeoJSON', () => {
it('returns a 2D FeatureCollection object', () => {
const marker = L.marker([10, 20]),
polyline = L.polyline([[10, 20], [2, 5]]),
layerGroup = L.layerGroup([marker, polyline]);
@ -369,7 +369,7 @@ describe("L.LayerGroup#toGeoJSON", () => {
});
});
it("returns a 3D FeatureCollection object", () => {
it('returns a 3D FeatureCollection object', () => {
const marker = L.marker([10, 20, 30]),
polyline = L.polyline([[10, 20, 30], [2, 5, 10]]),
layerGroup = L.layerGroup([marker, polyline]);
@ -379,7 +379,7 @@ describe("L.LayerGroup#toGeoJSON", () => {
});
});
it("ensures that every member is a Feature", () => {
it('ensures that every member is a Feature', () => {
const tileLayer = L.tileLayer(),
layerGroup = L.layerGroup([tileLayer]);
@ -405,44 +405,44 @@ describe("L.LayerGroup#toGeoJSON", () => {
it('roundtrips GeometryCollection features', () => {
const json = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "GeometryCollection",
"geometries": [{
"type": "LineString",
"coordinates": [[-122.4425587930444, 37.80666418607323], [-122.4428379594768, 37.80663578323093]]
'type': 'FeatureCollection',
'features': [{
'type': 'Feature',
'geometry': {
'type': 'GeometryCollection',
'geometries': [{
'type': 'LineString',
'coordinates': [[-122.4425587930444, 37.80666418607323], [-122.4428379594768, 37.80663578323093]]
}, {
"type": "LineString",
"coordinates": [
'type': 'LineString',
'coordinates': [
[-122.4425509770566, 37.80662588061205],
[-122.4428340530617, 37.8065999493009]
]
}]
},
"properties": {
"name": "SF Marina Harbor Master"
'properties': {
'name': 'SF Marina Harbor Master'
}
}]
};
const expected = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "GeometryCollection",
"geometries": [{
"type": "LineString",
"coordinates": [[-122.442559, 37.806664], [-122.442838, 37.806636]]
'type': 'FeatureCollection',
'features': [{
'type': 'Feature',
'geometry': {
'type': 'GeometryCollection',
'geometries': [{
'type': 'LineString',
'coordinates': [[-122.442559, 37.806664], [-122.442838, 37.806636]]
}, {
"type": "LineString",
"coordinates": [[-122.442551, 37.806626], [-122.442834, 37.8066]]
'type': 'LineString',
'coordinates': [[-122.442551, 37.806626], [-122.442834, 37.8066]]
}]
},
"properties": {
"name": "SF Marina Harbor Master"
'properties': {
'name': 'SF Marina Harbor Master'
}
}]
};
@ -451,36 +451,36 @@ describe("L.LayerGroup#toGeoJSON", () => {
it('roundtrips MultiPoint features', () => {
const json = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "MultiPoint",
"coordinates": [[-122.4425587930444, 37.80666418607323], [-122.4428379594768, 37.80663578323093]]
'type': 'FeatureCollection',
'features': [{
'type': 'Feature',
'geometry': {
'type': 'MultiPoint',
'coordinates': [[-122.4425587930444, 37.80666418607323], [-122.4428379594768, 37.80663578323093]]
},
"properties": {
"name": "Test MultiPoints"
'properties': {
'name': 'Test MultiPoints'
}
}]
};
const expected = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "MultiPoint",
"coordinates": [[-122.442559, 37.806664], [-122.442838, 37.806636]]
'type': 'FeatureCollection',
'features': [{
'type': 'Feature',
'geometry': {
'type': 'MultiPoint',
'coordinates': [[-122.442559, 37.806664], [-122.442838, 37.806636]]
},
"properties": {
"name": "Test MultiPoints"
'properties': {
'name': 'Test MultiPoints'
}
}]
};
expect(L.geoJSON(json).toGeoJSON()).to.eql(expected);
});
it("omits layers which do not implement toGeoJSON", () => {
it('omits layers which do not implement toGeoJSON', () => {
const tileLayer = L.tileLayer(),
layerGroup = L.layerGroup([tileLayer]);
expect(layerGroup.toGeoJSON()).to.eql({
@ -498,11 +498,11 @@ describe("L.LayerGroup#toGeoJSON", () => {
const geoJSON = layerGroup.toGeoJSON();
expect(geoJSON.features.length).to.eql(2);
expect(geoJSON.features[0].type).to.eql("Feature");
expect(geoJSON.features[1].type).to.eql("Feature");
expect(geoJSON.features[0].type).to.eql('Feature');
expect(geoJSON.features[1].type).to.eql('Feature');
});
it("should allow specific precisions", () => {
it('should allow specific precisions', () => {
const marker = L.marker([10, 20]),
polyline = L.polyline([[10, 20], [2, 5]]),
layerGroup = L.layerGroup([marker, polyline]);
@ -513,39 +513,39 @@ describe("L.LayerGroup#toGeoJSON", () => {
});
});
describe("L.GeoJSON functions", () => {
describe("#geometryToLayer", () => {
describe('L.GeoJSON functions', () => {
describe('#geometryToLayer', () => {
const point = {
type: "Point",
type: 'Point',
coordinates: [0, 0]
};
const multiPoint = {
type: "MultiPoint",
type: 'MultiPoint',
coordinates: [
[0, 0], [10, 10]
]
};
const line = {
type: "LineString",
type: 'LineString',
coordinates: [
[0, 0], [10, 10], [20, 20]
]
};
const multiLine = {
type: "MultiLineString",
type: 'MultiLineString',
coordinates: [
[[10, 10], [20, 20], [30, 30]],
[[50, 50], [60, 60], [70, 70]]
]
};
const polygon = {
type: "Polygon",
type: 'Polygon',
coordinates: [
[[30, 10], [40, 40], [20, 40], [10, 20], [30, 10]]
]
};
const multiPolygon = {
type: "MultiPolygon",
type: 'MultiPolygon',
coordinates: [
[
[[30, 20], [45, 40], [10, 40], [30, 20]]
@ -556,14 +556,14 @@ describe("L.GeoJSON functions", () => {
]
};
const geometryCollection = {
type: "GeometryCollection",
type: 'GeometryCollection',
geometries: [
{
type: "Point",
type: 'Point',
coordinates: [0, 0]
},
{
type: "LineString",
type: 'LineString',
coordinates: [
[10, 10], [20, 20]
]
@ -572,12 +572,12 @@ describe("L.GeoJSON functions", () => {
};
const featureCollection = {
type: "FeatureCollection",
type: 'FeatureCollection',
features: [
{
type: "Feature",
type: 'Feature',
geometry: {
type: "Point",
type: 'Point',
coordinates: [0, 0]
}
},
@ -608,7 +608,7 @@ describe("L.GeoJSON functions", () => {
it(`creates a Layer from a GeoJSON feature (type='${geometry.type}')`, () => {
const layer = L.GeoJSON.geometryToLayer({
type: "Feature",
type: 'Feature',
geometry
});
expect(layer).to.be.a(expectedType);
@ -620,24 +620,24 @@ describe("L.GeoJSON functions", () => {
});
});
it("throws an error if feature is an invalid GeoJSON object", () => {
it('throws an error if feature is an invalid GeoJSON object', () => {
expect(L.GeoJSON.geometryToLayer).withArgs({
type: "Feature",
type: 'Feature',
geometry: {
type: "invalid",
type: 'invalid',
coordinates: [0, 0]
}
}).to.throwError("Invalid GeoJSON object.");
}).to.throwError('Invalid GeoJSON object.');
});
it("returns nothing if feature does not have a geometry property", () => {
const ret = L.GeoJSON.geometryToLayer({type: "Feature"});
it('returns nothing if feature does not have a geometry property', () => {
const ret = L.GeoJSON.geometryToLayer({type: 'Feature'});
expect(ret).not.to.be.ok();
});
it("creates a Layer using pointToLayer option (Point)", () => {
it('creates a Layer using pointToLayer option (Point)', () => {
const layer = L.GeoJSON.geometryToLayer({
type: "Feature",
type: 'Feature',
geometry: point,
properties: {radius: 100}
}, {
@ -647,9 +647,9 @@ describe("L.GeoJSON functions", () => {
expect(layer.options.radius).to.be(100);
});
it("creates a Layer using pointToLayer option (MultiPoint)", () => {
it('creates a Layer using pointToLayer option (MultiPoint)', () => {
const layer = L.GeoJSON.geometryToLayer({
type: "Feature",
type: 'Feature',
geometry: multiPoint,
properties: {radius: 100}
}, {
@ -661,11 +661,11 @@ describe("L.GeoJSON functions", () => {
});
});
it("creates a Layer using coordsToLatLng option (Point)", () => {
it('creates a Layer using coordsToLatLng option (Point)', () => {
const layer = L.GeoJSON.geometryToLayer({
type: "Feature",
type: 'Feature',
geometry: {
type: "Point",
type: 'Point',
coordinates: [1, 2, 3]
}
}, {
@ -674,11 +674,11 @@ describe("L.GeoJSON functions", () => {
expect(layer.getLatLng()).to.eql({lat: 3, lng: 2, alt: 4});
});
it("creates a Layer using coordsToLatLng option (MultiPoint)", () => {
it('creates a Layer using coordsToLatLng option (MultiPoint)', () => {
const layer = L.GeoJSON.geometryToLayer({
type: "Feature",
type: 'Feature',
geometry: {
type: "MultiPoint",
type: 'MultiPoint',
coordinates: [
[1, 2, 3], [4, 5, 6]
]
@ -693,8 +693,8 @@ describe("L.GeoJSON functions", () => {
});
});
describe("#coordsToLatLng", () => {
it("creates a LatLng object with given coordinates", () => {
describe('#coordsToLatLng', () => {
it('creates a LatLng object with given coordinates', () => {
const latLng = L.GeoJSON.coordsToLatLng([1, 2]);
const latLngWithAlt = L.GeoJSON.coordsToLatLng([3, 4, 5]);
expect(latLng).to.be.a(L.LatLng);
@ -704,13 +704,13 @@ describe("L.GeoJSON functions", () => {
});
});
describe("#coordsToLatLngs", () => {
describe('#coordsToLatLngs', () => {
function customCoordsToLatLng(coords) {
return L.latLng(coords[1] + 1, coords[0] + 1, coords[2] + 1);
}
it("creates a multidimensional array of LatLngs", () => {
it('creates a multidimensional array of LatLngs', () => {
const latLngs = L.GeoJSON.coordsToLatLngs([[1, 2], [3, 4], [5, 6]]);
expect(latLngs).to.eql([{lng: 1, lat: 2}, {lng: 3, lat: 4}, {lng: 5, lat: 6}]);
latLngs.forEach((latLng) => {
@ -718,7 +718,7 @@ describe("L.GeoJSON functions", () => {
});
});
it("creates a multidimensional array of LatLngs (levelsDeep=1)", () => {
it('creates a multidimensional array of LatLngs (levelsDeep=1)', () => {
const latLngs = L.GeoJSON.coordsToLatLngs([
[[1, 2], [3, 4], [5, 6]],
[[5, 6], [7, 8], [9, 10]]
@ -734,7 +734,7 @@ describe("L.GeoJSON functions", () => {
});
});
it("creates a multidimensional array of LatLngs with custom coordsToLatLng", () => {
it('creates a multidimensional array of LatLngs with custom coordsToLatLng', () => {
const coords = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
const latLngs = L.GeoJSON.coordsToLatLngs(coords, 0, customCoordsToLatLng);
expect(latLngs).to.eql([
@ -744,7 +744,7 @@ describe("L.GeoJSON functions", () => {
]);
});
it("creates a multidimensional array of LatLngs with custom coordsToLatLng (levelDeep=1)", () => {
it('creates a multidimensional array of LatLngs with custom coordsToLatLng (levelDeep=1)', () => {
const coords = [
[[1, 2, 3], [4, 5, 6]],
[[12, 13, 14], [15, 16, 17]]
@ -763,20 +763,20 @@ describe("L.GeoJSON functions", () => {
});
});
describe("#latLngToCoords", () => {
it("accepts latlng array", () => {
describe('#latLngToCoords', () => {
it('accepts latlng array', () => {
const coords = L.GeoJSON.latLngToCoords([2, 1, 3]);
expect(coords).to.eql([1, 2, 3]);
});
it("returns an array of coordinates and altitude", () => {
it('returns an array of coordinates and altitude', () => {
const coords = L.GeoJSON.latLngToCoords(L.latLng(2, 1));
const coordsWithAlt = L.GeoJSON.latLngToCoords(L.latLng(2, 1, 3));
expect(coords).to.eql([1, 2]);
expect(coordsWithAlt).to.eql([1, 2, 3]);
});
it("returns an array of coordinates with given precision", () => {
it('returns an array of coordinates with given precision', () => {
const coords = L.GeoJSON.latLngToCoords(L.latLng(
2.123456, 1.123456
), 3);
@ -788,20 +788,20 @@ describe("L.GeoJSON functions", () => {
});
});
describe("#latLngsToCoords", () => {
it("accepts multidimensional latlng array", () => {
describe('#latLngsToCoords', () => {
it('accepts multidimensional latlng array', () => {
const coords = L.GeoJSON.latLngsToCoords([[2, 1, 3], [5, 4, 6]]);
expect(coords).to.eql([[1, 2, 3], [4, 5, 6]]);
});
it("returns a multidimensional array of coordinates", () => {
it('returns a multidimensional array of coordinates', () => {
const coords = L.GeoJSON.latLngsToCoords([L.latLng(2, 1), L.latLng(4, 3)]);
const coordWithAlt = L.GeoJSON.latLngsToCoords([L.latLng(2, 1, 3), L.latLng(5, 4, 6)]);
expect(coords).to.eql([[1, 2], [3, 4]]);
expect(coordWithAlt).to.eql([[1, 2, 3], [4, 5, 6]]);
});
it("returns a multidimensional array of coordinates (levelDeep=1)", () => {
it('returns a multidimensional array of coordinates (levelDeep=1)', () => {
const latLngs = [
[L.latLng(2, 1), L.latLng(4, 3)],
[L.latLng(6, 5), L.latLng(8, 7)]
@ -813,13 +813,13 @@ describe("L.GeoJSON functions", () => {
]);
});
it("returns a multidimensional array of coordinates (closed=True)", () => {
it('returns a multidimensional array of coordinates (closed=True)', () => {
const latLngs = [L.latLng(2, 1), L.latLng(4, 3), L.latLng(6, 5)];
const coords = L.GeoJSON.latLngsToCoords(latLngs, 0, true);
expect(coords).to.eql([[1, 2], [3, 4], [5, 6], [1, 2]]);
});
it("returns a multidimensional array of coordinates (levelsDeep=1, closed=True)", () => {
it('returns a multidimensional array of coordinates (levelsDeep=1, closed=True)', () => {
const latLngs = [
[L.latLng(2, 1), L.latLng(4, 3), L.latLng(6, 5)],
[L.latLng(8, 7), L.latLng(10, 9), L.latLng(12, 11)]
@ -831,7 +831,7 @@ describe("L.GeoJSON functions", () => {
]);
});
it("returns a multidimensional array of coordinates with given precision", () => {
it('returns a multidimensional array of coordinates with given precision', () => {
const latLngs = [L.latLng(2.123456, 1.123456), L.latLng(4.123456, 3.123456)];
const coords = L.GeoJSON.latLngsToCoords(latLngs, 0, false, 3);
expect(coords).to.eql([[1.123, 2.123], [3.123, 4.123]]);
@ -882,59 +882,59 @@ describe("L.GeoJSON functions", () => {
]
});
});
it("has no reference between first and last coordinates", () => {
it('has no reference between first and last coordinates', () => {
const coords = L.GeoJSON.latLngsToCoords([[2, 1, 3], [5, 4, 6]], null, true);
expect(coords).to.eql([[1, 2, 3], [4, 5, 6], [1, 2, 3]]);
expect(coords[0] === coords[2]).to.not.ok();
});
});
describe("#asFeature", () => {
describe('#asFeature', () => {
const geometry1 = {
type: "Point",
type: 'Point',
coordinates: [0, 0]
};
const geometry2 = {
type: "Point",
type: 'Point',
coordinates: [1, 1]
};
const feature1 = {
type: "Feature",
type: 'Feature',
geometry: geometry1,
properties: {a: 1}
};
const feature2 = {
type: "Feature",
type: 'Feature',
geometry: geometry2,
properties: {b: 2}
};
const featureCollection = {
type: "FeatureCollection",
type: 'FeatureCollection',
features: [
feature1,
feature2
]
};
it("given a bare geometry returns a GeoJSON-like feature", () => {
it('given a bare geometry returns a GeoJSON-like feature', () => {
const ret = L.GeoJSON.asFeature(geometry1);
expect(ret).to.eql({
type: "Feature",
type: 'Feature',
properties: {},
geometry: geometry1
});
});
it("given a GeoJSON feature directly returns it", () => {
it('given a GeoJSON feature directly returns it', () => {
const ret = L.GeoJSON.asFeature(feature1);
expect(ret).to.eql(feature1);
});
it("given a GeoJSON feature collection directly returns it", () => {
it('given a GeoJSON feature collection directly returns it', () => {
const ret = L.GeoJSON.asFeature(featureCollection);
expect(ret).to.eql(featureCollection);
});

View File

@ -30,12 +30,12 @@ describe('ImageOverlay', () => {
});
});
describe("_image", () => {
describe('_image', () => {
let overlay;
// Url for testing errors
const errorUrl = 'data:image/false;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAT1JREFUOI2dk79qwlAUxr9zcKmxbyAWh0IIDqJrcchkX6ODrn2TDAWRPEkyKKVzBxHJkKFoySP0mlLhnA5NbIgmpf6my73n+853/xFKRLY9UJEpAy6Am2x6q8xLYZ73omhVrKd88DocNpvGPBHwUDYtIiL+9X7/2EmS9GiQiUMC7urER1RfLGPGnSRJGQCyzidiy/Nged6pAdHoo9XyAIAj2x78FfscBEw3jtNnFZn+V5zDIhPOTvsiFHAZv1d1SYIuXyrOaQDYArg9t3gIw1qxML81lHlJFQZfQVBrwKoLFuZ5VUHlO8ggVZ97UbQSEf9cwSEMq7ehOrPjeE0A8N5uXxnLCkA0qs2cIcBzM03vu7vdJwNAJ0lSy5hxVZJy51wMFH5jzsZx+iwyUcBlkS7wc9qsuiBV347jdbH+G/fth7AzHdiJAAAAAElFTkSuQmCC';
const blankUrl = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
const blankUrl = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
// Create overlay for each test
beforeEach(() => {
@ -146,7 +146,7 @@ describe('ImageOverlay', () => {
const _describe = 'crossOrigin' in L.DomUtil.create('img') ? describe : describe.skip; // skip in IE<11
_describe('crossOrigin option', () => {
let overlay;
const blankUrl = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
const blankUrl = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attributes
testCrossOriginValue(undefined, null); // Falsy value (other than empty string '') => no attribute set.

View File

@ -1,6 +1,6 @@
describe('LayerGroup', () => {
describe("#hasLayer", () => {
it("throws when called without proper argument", () => {
describe('#hasLayer', () => {
it('throws when called without proper argument', () => {
const lg = L.layerGroup();
const hasLayer = lg.hasLayer.bind(lg);
expect(hasLayer).withArgs(new L.Layer()).to.not.throwException(); // control case
@ -12,7 +12,7 @@
});
});
describe("#addLayer", () => {
describe('#addLayer', () => {
it('adds a layer', () => {
const lg = L.layerGroup(),
marker = L.marker([0, 0]);
@ -23,7 +23,7 @@
});
});
describe("#removeLayer", () => {
describe('#removeLayer', () => {
it('removes a layer', () => {
const lg = L.layerGroup(),
marker = L.marker([0, 0]);
@ -35,7 +35,7 @@
});
});
describe("#clearLayers", () => {
describe('#clearLayers', () => {
it('removes all layers', () => {
const lg = L.layerGroup(),
marker = L.marker([0, 0]);
@ -47,7 +47,7 @@
});
});
describe("#getLayers", () => {
describe('#getLayers', () => {
it('gets all layers', () => {
const lg = L.layerGroup(),
marker = L.marker([0, 0]);
@ -58,7 +58,7 @@
});
});
describe("#eachLayer", () => {
describe('#eachLayer', () => {
it('iterates over all layers', () => {
const lg = L.layerGroup(),
marker = L.marker([0, 0]),
@ -73,17 +73,17 @@
});
});
describe("#toGeoJSON", () => {
describe('#toGeoJSON', () => {
it('should return valid GeoJSON for a layer with a FeatureCollection', () => {
const geoJSON = {
"type":"FeatureCollection",
"features":[
'type':'FeatureCollection',
'features':[
{
"type":"Feature",
"properties":{},
"geometry": {
"type":"Point",
"coordinates": [78.3984375, 56.9449741808516]
'type':'Feature',
'properties':{},
'geometry': {
'type':'Point',
'coordinates': [78.3984375, 56.9449741808516]
}
}
]
@ -97,7 +97,7 @@
});
});
describe("#invoke", () => {
describe('#invoke', () => {
it('should invoke `setOpacity` method on every layer', () => {
const layers = [
L.marker([0, 0]),

View File

@ -13,7 +13,7 @@ describe('Popup', () => {
});
it("closes on map click when map has closePopupOnClick option", () => {
it('closes on map click when map has closePopupOnClick option', () => {
map.options.closePopupOnClick = true;
const popup = L.popup()
@ -25,7 +25,7 @@ describe('Popup', () => {
expect(map.hasLayer(popup)).to.be(false);
});
it("closes on map click when popup has closeOnClick option", () => {
it('closes on map click when popup has closeOnClick option', () => {
map.options.closePopupOnClick = false;
const popup = L.popup({closeOnClick: true})
@ -37,7 +37,7 @@ describe('Popup', () => {
expect(map.hasLayer(popup)).to.be(false);
});
it("does not close on map click when popup has closeOnClick: false option", () => {
it('does not close on map click when popup has closeOnClick: false option', () => {
map.options.closePopupOnClick = true;
const popup = L.popup({closeOnClick: false})
@ -49,7 +49,7 @@ describe('Popup', () => {
expect(map.hasLayer(popup)).to.be(true);
});
it("toggles its visibility when marker is clicked", () => {
it('toggles its visibility when marker is clicked', () => {
const marker = L.marker(center);
map.addLayer(marker);
@ -65,13 +65,13 @@ describe('Popup', () => {
expect(map.hasLayer(marker._popup)).to.be(false);
});
it("it should use a popup with a function as content with a FeatureGroup", () => {
it('it should use a popup with a function as content with a FeatureGroup', () => {
const marker1 = L.marker(center);
const marker2 = L.marker([54.6, 38.2]);
const group = L.featureGroup([marker1, marker2]).addTo(map);
marker1.description = "I'm marker 1.";
marker2.description = "I'm marker 2.";
marker1.description = 'I\'m marker 1.';
marker2.description = 'I\'m marker 2.';
group.bindPopup(layer => layer.description);
map.options.closePopupOnClick = true;
@ -82,7 +82,7 @@ describe('Popup', () => {
layer: marker1
});
expect(map.hasLayer(group._popup)).to.be(true);
expect(group._popup._contentNode.innerHTML).to.be("I'm marker 1.");
expect(group._popup._contentNode.innerHTML).to.be('I\'m marker 1.');
// toggle popup on marker2
group.fire('click', {
@ -90,16 +90,16 @@ describe('Popup', () => {
layer: marker2
});
expect(map.hasLayer(group._popup)).to.be(true);
expect(group._popup._contentNode.innerHTML).to.be("I'm marker 2.");
expect(group._popup._contentNode.innerHTML).to.be('I\'m marker 2.');
});
it("it should function for popup content after bindPopup is called", () => {
it('it should function for popup content after bindPopup is called', () => {
const marker1 = L.marker(center);
const marker2 = L.marker([54.6, 38.2]);
const group = L.featureGroup([marker1]).addTo(map);
marker1.description = "I'm marker 1.";
marker2.description = "I'm marker 2.";
marker1.description = 'I\'m marker 1.';
marker2.description = 'I\'m marker 2.';
group.bindPopup(layer => layer.description);
group.addLayer(marker2);
@ -112,7 +112,7 @@ describe('Popup', () => {
layer: marker1
});
expect(map.hasLayer(group._popup)).to.be(true);
expect(group._popup._contentNode.innerHTML).to.be("I'm marker 1.");
expect(group._popup._contentNode.innerHTML).to.be('I\'m marker 1.');
// toggle popup on marker2
group.fire('click', {
@ -120,14 +120,14 @@ describe('Popup', () => {
layer: marker2
});
expect(map.hasLayer(group._popup)).to.be(true);
expect(group._popup._contentNode.innerHTML).to.be("I'm marker 2.");
expect(group._popup._contentNode.innerHTML).to.be('I\'m marker 2.');
});
it("should use a function for popup content when a source is passed to Popup", () => {
it('should use a function for popup content when a source is passed to Popup', () => {
const marker = L.marker(center).addTo(map);
L.popup({}, marker);
marker.description = "I am a marker.";
marker.description = 'I am a marker.';
marker.bindPopup(layer => layer.description);
@ -136,10 +136,10 @@ describe('Popup', () => {
});
expect(map.hasLayer(marker._popup)).to.be(true);
expect(marker._popup._contentNode.innerHTML).to.be("I am a marker.");
expect(marker._popup._contentNode.innerHTML).to.be('I am a marker.');
});
it("triggers popupopen on marker when popup opens", () => {
it('triggers popupopen on marker when popup opens', () => {
const marker1 = L.marker(center);
const marker2 = L.marker([57.123076977278, 44.861962891635]);
@ -161,7 +161,7 @@ describe('Popup', () => {
});
// Related to #8558
it("references the correct targets in popupopen event with multiple markers bound to same popup", () => {
it('references the correct targets in popupopen event with multiple markers bound to same popup', () => {
const marker1 = L.marker(center, {testId: 'markerA'});
const marker2 = L.marker([57.123076977278, 44.861962891635], {testId: 'markerB'});
map.addLayer(marker1);
@ -193,7 +193,7 @@ describe('Popup', () => {
expect(spy.called).to.be(true);
});
it("triggers popupclose on marker when popup closes", () => {
it('triggers popupclose on marker when popup closes', () => {
const marker1 = L.marker(center);
const marker2 = L.marker([57.123076977278, 44.861962891635]);
@ -246,7 +246,7 @@ describe('Popup', () => {
L.Icon.Default.prototype.options.popupAnchor = popupAnchorBefore;
});
it.skipIf3d("non-any3d browsers", () => {
it.skipIf3d('non-any3d browsers', () => {
marker1.bindPopup('Popup').addTo(map);
marker1.openPopup();
const defaultLeft = parseInt(marker1._popup._container.style.left, 10);
@ -267,7 +267,7 @@ describe('Popup', () => {
expect(offsetBottom + offset.y).to.eql(defaultBottom);
});
it.skipIfNo3d("any3d browsers", () => {
it.skipIfNo3d('any3d browsers', () => {
marker1.bindPopup('Popup').addTo(map);
marker1.openPopup();
const defaultLeft = marker1._popup._container._leaflet_pos.x;
@ -289,16 +289,16 @@ describe('Popup', () => {
});
});
it("prevents an underlying map click for Layer", () => {
it('prevents an underlying map click for Layer', () => {
const layer = L.polygon([center, [55.9, 37.7], [56.0, 37.8]]).addTo(map);
layer.bindPopup("layer popup");
layer.bindPopup('layer popup');
let mapClicked = false;
map.on('click', (e) => {
mapClicked = true;
L.popup()
.setLatLng(e.latlng)
.setContent("map popup")
.setContent('map popup')
.openOn(map);
});
@ -309,9 +309,9 @@ describe('Popup', () => {
});
it("can open a popup with enter keypress when marker has focus", () => {
it('can open a popup with enter keypress when marker has focus', () => {
const layer = L.marker(center).addTo(map);
layer.bindPopup("layer popup");
layer.bindPopup('layer popup');
happen.keypress(layer._icon, {
keyCode: 13
@ -320,7 +320,7 @@ describe('Popup', () => {
expect(map.hasLayer(layer._popup)).to.be(true);
});
describe("autoPan option should pan popup into visibility", () => {
describe('autoPan option should pan popup into visibility', () => {
// Helper function which calculates the offset of the map-container & popup-container in pixel
function getPopupOffset(map, popup) {
const mapOffset = map._container.getBoundingClientRect().top;
@ -328,10 +328,10 @@ describe('Popup', () => {
return popupOffset - mapOffset;
}
it("should not pan map to show popup content if autoPan is disabled", (done) => {
it('should not pan map to show popup content if autoPan is disabled', (done) => {
map.on('popupopen', (e) => {
const popupTopOffset = getPopupOffset(map, e.popup);
expect(popupTopOffset).to.be.below(0, "The upper edge of the popup should not be visible");
expect(popupTopOffset).to.be.below(0, 'The upper edge of the popup should not be visible');
done();
});
map.openPopup('<div style="height: 400px;"></div>', [58.4, 37.6], {
@ -339,10 +339,10 @@ describe('Popup', () => {
});
});
it("should pan map to show popup content if autoPan is enabled", (done) => {
it('should pan map to show popup content if autoPan is enabled', (done) => {
map.on('popupopen', (e) => {
const popupTopOffset = getPopupOffset(map, e.popup);
expect(popupTopOffset).to.be(10, "The upper edge of the popup have a padding of 10");
expect(popupTopOffset).to.be(10, 'The upper edge of the popup have a padding of 10');
done();
});
map.openPopup('<div style="height: 400px;"></div>', [58.4, 37.6], {
@ -351,7 +351,7 @@ describe('Popup', () => {
});
});
it("should pan map to show popup content if autoPan is enabled even when animating", (done) => {
it('should pan map to show popup content if autoPan is enabled even when animating', (done) => {
map.on('popupopen', (e) => {
const popupTopOffset = getPopupOffset(map, e.popup);
expect(popupTopOffset).to.be(10);
@ -370,47 +370,47 @@ describe('Popup', () => {
});
});
it("opens popup with passed latlng position while initializing", () => {
it('opens popup with passed latlng position while initializing', () => {
const popup = new L.Popup(center)
.openOn(map);
expect(map.hasLayer(popup)).to.be(true);
});
it("opens popup with passed latlng and options position while initializing", () => {
it('opens popup with passed latlng and options position while initializing', () => {
const popup = new L.Popup(center, {className: 'testClass'})
.addTo(map);
expect(map.hasLayer(popup)).to.be(true);
expect(L.DomUtil.hasClass(popup.getElement(), 'testClass')).to.be(true);
});
it("adds popup with passed content in options while initializing", () => {
it('adds popup with passed content in options while initializing', () => {
const popup = new L.Popup(center, {content: 'Test'})
.addTo(map);
expect(map.hasLayer(popup)).to.be(true);
expect(popup.getContent()).to.be('Test');
});
describe("L.Map#openPopup", () => {
it("adds the popup layer to the map", () => {
describe('L.Map#openPopup', () => {
it('adds the popup layer to the map', () => {
const popup = L.popup()
.setLatLng(center);
map.openPopup(popup);
expect(map.hasLayer(popup)).to.be(true);
});
it("sets popup location", () => {
it('sets popup location', () => {
const popup = L.popup();
map.openPopup(popup, center);
expect(popup.getLatLng()).to.be.nearLatLng([55.8, 37.6]);
});
it("creates a popup from content", () => {
map.openPopup("<h2>Hello World</h2>", center);
it('creates a popup from content', () => {
map.openPopup('<h2>Hello World</h2>', center);
expect(map._popup).to.be.an(L.Popup);
expect(map._popup.getContent()).to.eql("<h2>Hello World</h2>");
expect(map._popup.getContent()).to.eql('<h2>Hello World</h2>');
});
it("closes existing popup", () => {
it('closes existing popup', () => {
const p1 = L.popup().setLatLng(center);
const p2 = L.popup().setLatLng(center);
map.openPopup(p1);
@ -418,7 +418,7 @@ describe('Popup', () => {
expect(map.hasLayer(p1)).to.be(false);
});
it("does not close existing popup with autoClose: false option", () => {
it('does not close existing popup with autoClose: false option', () => {
const p1 = L.popup({autoClose: false}).setLatLng(center);
const p2 = L.popup().setLatLng(center);
map.openPopup(p1);
@ -510,7 +510,7 @@ describe('Popup', () => {
map.openPopup(p);
});
it("shows the popup at the correct location when multiple markers are registered", () => {
it('shows the popup at the correct location when multiple markers are registered', () => {
const popup = L.popup();
const marker1 = L.marker([86, 32]).bindPopup(popup).addTo(map);
const marker2 = L.marker([26.3, 83.9]).bindPopup(popup).addTo(map);
@ -532,44 +532,44 @@ describe('Popup', () => {
marker = L.marker([55.8, 37.6]).addTo(map);
});
it("only adds a popup to the map when opened", () => {
marker.bindPopup("new layer");
it('only adds a popup to the map when opened', () => {
marker.bindPopup('new layer');
expect(map.hasLayer(marker.getPopup())).to.be(false);
marker.openPopup();
expect(map.hasLayer(marker.getPopup())).to.be(true);
});
it("keeps an open popup on the map when it's unbound from the layer", () => {
marker.bindPopup("new layer").openPopup();
it('keeps an open popup on the map when it\'s unbound from the layer', () => {
marker.bindPopup('new layer').openPopup();
const popup = marker.getPopup();
marker.unbindPopup();
expect(map.hasLayer(popup)).to.be(true);
});
it("should not give an error when the marker has no popup", () => {
it('should not give an error when the marker has no popup', () => {
expect(() => {
marker.isPopupOpen();
}).to.not.throwException();
expect(marker.isPopupOpen()).to.be(false);
});
it("should show a popup as closed if it's never opened", () => {
marker.bindPopup("new layer");
it('should show a popup as closed if it\'s never opened', () => {
marker.bindPopup('new layer');
expect(marker.isPopupOpen()).to.be(false);
});
it("should show a popup as opend if it's opened", () => {
marker.bindPopup("new layer").openPopup();
it('should show a popup as opend if it\'s opened', () => {
marker.bindPopup('new layer').openPopup();
expect(marker.isPopupOpen()).to.be(true);
});
it("should show a popup as closed if it's opened and closed", () => {
marker.bindPopup("new layer").openPopup().closePopup();
it('should show a popup as closed if it\'s opened and closed', () => {
marker.bindPopup('new layer').openPopup().closePopup();
expect(marker.isPopupOpen()).to.be(false);
});
it("should show the popup as closed if it's unbound", () => {
marker.bindPopup("new layer").openPopup().unbindPopup();
it('should show the popup as closed if it\'s unbound', () => {
marker.bindPopup('new layer').openPopup().unbindPopup();
expect(() => {
marker.isPopupOpen();
}).to.not.throwException();
@ -582,15 +582,15 @@ describe('Popup', () => {
});
expect(() => {
marker.bindPopup("new layer").openPopup();
marker.bindPopup('new layer').openPopup();
done();
}).to.not.throwException();
});
it("does not close popup when clicking on it's tip", () => {
container.style.position = "absolute";
container.style.top = "0";
container.style.left = "0";
it('does not close popup when clicking on it\'s tip', () => {
container.style.position = 'absolute';
container.style.top = '0';
container.style.left = '0';
const popup = L.popup().setLatLng(map.getCenter())
.openOn(map);
@ -606,7 +606,7 @@ describe('Popup', () => {
expect(popup.isOpen()).to.be.ok();
});
it("does not open for empty FeatureGroup", () => {
it('does not open for empty FeatureGroup', () => {
const popup = L.popup();
L.featureGroup([])
.addTo(map)
@ -616,7 +616,7 @@ describe('Popup', () => {
expect(map.hasLayer(popup)).to.not.be.ok();
});
it("uses only visible layers of FeatureGroup for popup content source", () => {
it('uses only visible layers of FeatureGroup for popup content source', () => {
const marker1 = L.marker([1, 1]);
const marker2 = L.marker([2, 2]);
const marker3 = L.marker([3, 3]);

View File

@ -12,7 +12,7 @@ describe('Tooltip', () => {
removeMapContainer(map, container);
});
it("opens on marker mouseover and close on mouseout", () => {
it('opens on marker mouseover and close on mouseout', () => {
const layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip');
@ -25,7 +25,7 @@ describe('Tooltip', () => {
expect(map.hasLayer(layer._tooltip)).to.be(false);
});
it("opens on marker focus and closes on blur", () => {
it('opens on marker focus and closes on blur', () => {
const layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip');
@ -40,7 +40,7 @@ describe('Tooltip', () => {
expect(map.hasLayer(layer._tooltip)).to.be(false);
});
it("opens on marker focus and closes on blur when first bound, then added to map", () => {
it('opens on marker focus and closes on blur when first bound, then added to map', () => {
const layer = L.marker(center);
layer.bindTooltip('Tooltip').addTo(map);
@ -55,7 +55,7 @@ describe('Tooltip', () => {
expect(map.hasLayer(layer._tooltip)).to.be(false);
});
it("opens on marker focus and closes on blur in layer group", () => {
it('opens on marker focus and closes on blur in layer group', () => {
const marker1 = L.marker([41.18, 9.45], {description: 'Marker 1'});
const marker2 = L.marker([41.18, 9.46], {description: 'Marker 2'});
const group = new L.FeatureGroup([marker1, marker2]).addTo(map);
@ -67,7 +67,7 @@ describe('Tooltip', () => {
happen.once(element1, {type:'focus'});
expect(map.hasLayer(group._tooltip)).to.be(true);
expect(group._tooltip._container.innerHTML).to.be("Group tooltip: Marker 1");
expect(group._tooltip._container.innerHTML).to.be('Group tooltip: Marker 1');
happen.once(element1, {type:'blur'});
expect(map.hasLayer(group._tooltip)).to.be(false);
@ -75,13 +75,13 @@ describe('Tooltip', () => {
happen.once(element2, {type:'focus'});
expect(map.hasLayer(group._tooltip)).to.be(true);
expect(group._tooltip._container.innerHTML).to.be("Group tooltip: Marker 2");
expect(group._tooltip._container.innerHTML).to.be('Group tooltip: Marker 2');
happen.once(element2, {type:'blur'});
expect(map.hasLayer(group._tooltip)).to.be(false);
});
it("is mentioned in aria-describedby of a bound layer", () => {
it('is mentioned in aria-describedby of a bound layer', () => {
const layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip');
@ -93,7 +93,7 @@ describe('Tooltip', () => {
expect(element.getAttribute('aria-describedby')).to.equal(tooltip._container.id);
});
it("is mentioned in aria-describedby of a bound layer group", () => {
it('is mentioned in aria-describedby of a bound layer group', () => {
const marker1 = L.marker([41.18, 9.45], {description: 'Marker 1'});
const marker2 = L.marker([41.18, 9.46], {description: 'Marker 2'});
const group = new L.FeatureGroup([marker1, marker2]).addTo(map);
@ -108,14 +108,14 @@ describe('Tooltip', () => {
});
it("stays open on marker when permanent", () => {
it('stays open on marker when permanent', () => {
const layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip', {permanent: true});
expect(map.hasLayer(layer._tooltip)).to.be(true);
});
it("can be added with bindTooltip before added to the map", () => {
it('can be added with bindTooltip before added to the map', () => {
const layer = L.marker(center);
layer.bindTooltip('Tooltip', {permanent: true});
@ -124,7 +124,7 @@ describe('Tooltip', () => {
expect(map.hasLayer(layer._tooltip)).to.be(true);
});
it("is removed when removing marker", () => {
it('is removed when removing marker', () => {
const layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip', {permanent: true});
@ -133,7 +133,7 @@ describe('Tooltip', () => {
expect(map.hasLayer(layer._tooltip)).to.be(false);
});
it("is not interactive by default", () => {
it('is not interactive by default', () => {
const layer = L.marker(center).addTo(map);
const spy = sinon.spy();
@ -143,7 +143,7 @@ describe('Tooltip', () => {
expect(spy.called).to.be(false);
});
it("can be made interactive", () => {
it('can be made interactive', () => {
const layer = L.marker(center).addTo(map);
const spy = sinon.spy();
@ -153,7 +153,7 @@ describe('Tooltip', () => {
expect(spy.calledOnce).to.be(true);
});
it("events are propagated to bound layer", () => {
it('events are propagated to bound layer', () => {
const layer = L.marker(center).addTo(map);
const spy = sinon.spy();
layer.on('click', spy);
@ -163,19 +163,19 @@ describe('Tooltip', () => {
expect(spy.calledOnce).to.be(true);
});
it("has class leaflet-interactive", () => {
it('has class leaflet-interactive', () => {
const layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip', {permanent: true, interactive: true});
expect(L.DomUtil.hasClass(layer._tooltip._container, 'leaflet-interactive')).to.be(true);
});
it("has not class leaflet-interactive", () => {
it('has not class leaflet-interactive', () => {
const layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip', {permanent: true});
expect(L.DomUtil.hasClass(layer._tooltip._container, 'leaflet-interactive')).to.be(false);
});
it("can be forced on left direction", () => {
it('can be forced on left direction', () => {
const layer = L.marker(center).addTo(map);
const spy = sinon.spy();
layer.on('click', spy);
@ -186,7 +186,7 @@ describe('Tooltip', () => {
expect(spy.calledOnce).to.be(true);
});
it("honours offset on left direction", () => {
it('honours offset on left direction', () => {
const layer = L.marker(center).addTo(map);
const spy = sinon.spy();
layer.on('click', spy);
@ -199,7 +199,7 @@ describe('Tooltip', () => {
expect(spy.calledOnce).to.be(true);
});
it("can be forced on top direction", () => {
it('can be forced on top direction', () => {
const layer = L.circleMarker(center).addTo(map);
const spy = sinon.spy();
layer.on('click', spy);
@ -210,7 +210,7 @@ describe('Tooltip', () => {
expect(spy.calledOnce).to.be(true);
});
it("honours offset on top direction", () => {
it('honours offset on top direction', () => {
const layer = L.circleMarker(center).addTo(map);
const spy = sinon.spy();
layer.on('click', spy);
@ -222,7 +222,7 @@ describe('Tooltip', () => {
expect(spy.calledOnce).to.be(true);
});
it("can be forced on bottom direction", () => {
it('can be forced on bottom direction', () => {
const layer = L.circleMarker(center).addTo(map);
const spy = sinon.spy();
layer.on('click', spy);
@ -233,7 +233,7 @@ describe('Tooltip', () => {
expect(spy.calledOnce).to.be(true);
});
it("honours offset on bottom direction", () => {
it('honours offset on bottom direction', () => {
const layer = L.circleMarker(center).addTo(map);
const spy = sinon.spy();
layer.on('click', spy);
@ -246,7 +246,7 @@ describe('Tooltip', () => {
expect(spy.calledOnce).to.be(true);
});
it("can be forced on center", () => {
it('can be forced on center', () => {
const layer = L.marker(center).addTo(map);
const spy = sinon.spy();
layer.on('click', spy);
@ -257,13 +257,13 @@ describe('Tooltip', () => {
expect(spy.calledOnce).to.be(true);
});
it("honours opacity option", () => {
it('honours opacity option', () => {
const layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip', {permanent: true, opacity: 0.57});
expect(layer._tooltip._container.style.opacity).to.eql(0.57);
});
it("can change opacity with setOpacity", () => {
it('can change opacity with setOpacity', () => {
const layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip', {permanent: true});
expect(layer._tooltip._container.style.opacity).to.eql(0.9);
@ -271,9 +271,9 @@ describe('Tooltip', () => {
expect(layer._tooltip._container.style.opacity).to.eql(0.57);
});
it("it should use a tooltip with a function as content with a FeatureGroup", () => {
const marker1 = L.marker([55.8, 37.6], {description: "I'm marker 1."});
const marker2 = L.marker([54.6, 38.2], {description: "I'm marker 2."});
it('it should use a tooltip with a function as content with a FeatureGroup', () => {
const marker1 = L.marker([55.8, 37.6], {description: 'I\'m marker 1.'});
const marker2 = L.marker([54.6, 38.2], {description: 'I\'m marker 2.'});
const group = L.featureGroup([marker1, marker2]).addTo(map);
group.bindTooltip(layer => layer.options.description);
@ -281,15 +281,15 @@ describe('Tooltip', () => {
// toggle popup on marker1
happen.mouseover(marker1._icon, {relatedTarget: map._container});
expect(map.hasLayer(group._tooltip)).to.be(true);
expect(group._tooltip._container.innerHTML).to.be("I'm marker 1.");
expect(group._tooltip._container.innerHTML).to.be('I\'m marker 1.');
// toggle popup on marker2
happen.mouseover(marker2._icon, {relatedTarget: map._container});
expect(map.hasLayer(group._tooltip)).to.be(true);
expect(group._tooltip._container.innerHTML).to.be("I'm marker 2.");
expect(group._tooltip._container.innerHTML).to.be('I\'m marker 2.');
});
it("opens on polygon mouseover and close on mouseout", () => {
it('opens on polygon mouseover and close on mouseout', () => {
const layer = L.polygon([[55.8, 37.6], [55.9, 37.6], [55.8, 37.5]]).addTo(map);
layer.bindTooltip('Tooltip');
@ -302,14 +302,14 @@ describe('Tooltip', () => {
expect(map.hasLayer(layer._tooltip)).to.be(false);
});
it("stays open on polygon when permanent", () => {
it('stays open on polygon when permanent', () => {
const layer = L.polygon([[55.8, 37.6], [55.9, 37.6], [55.8, 37.5]]).addTo(map);
layer.bindTooltip('Tooltip', {permanent: true});
expect(map.hasLayer(layer._tooltip)).to.be(true);
});
it("can be added on polygon with bindTooltip before beind added to the map", () => {
it('can be added on polygon with bindTooltip before beind added to the map', () => {
const layer = L.polygon([[55.8, 37.6], [55.9, 37.6], [55.8, 37.5]]);
layer.bindTooltip('Tooltip', {permanent: true});
@ -322,7 +322,7 @@ describe('Tooltip', () => {
expect(map.hasLayer(layer._tooltip)).to.be(true);
});
it("opens on polyline mouseover and close on mouseout", () => {
it('opens on polyline mouseover and close on mouseout', () => {
const layer = L.polyline([[55.8, 37.6], [55.9, 37.6], [55.8, 37.5]]).addTo(map);
layer.bindTooltip('Tooltip');
@ -335,14 +335,14 @@ describe('Tooltip', () => {
expect(map.hasLayer(layer._tooltip)).to.be(false);
});
it("stays open on polyline when permanent", () => {
it('stays open on polyline when permanent', () => {
const layer = L.polyline([[55.8, 37.6], [55.9, 37.6], [55.8, 37.5]]).addTo(map);
layer.bindTooltip('Tooltip', {permanent: true});
expect(map.hasLayer(layer._tooltip)).to.be(true);
});
it("can be added on polyline with bindTooltip before added to the map", () => {
it('can be added on polyline with bindTooltip before added to the map', () => {
const layer = L.polyline([[55.8, 37.6], [55.9, 37.6], [55.8, 37.5]]);
layer.bindTooltip('Tooltip', {permanent: true});
@ -355,7 +355,7 @@ describe('Tooltip', () => {
expect(map.hasLayer(layer._tooltip)).to.be(true);
});
it.skipIfNotTouch("is opened when tapping on touch", () => {
it.skipIfNotTouch('is opened when tapping on touch', () => {
const layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip');
@ -364,7 +364,7 @@ describe('Tooltip', () => {
expect(map.hasLayer(layer._tooltip)).to.be(true);
});
it.skipIfNotTouch("is closed if not permanent when clicking on the map elsewhere on touch", () => {
it.skipIfNotTouch('is closed if not permanent when clicking on the map elsewhere on touch', () => {
const layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip');
@ -375,7 +375,7 @@ describe('Tooltip', () => {
});
it("opens with map.openTooltip", (done) => {
it('opens with map.openTooltip', (done) => {
map.on('tooltipopen', (e) => {
expect(map.hasLayer(e.tooltip)).to.be(true);
done();
@ -383,7 +383,7 @@ describe('Tooltip', () => {
map.openTooltip('Tooltip', center);
});
it("map.openTooltip considers interactive option", () => {
it('map.openTooltip considers interactive option', () => {
const spy = sinon.spy();
const tooltip = L.tooltip({interactive: true, permanent: true})
.setContent('Tooltip')
@ -394,13 +394,13 @@ describe('Tooltip', () => {
expect(spy.calledOnce).to.be(true);
});
it("can call closeTooltip while not on the map", () => {
it('can call closeTooltip while not on the map', () => {
const layer = L.marker(center);
layer.bindTooltip('Tooltip', {interactive: true});
layer.closeTooltip();
});
it("opens a tooltip and follow the mouse (sticky)", () => {
it('opens a tooltip and follow the mouse (sticky)', () => {
const layer = L.rectangle([[58, 39.7], [54, 35.3]]).addTo(map);
layer.bindTooltip('Sticky', {sticky: true}).openTooltip();
const tooltip = layer.getTooltip();
@ -411,7 +411,7 @@ describe('Tooltip', () => {
expect(tooltip.getLatLng().equals(latlng)).to.be(true);
});
it("opens a permanent tooltip and follow the mouse (sticky)", (done) => {
it('opens a permanent tooltip and follow the mouse (sticky)', (done) => {
const layer = L.rectangle([[58, 39.7], [54, 35.3]]).addTo(map);
layer.bindTooltip('Sticky', {sticky: true, permanent: true}).openTooltip();
const tooltip = layer.getTooltip();
@ -429,9 +429,9 @@ describe('Tooltip', () => {
toucher.wait(100).moveTo(120, 120, 1000).wait(100);
});
it("closes existent tooltip on new bindTooltip call", () => {
it('closes existent tooltip on new bindTooltip call', () => {
const layer = L.marker(center).addTo(map);
const eventSpy = sinon.spy(layer, "unbindTooltip");
const eventSpy = sinon.spy(layer, 'unbindTooltip');
layer.bindTooltip('Tooltip1', {permanent: true});
const tooltip1 = layer.getTooltip();
layer.bindTooltip('Tooltip2').openTooltip();
@ -440,7 +440,7 @@ describe('Tooltip', () => {
expect(eventSpy.calledOnce).to.be.ok();
});
it("don't opens the tooltip on marker mouseover while dragging map", () => {
it('don\'t opens the tooltip on marker mouseover while dragging map', () => {
// Sometimes the mouse is moving faster then the map while dragging and then the marker can be hover and
// the tooltip opened / closed.
const layer = L.marker(center).addTo(map).bindTooltip('Tooltip');
@ -461,7 +461,7 @@ describe('Tooltip', () => {
expect(tooltip.isOpen()).to.be.ok();
});
it("closes the tooltip on marker mouseout while dragging map and don't open it again", () => {
it('closes the tooltip on marker mouseout while dragging map and don\'t open it again', () => {
// Sometimes the mouse is moving faster then the map while dragging and then the marker can be hover and
// the tooltip opened / closed.
const layer = L.marker(center).addTo(map).bindTooltip('Tooltip');
@ -483,20 +483,20 @@ describe('Tooltip', () => {
expect(tooltip.isOpen()).to.be(false);
});
it("opens tooltip with passed latlng position while initializing", () => {
it('opens tooltip with passed latlng position while initializing', () => {
const tooltip = new L.Tooltip(center)
.addTo(map);
expect(map.hasLayer(tooltip)).to.be(true);
});
it("opens tooltip with passed latlng and options position while initializing", () => {
it('opens tooltip with passed latlng and options position while initializing', () => {
const tooltip = new L.Tooltip(center, {className: 'testClass'})
.addTo(map);
expect(map.hasLayer(tooltip)).to.be(true);
expect(L.DomUtil.hasClass(tooltip.getElement(), 'testClass')).to.be(true);
});
it("adds tooltip with passed content in options while initializing", () => {
it('adds tooltip with passed content in options while initializing', () => {
const tooltip = new L.Tooltip(center, {content: 'Test'})
.addTo(map);
expect(map.hasLayer(tooltip)).to.be(true);
@ -504,7 +504,7 @@ describe('Tooltip', () => {
});
// Related to #8558
it("references the correct targets in tooltipopen event with multiple markers bound to same tooltip", () => {
it('references the correct targets in tooltipopen event with multiple markers bound to same tooltip', () => {
const marker1 = L.marker(center, {testId: 'markerA'});
const marker2 = L.marker([57.123076977278, 44.861962891635], {testId: 'markerB'});
map.addLayer(marker1);

View File

@ -1,4 +1,4 @@
describe("Icon.Default", () => {
describe('Icon.Default', () => {
let container, map;
beforeEach(() => {
@ -13,7 +13,7 @@ describe("Icon.Default", () => {
removeMapContainer(map, container);
});
it("detect icon images path", () => {
it('detect icon images path', () => {
const origPath = L.Icon.Default.imagePath; // set in after.js
expect(origPath).to.be.ok();
delete L.Icon.Default.imagePath;
@ -28,7 +28,7 @@ describe("Icon.Default", () => {
const properPath = 'http://localhost:8000/base/dist/images/';
[ // valid
'url("http://localhost:8000/base/dist/images/marker-icon.png")', // Firefox
"url('http://localhost:8000/base/dist/images/marker-icon.png')",
'url(\'http://localhost:8000/base/dist/images/marker-icon.png\')',
'url(http://localhost:8000/base/dist/images/marker-icon.png)', // IE, Edge
].map(stripUrl).forEach((str) => { expect(str).to.be(properPath); });
@ -38,13 +38,13 @@ describe("Icon.Default", () => {
].map(stripUrl).forEach((str) => { expect(str).not.to.be.ok(); });
});
it("icon measures 25x41px", () => {
it('icon measures 25x41px', () => {
const img = map.getPane('markerPane').querySelector('img');
expect(img.clientHeight).to.be(41);
expect(img.clientWidth).to.be(25);
});
it("shadow measures 41x41px", () => {
it('shadow measures 41x41px', () => {
const img = map.getPane('shadowPane').querySelector('img');
expect(img.clientHeight).to.be(41);
expect(img.clientWidth).to.be(41);

View File

@ -1,4 +1,4 @@
describe("Marker.Drag", () => {
describe('Marker.Drag', () => {
let map,
container;
@ -25,8 +25,8 @@ describe("Marker.Drag", () => {
this._initialPos = this._getPosition();
});
describe("drag", () => {
it("drags a marker with mouse", (done) => {
describe('drag', () => {
it('drags a marker with mouse', (done) => {
const marker = new MyMarker([0, 0], {draggable: true}).addTo(map);
const start = L.point(300, 280);
@ -50,7 +50,7 @@ describe("Marker.Drag", () => {
.down().moveBy(5, 0, 20).moveTo(finish.x, finish.y, 1000).up();
});
describe("in CSS scaled container", () => {
describe('in CSS scaled container', () => {
const scale = L.point(2, 1.5);
beforeEach(() => {
@ -58,7 +58,7 @@ describe("Marker.Drag", () => {
container.style.webkitTransform = `scale(${scale.x}, ${scale.y})`;
});
it("drags a marker with mouse, compensating for CSS scale", (done) => {
it('drags a marker with mouse, compensating for CSS scale', (done) => {
const marker = new MyMarker([0, 0], {draggable: true}).addTo(map);
const start = L.point(300, 280);
@ -85,7 +85,7 @@ describe("Marker.Drag", () => {
});
});
it("pans map when autoPan is enabled", (done) => {
it('pans map when autoPan is enabled', (done) => {
const marker = new MyMarker([0, 0], {
draggable: true,
autoPan: true

View File

@ -1,4 +1,4 @@
describe("Marker", () => {
describe('Marker', () => {
let map,
container,
icon1,
@ -20,9 +20,9 @@ describe("Marker", () => {
removeMapContainer(map, container);
});
describe("#setIcon", () => {
describe('#setIcon', () => {
it("set the correct x and y size attributes", () => {
it('set the correct x and y size attributes', () => {
const expectedX = 96;
const expectedY = 100;
const sizedIcon = new L.Icon.Default({
@ -39,7 +39,7 @@ describe("Marker", () => {
expect(icon.style.height).to.be(`${expectedY}px`);
});
it("set the correct x and y size attributes passing only one value", () => {
it('set the correct x and y size attributes passing only one value', () => {
const expectedXY = 96;
const sizedIcon = new L.Icon.Default({
iconUrl: `${icon1.options.iconUrl}?3`,
@ -55,7 +55,7 @@ describe("Marker", () => {
expect(icon.style.height).to.be(`${expectedXY}px`);
});
it("set the correct x and y size attributes passing a L.Point instance", () => {
it('set the correct x and y size attributes passing a L.Point instance', () => {
const expectedXY = 96;
const sizedIcon = new L.Icon.Default({
iconUrl: `${icon1.options.iconUrl}?3`,
@ -71,7 +71,7 @@ describe("Marker", () => {
expect(icon.style.height).to.be(`${expectedXY}px`);
});
it("changes the icon to another image while re-using the IMG element", () => {
it('changes the icon to another image while re-using the IMG element', () => {
const marker = L.marker([0, 0], {icon: icon1});
map.addLayer(marker);
@ -83,7 +83,7 @@ describe("Marker", () => {
expect(afterIcon.src).to.contain(icon2._getIconUrl('icon'));
});
it("preserves draggability", () => {
it('preserves draggability', () => {
const marker = L.marker([0, 0], {icon: icon1});
map.addLayer(marker);
@ -120,7 +120,7 @@ describe("Marker", () => {
expect(marker.dragging.enabled()).to.be(true);
});
it("changes the DivIcon to another DivIcon, while re-using the DIV element", () => {
it('changes the DivIcon to another DivIcon, while re-using the DIV element', () => {
const marker = L.marker([0, 0], {icon: L.divIcon({html: 'Inner1Text'})});
map.addLayer(marker);
@ -132,7 +132,7 @@ describe("Marker", () => {
expect(afterIcon.innerHTML).to.contain('Inner2Text');
});
it("removes text when changing to a blank DivIcon", () => {
it('removes text when changing to a blank DivIcon', () => {
const marker = L.marker([0, 0], {icon: L.divIcon({html: 'Inner1Text'})});
map.addLayer(marker);
@ -141,7 +141,7 @@ describe("Marker", () => {
expect(marker._icon.innerHTML).to.not.contain('Inner1Text');
});
it("changes a DivIcon to an image", () => {
it('changes a DivIcon to an image', () => {
const marker = L.marker([0, 0], {icon: L.divIcon({html: 'Inner1Text'})});
map.addLayer(marker);
const oldIcon = marker._icon;
@ -159,7 +159,7 @@ describe("Marker", () => {
expect(marker._icon.parentNode).to.be(map._panes.markerPane);
});
it("changes an image to a DivIcon", () => {
it('changes an image to a DivIcon', () => {
const marker = L.marker([0, 0], {icon: icon1});
map.addLayer(marker);
const oldIcon = marker._icon;
@ -173,7 +173,7 @@ describe("Marker", () => {
expect(marker._icon.parentNode).to.be(map._panes.markerPane);
});
it("reuses the icon/shadow when changing icon", () => {
it('reuses the icon/shadow when changing icon', () => {
const marker = L.marker([0, 0], {icon: icon1});
map.addLayer(marker);
const oldIcon = marker._icon;
@ -188,7 +188,7 @@ describe("Marker", () => {
expect(marker._shadow.parentNode).to.be(map._panes.shadowPane);
});
it("sets the alt attribute to a default value when no alt text is passed", () => {
it('sets the alt attribute to a default value when no alt text is passed', () => {
const marker = L.marker([0, 0], {icon: icon1});
map.addLayer(marker);
const icon = marker._icon;
@ -196,14 +196,14 @@ describe("Marker", () => {
expect(icon.alt).to.be('Marker');
});
it("doesn't set the alt attribute for DivIcons", () => {
it('doesn\'t set the alt attribute for DivIcons', () => {
const marker = L.marker([0, 0], {icon: L.divIcon(), alt: 'test'});
map.addLayer(marker);
const icon = marker._icon;
expect(icon.hasAttribute('alt')).to.be(false);
});
it("pan map to focus marker", () => {
it('pan map to focus marker', () => {
const marker = L.marker([70, 0], {icon: L.divIcon()});
map.addLayer(marker);
@ -212,7 +212,7 @@ describe("Marker", () => {
}).to.not.throwException();
});
it("pan map to focus marker with no iconSize", () => {
it('pan map to focus marker with no iconSize', () => {
const marker = L.marker([70, 0], {icon: L.divIcon({iconSize: null})});
map.addLayer(marker);
@ -222,8 +222,8 @@ describe("Marker", () => {
});
});
describe("#setLatLng", () => {
it("fires a move event", () => {
describe('#setLatLng', () => {
it('fires a move event', () => {
const marker = L.marker([0, 0], {icon: icon1});
map.addLayer(marker);
@ -297,7 +297,7 @@ describe("Marker", () => {
expect(spy.calledTwice).to.be.ok();
});
it("do not propagate click event", () => {
it('do not propagate click event', () => {
const spy = sinon.spy();
const spy2 = sinon.spy();
const mapSpy = sinon.spy();
@ -312,7 +312,7 @@ describe("Marker", () => {
expect(mapSpy.called).not.to.be.ok();
});
it("do not propagate dblclick event", () => {
it('do not propagate dblclick event', () => {
const spy = sinon.spy();
const spy2 = sinon.spy();
const mapSpy = sinon.spy();
@ -327,7 +327,7 @@ describe("Marker", () => {
expect(mapSpy.called).not.to.be.ok();
});
it("do not catch event if it does not listen to it", (done) => {
it('do not catch event if it does not listen to it', (done) => {
const marker = L.marker([55, 37]);
map.addLayer(marker);
marker.once('mousemove', (e) => {

View File

@ -204,7 +204,7 @@ describe('GridLayer', () => {
});
describe("#onAdd", () => {
describe('#onAdd', () => {
it('is called after zoomend on first map load', () => {
const layer = L.gridLayer().addTo(map);
@ -223,13 +223,13 @@ describe('GridLayer', () => {
});
});
describe("#getMaxZoom, #getMinZoom", () => {
describe('#getMaxZoom, #getMinZoom', () => {
beforeEach(() => {
map.setView([0, 0], 1);
});
describe("when a gridlayer is added to a map with no other layers", () => {
it("has the same zoomlevels as the gridlayer", () => {
describe('when a gridlayer is added to a map with no other layers', () => {
it('has the same zoomlevels as the gridlayer', () => {
const maxZoom = 10,
minZoom = 5;
@ -243,15 +243,15 @@ describe('GridLayer', () => {
});
});
describe("accessing a gridlayer's properties", () => {
describe('accessing a gridlayer\'s properties', () => {
it('provides a container', () => {
const layer = L.gridLayer().addTo(map);
expect(layer.getContainer()).to.be.ok();
});
});
describe("when a gridlayer is added to a map that already has a gridlayer", () => {
it("has its zoomlevels updated to fit the new layer", () => {
describe('when a gridlayer is added to a map that already has a gridlayer', () => {
it('has its zoomlevels updated to fit the new layer', () => {
L.gridLayer({minZoom: 10, maxZoom: 15}).addTo(map);
expect(map.getMinZoom()).to.be(10);
expect(map.getMaxZoom()).to.be(15);
@ -271,8 +271,8 @@ describe('GridLayer', () => {
});
});
describe("when a gridlayer is removed from a map", () => {
it("has its zoomlevels updated to only fit the layers it currently has", () => {
describe('when a gridlayer is removed from a map', () => {
it('has its zoomlevels updated to only fit the layers it currently has', () => {
const tiles = [
L.gridLayer({minZoom: 10, maxZoom: 15}).addTo(map),
L.gridLayer({minZoom: 5, maxZoom: 10}).addTo(map),
@ -301,8 +301,8 @@ describe('GridLayer', () => {
});
});
describe("min/maxNativeZoom option", () => {
it("calls createTile() with maxNativeZoom when map zoom is larger", (done) => {
describe('min/maxNativeZoom option', () => {
it('calls createTile() with maxNativeZoom when map zoom is larger', (done) => {
map.setView([0, 0], 10);
const grid = L.gridLayer({
@ -326,7 +326,7 @@ describe('GridLayer', () => {
map.addLayer(grid);
});
it("calls createTile() with minNativeZoom when map zoom is smaller", (done) => {
it('calls createTile() with minNativeZoom when map zoom is smaller', (done) => {
map.setView([0, 0], 3);
const grid = L.gridLayer({
@ -350,7 +350,7 @@ describe('GridLayer', () => {
map.addLayer(grid);
});
it("redraws tiles properly after changing maxNativeZoom", () => {
it('redraws tiles properly after changing maxNativeZoom', () => {
const initialZoom = 12;
map.setView([0, 0], initialZoom);
@ -363,7 +363,7 @@ describe('GridLayer', () => {
});
});
describe("number of 256px tiles loaded in synchronous non-animated grid @800x600px", () => {
describe('number of 256px tiles loaded in synchronous non-animated grid @800x600px', () => {
let clock, grid, counts;
beforeEach(() => {
@ -407,7 +407,7 @@ describe('GridLayer', () => {
counts = undefined;
});
it("Loads 8 tiles zoom 1", (done) => {
it('Loads 8 tiles zoom 1', (done) => {
grid.on('load', () => {
expect(counts.tileloadstart).to.be(8);
expect(counts.tileload).to.be(8);
@ -419,7 +419,7 @@ describe('GridLayer', () => {
clock.tick(250);
});
it("Loads 5 tiles zoom 0", (done) => {
it('Loads 5 tiles zoom 0', (done) => {
grid.on('load', () => {
expect(counts.tileloadstart).to.be(5);
expect(counts.tileload).to.be(5);
@ -431,7 +431,7 @@ describe('GridLayer', () => {
clock.tick(250);
});
it("Loads 16 tiles zoom 10", (done) => {
it('Loads 16 tiles zoom 10', (done) => {
grid.on('load', () => {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@ -445,7 +445,7 @@ describe('GridLayer', () => {
clock.tick(250);
});
it("Loads 32, unloads 16 tiles zooming in 10-11", (done) => {
it('Loads 32, unloads 16 tiles zooming in 10-11', (done) => {
grid.on('load', () => {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@ -468,7 +468,7 @@ describe('GridLayer', () => {
clock.tick(250);
});
it("Loads 32, unloads 16 tiles zooming out 11-10", (done) => {
it('Loads 32, unloads 16 tiles zooming out 11-10', (done) => {
grid.on('load', () => {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@ -491,7 +491,7 @@ describe('GridLayer', () => {
clock.tick(250);
});
it("Loads 32, unloads 16 tiles zooming out 18-10", (done) => {
it('Loads 32, unloads 16 tiles zooming out 18-10', (done) => {
grid.on('load', () => {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@ -514,7 +514,7 @@ describe('GridLayer', () => {
});
});
describe("number of 256px tiles loaded in synchronous animated grid @800x600px", () => {
describe('number of 256px tiles loaded in synchronous animated grid @800x600px', () => {
let clock, grid, counts;
beforeEach(() => {
@ -581,7 +581,7 @@ describe('GridLayer', () => {
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
it.skipIfNo3d("Loads 32, unloads 16 tiles zooming in 10-11", (done) => {
it.skipIfNo3d('Loads 32, unloads 16 tiles zooming in 10-11', (done) => {
// Advance the time to !== 0 otherwise `tile.loaded` timestamp will appear to be falsy.
clock.tick(1);
// Date.now() is 1.
@ -662,7 +662,7 @@ describe('GridLayer', () => {
// At 1ms, first pruneTile (map fires "viewreset" event => GridLayer._resetView => GridLayer._setView => _pruneTiles).
});
it("Loads 32, unloads 16 tiles zooming in 10-18", (done) => {
it('Loads 32, unloads 16 tiles zooming in 10-18', (done) => {
grid.on('load', () => {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@ -691,7 +691,7 @@ describe('GridLayer', () => {
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
it.skipIfNo3d("Loads 32, unloads 16 tiles zooming out 11-10", (done) => {
it.skipIfNo3d('Loads 32, unloads 16 tiles zooming out 11-10', (done) => {
// Advance the time to !== 0 otherwise `tile.loaded` timestamp will appear to be falsy.
clock.tick(1);
// Date.now() is 1.
@ -764,7 +764,7 @@ describe('GridLayer', () => {
expect(counts.tileloadstart).to.be(16);
});
it("Loads 32, unloads 16 tiles zooming out 18-10", (done) => {
it('Loads 32, unloads 16 tiles zooming out 18-10', (done) => {
grid.on('load', () => {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@ -793,7 +793,7 @@ describe('GridLayer', () => {
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
it.skipIfNo3d("Loads 290, unloads 275 tiles on MAD-TRD flyTo()", function (done) {
it.skipIfNo3d('Loads 290, unloads 275 tiles on MAD-TRD flyTo()', function (done) {
this.timeout(10000); // This test takes longer than usual due to frames
const mad = [40.40, -3.7], trd = [63.41, 10.41];
@ -829,7 +829,7 @@ describe('GridLayer', () => {
});
describe("configurable tile pruning", () => {
describe('configurable tile pruning', () => {
let clock, grid, counts;
beforeEach(() => {
@ -875,7 +875,7 @@ describe('GridLayer', () => {
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
it("Loads map, moves forth by 512 px, keepBuffer = 0", (done) => {
it('Loads map, moves forth by 512 px, keepBuffer = 0', (done) => {
// Advance the time to !== 0 otherwise `tile.loaded` timestamp will appear to be falsy.
clock.tick(1);
// Date.now() is 1.
@ -935,7 +935,7 @@ describe('GridLayer', () => {
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
it("Loads map, moves forth and back by 512 px, keepBuffer = 0", (done) => {
it('Loads map, moves forth and back by 512 px, keepBuffer = 0', (done) => {
grid.once('load', () => {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
@ -979,7 +979,7 @@ describe('GridLayer', () => {
clock.tick(250);
});
it("Loads map, moves forth and back by 512 px, default keepBuffer", (done) => {
it('Loads map, moves forth and back by 512 px, default keepBuffer', (done) => {
const spy = sinon.spy();
grid.on('load', () => {
@ -1012,8 +1012,8 @@ describe('GridLayer', () => {
});
});
describe("nowrap option", () => {
it("When false, uses same coords at zoom 0 for all tiles", (done) => {
describe('nowrap option', () => {
it('When false, uses same coords at zoom 0 for all tiles', (done) => {
const grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256),
@ -1029,12 +1029,12 @@ describe('GridLayer', () => {
map.addLayer(grid).setView([0, 0], 0);
grid.on('load', () => {
expect(loadedTileKeys).to.eql(["0:0:0", "0:0:0", "0:0:0", "0:0:0", "0:0:0"]);
expect(loadedTileKeys).to.eql(['0:0:0', '0:0:0', '0:0:0', '0:0:0', '0:0:0']);
done();
});
});
it("When true, uses different coords at zoom level 0 for all tiles", (done) => {
it('When true, uses different coords at zoom level 0 for all tiles', (done) => {
const grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256),
@ -1055,7 +1055,7 @@ describe('GridLayer', () => {
});
});
it("When true and with bounds, loads just one tile at zoom level 0", (done) => {
it('When true and with bounds, loads just one tile at zoom level 0', (done) => {
const grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256),
@ -1078,15 +1078,15 @@ describe('GridLayer', () => {
});
});
describe("Sanity checks for infinity", () => {
it("Throws error on map center at plus Infinity longitude", () => {
describe('Sanity checks for infinity', () => {
it('Throws error on map center at plus Infinity longitude', () => {
expect(() => {
map.setCenter([Infinity, Infinity]);
L.gridLayer().addTo(map);
}).to.throwError('Attempted to load an infinite number of tiles');
});
it("Throws error on map center at minus Infinity longitude", () => {
it('Throws error on map center at minus Infinity longitude', () => {
expect(() => {
map.setCenter([-Infinity, -Infinity]);
L.gridLayer().addTo(map);
@ -1094,7 +1094,7 @@ describe('GridLayer', () => {
});
});
it("doesn't call map's getZoomScale method with null after _invalidateAll method was called", () => {
it('doesn\'t call map\'s getZoomScale method with null after _invalidateAll method was called', () => {
map.setView([0, 0], 0);
const grid = L.gridLayer().addTo(map);
const wrapped = sinon.spy(map, 'getZoomScale');

View File

@ -4,159 +4,159 @@ describe('TileLayer', () => {
// Placekitten via https://placekitten.com/attribution.html
// Image licensed under CC-by-sa by http://flickr.com/photos/lachlanrogers/
const placeKitten = "data:image/jpeg;base64," +
"/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBF" +
"RyB2NjIpLCBxdWFsaXR5ID0gNjUK/9sAQwALCAgKCAcLCgkKDQwLDREcEhEPDxEiGRoUHCkkKyooJCcn" +
"LTJAN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bPNPkCvONrfOg+UN/n60AAyVLoBvXCnByB71Ai52syblJ6sRhhVpUDFg' +
'G2q2MKTj8ajIACxqvyA8DoM9DxQBHIrZJPPOQucbgPehiqxh8ghVycjnGf5UjeZ1YkBjksfUetKVzHhl' +
'OG7jBI9P60AEIaIAygKTjAPbg4FClZl3MeJOPu8HPFK5Jl3rsbC4XdxnrmmLuXCwxkL3XHXP1/z1oAdc' +
'REGNY13tnPoM+3vUjyCSLaQW2t8wzgn3qAIEmG5y+CGHcA05GVV25AEhJTnkDpQA0H5mUZcBsEsMc+n0' +
'qMEAbA4BUkEHPNTRh5Y2wTuJ6MOvSovLEsSKoMar/Fnk9e9AEzMWg2hsEkjI71DCWhh+V94Xnjk/lTDG' +
'8kRchtw56dc9z/nvTjIftC+YoUtwMHqPegBiYZ98Qdc8fMP5VI+Vh8zZltuCPf2odlWMlmIIOwsw4P69' +
'qQzPJJgDeASMHuOx+lAH/9k=';
beforeEach(() => {
container = createContainer();
@ -182,7 +182,7 @@ describe('TileLayer', () => {
}
}
describe("number of kittens loaded", () => {
describe('number of kittens loaded', () => {
let clock, kittenLayer, counts;
// animationFrame helper, just runs requestAnimFrame() a given number of times
@ -233,7 +233,7 @@ describe('TileLayer', () => {
counts = undefined;
});
it("Loads 8 kittens zoom 1", (done) => {
it('Loads 8 kittens zoom 1', (done) => {
kittenLayer.on('load', () => {
expect(counts.tileloadstart).to.be(8);
expect(counts.tileload).to.be(8);
@ -248,7 +248,7 @@ describe('TileLayer', () => {
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
it.skipIfNo3d("Loads 290, unloads 275 kittens on MAD-TRD flyTo()", function (done) {
it.skipIfNo3d('Loads 290, unloads 275 kittens on MAD-TRD flyTo()', function (done) {
this.timeout(10000); // This test takes longer than usual due to frames
const mad = [40.40, -3.7], trd = [63.41, 10.41];

View File

@ -16,14 +16,14 @@ describe('Canvas', () => {
removeMapContainer(map, container);
});
describe("#events", () => {
describe('#events', () => {
let layer;
beforeEach(() => {
layer = L.polygon(latLngs).addTo(map);
});
it("should fire event when layer contains mouse", () => {
it('should fire event when layer contains mouse', () => {
const spy = sinon.spy();
layer.on('click', spy);
happen.at('click', 50, 50); // Click on the layer.
@ -32,32 +32,32 @@ describe('Canvas', () => {
expect(spy.callCount).to.eql(1);
});
it("DOM events propagate from canvas polygon to map", () => {
it('DOM events propagate from canvas polygon to map', () => {
const spy = sinon.spy();
map.on("click", spy);
map.on('click', spy);
happen.at('click', 50, 50);
expect(spy.callCount).to.eql(1);
});
it("DOM events fired on canvas polygon can be cancelled before being caught by the map", () => {
it('DOM events fired on canvas polygon can be cancelled before being caught by the map', () => {
const mapSpy = sinon.spy();
const layerSpy = sinon.spy();
map.on("click", mapSpy);
layer.on("click", L.DomEvent.stopPropagation).on("click", layerSpy);
map.on('click', mapSpy);
layer.on('click', L.DomEvent.stopPropagation).on('click', layerSpy);
happen.at('click', 50, 50);
expect(layerSpy.callCount).to.eql(1);
expect(mapSpy.callCount).to.eql(0);
});
it("DOM events fired on canvas polygon are propagated only once to the map even when two layers contains the event", () => {
it('DOM events fired on canvas polygon are propagated only once to the map even when two layers contains the event', () => {
const spy = sinon.spy();
L.polygon(latLngs).addTo(map); // layer 2
map.on("click", spy);
map.on('click', spy);
happen.at('click', 50, 50);
expect(spy.callCount).to.eql(1);
});
it("should be transparent for DOM events going to non-canvas features", () => {
it('should be transparent for DOM events going to non-canvas features', () => {
const marker = L.marker(map.layerPointToLatLng([150, 150]))
.addTo(map);
const circle = L.circle(map.layerPointToLatLng([200, 200]), {
@ -69,10 +69,10 @@ describe('Canvas', () => {
const spyMap = sinon.spy();
const spyMarker = sinon.spy();
const spyCircle = sinon.spy();
layer.on("click", spyPolygon);
map.on("click", spyMap);
marker.on("click", spyMarker);
circle.on("click", spyCircle);
layer.on('click', spyPolygon);
map.on('click', spyMap);
marker.on('click', spyMarker);
circle.on('click', spyCircle);
happen.at('click', 50, 50); // polygon (canvas)
happen.at('click', 151, 151); // empty space
@ -84,14 +84,14 @@ describe('Canvas', () => {
expect(spyCircle.callCount).to.eql(1);
});
it("should not block mousemove event going to non-canvas features", () => {
it('should not block mousemove event going to non-canvas features', () => {
const spyMap = sinon.spy();
map.on("mousemove", spyMap);
map.on('mousemove', spyMap);
happen.at('mousemove', 151, 151); // empty space
expect(spyMap.calledOnce).to.be.ok();
});
it("should fire preclick before click", () => {
it('should fire preclick before click', () => {
const clickSpy = sinon.spy();
const preclickSpy = sinon.spy();
layer.on('click', clickSpy);
@ -107,7 +107,7 @@ describe('Canvas', () => {
expect(preclickSpy.callCount).to.eql(1);
});
it("should not fire click when dragging the map on top of it", (done) => {
it('should not fire click when dragging the map on top of it', (done) => {
const downSpy = sinon.spy();
const clickSpy = sinon.spy();
const preclickSpy = sinon.spy();
@ -134,7 +134,7 @@ describe('Canvas', () => {
.down().moveBy(20, 10, 200).up();
});
it("does fire mousedown on layer after dragging map", (done) => { // #7775
it('does fire mousedown on layer after dragging map', (done) => { // #7775
const spy = sinon.spy();
const center = p2ll(300, 300);
const radius = p2ll(200, 200).distanceTo(center);
@ -157,8 +157,8 @@ describe('Canvas', () => {
});
});
describe("#events(interactive=false)", () => {
it("should not fire click when not interactive", () => {
describe('#events(interactive=false)', () => {
it('should not fire click when not interactive', () => {
const layer = L.polygon(latLngs, {interactive: false}).addTo(map);
const spy = sinon.spy();
layer.on('click', spy);
@ -172,14 +172,14 @@ describe('Canvas', () => {
describe('#dashArray', () => {
it('can add polyline with dashArray', () => {
L.polygon(latLngs, {
dashArray: "5,5"
dashArray: '5,5'
}).addTo(map);
});
it('can setStyle with dashArray', () => {
const layer = L.polygon(latLngs).addTo(map);
layer.setStyle({
dashArray: "5,5"
dashArray: '5,5'
});
});
});
@ -249,14 +249,14 @@ describe('Canvas', () => {
});
describe('Canvas #remove', () => {
it("can remove the map without errors", (done) => {
it('can remove the map without errors', (done) => {
L.polygon(latLngs).addTo(map);
map.remove();
map = null;
L.Util.requestAnimFrame(() => { done(); });
});
it("can remove renderer without errors", (done) => {
it('can remove renderer without errors', (done) => {
map.remove();
const canvas = L.canvas();

View File

@ -11,18 +11,18 @@
removeMapContainer(map, container);
});
describe("#_radius", () => {
describe("when a CircleMarker is added to the map ", () => {
describe("with a radius set as an option", () => {
it("takes that radius", () => {
describe('#_radius', () => {
describe('when a CircleMarker is added to the map ', () => {
describe('with a radius set as an option', () => {
it('takes that radius', () => {
const marker = L.circleMarker([0, 0], {radius: 20}).addTo(map);
expect(marker._radius).to.be(20);
});
});
describe("and radius is set before adding it", () => {
it("takes that radius", () => {
describe('and radius is set before adding it', () => {
it('takes that radius', () => {
const marker = L.circleMarker([0, 0], {radius: 20});
marker.setRadius(15);
marker.addTo(map);
@ -30,8 +30,8 @@
});
});
describe("and radius is set after adding it", () => {
it("takes that radius", () => {
describe('and radius is set after adding it', () => {
it('takes that radius', () => {
const marker = L.circleMarker([0, 0], {radius: 20});
marker.addTo(map);
marker.setRadius(15);
@ -39,8 +39,8 @@
});
});
describe("and setStyle is used to change the radius after adding", () => {
it("takes the given radius", () => {
describe('and setStyle is used to change the radius after adding', () => {
it('takes the given radius', () => {
const marker = L.circleMarker([0, 0], {radius: 20});
marker.addTo(map);
marker.setStyle({radius: 15});
@ -48,8 +48,8 @@
});
});
describe("and setStyle is used to change the radius before adding", () => {
it("takes the given radius", () => {
describe('and setStyle is used to change the radius before adding', () => {
it('takes the given radius', () => {
const marker = L.circleMarker([0, 0], {radius: 20});
marker.setStyle({radius: 15});
marker.addTo(map);
@ -59,8 +59,8 @@
});
});
describe("#setLatLng", () => {
it("fires a move event", () => {
describe('#setLatLng', () => {
it('fires a move event', () => {
const marker = L.circleMarker([0, 0]);
map.addLayer(marker);
@ -81,8 +81,8 @@
});
});
describe("#_containsPoint", () => {
it("checks if a point is contained", () => {
describe('#_containsPoint', () => {
it('checks if a point is contained', () => {
const point1 = L.point(200, 200);
const point2 = L.point(10, 10);
const circlemarker = L.circleMarker([10, 10], {radius: 20});

View File

@ -10,8 +10,8 @@ describe('Polygon', () => {
removeMapContainer(map, container);
});
describe("#initialize", () => {
it("should never be flat", () => {
describe('#initialize', () => {
it('should never be flat', () => {
const latLngs = [[1, 2], [3, 4]];
const polygon = L.polygon(latLngs);
@ -20,7 +20,7 @@ describe('Polygon', () => {
expect(polygon.getLatLngs()).to.eql(polygon._latlngs);
});
it("doesn't overwrite the given latlng array", () => {
it('doesn\'t overwrite the given latlng array', () => {
const originalLatLngs = [
[1, 2],
[3, 4]
@ -33,13 +33,13 @@ describe('Polygon', () => {
expect(polygon._latlngs).to.not.eql(sourceLatLngs);
});
it("can be called with an empty array", () => {
it('can be called with an empty array', () => {
const polygon = L.polygon([]);
expect(polygon._latlngs).to.eql([[]]);
expect(polygon.getLatLngs()).to.eql(polygon._latlngs);
});
it("can be initialized with holes", () => {
it('can be initialized with holes', () => {
const originalLatLngs = [
[[0, 10], [10, 10], [10, 0]], // external ring
[[2, 3], [2, 4], [3, 4]] // hole
@ -54,7 +54,7 @@ describe('Polygon', () => {
expect(polygon.getLatLngs()).to.eql(polygon._latlngs);
});
it("can be initialized with multi including hole", () => {
it('can be initialized with multi including hole', () => {
const latLngs = [
[[[10, 20], [30, 40], [50, 60]]],
[[[0, 10], [10, 10], [10, 0]], [[2, 3], [2, 4], [3, 4]]]
@ -69,7 +69,7 @@ describe('Polygon', () => {
expect(polygon.getLatLngs()).to.eql(polygon._latlngs);
});
it("can be added to the map when empty", () => {
it('can be added to the map when empty', () => {
const polygon = L.polygon([]).addTo(map);
const isAdded = map.hasLayer(polygon);
expect(isAdded).to.be(true);
@ -77,7 +77,7 @@ describe('Polygon', () => {
});
describe("#isEmpty", () => {
describe('#isEmpty', () => {
it('should return true for a polygon with no latlngs', () => {
const layer = L.polygon([]);
@ -101,8 +101,8 @@ describe('Polygon', () => {
});
describe("#setLatLngs", () => {
it("doesn't overwrite the given latlng array", () => {
describe('#setLatLngs', () => {
it('doesn\'t overwrite the given latlng array', () => {
const originalLatLngs = [
[1, 2],
[3, 4]
@ -116,7 +116,7 @@ describe('Polygon', () => {
expect(sourceLatLngs).to.eql(originalLatLngs);
});
it("can be set external ring and holes", () => {
it('can be set external ring and holes', () => {
const latLngs = [
[[0, 10], [10, 10], [10, 0]], // external ring
[[2, 3], [2, 4], [3, 4]] // hole
@ -131,7 +131,7 @@ describe('Polygon', () => {
]);
});
it("can be set multi including hole", () => {
it('can be set multi including hole', () => {
const latLngs = [
[[[10, 20], [30, 40], [50, 60]]],
[[[0, 10], [10, 10], [10, 0]], [[2, 3], [2, 4], [3, 4]]]
@ -187,7 +187,7 @@ describe('Polygon', () => {
expect(layer.getCenter()).to.be.nearLatLng(center);
});
it("should compute center for multi-polygon including hole", () => {
it('should compute center for multi-polygon including hole', () => {
const latlngs = [
[[[10, 20], [30, 40], [50, 60]]],
[[[0, 10], [10, 10], [10, 0]], [[2, 3], [2, 4], [3, 4]]]
@ -197,8 +197,8 @@ describe('Polygon', () => {
});
});
describe("#_defaultShape", () => {
it("should return latlngs on a simple polygon", () => {
describe('#_defaultShape', () => {
it('should return latlngs on a simple polygon', () => {
const latlngs = [
L.latLng([1, 2]),
L.latLng([3, 4])
@ -209,7 +209,7 @@ describe('Polygon', () => {
expect(polygon._defaultShape()).to.eql(latlngs);
});
it("should return first latlngs on a polygon with hole", () => {
it('should return first latlngs on a polygon with hole', () => {
const latlngs = [
[L.latLng([0, 12]), L.latLng([13, 14]), L.latLng([15, 16])],
[L.latLng([1, 2]), L.latLng([3, 4]), L.latLng([5, 6])]
@ -220,7 +220,7 @@ describe('Polygon', () => {
expect(polygon._defaultShape()).to.eql(latlngs[0]);
});
it("should return first latlngs on a multipolygon", () => {
it('should return first latlngs on a multipolygon', () => {
const latlngs = [
[[L.latLng([1, 2]), L.latLng([3, 4]), L.latLng([5, 6])]],
[[L.latLng([11, 12]), L.latLng([13, 14]), L.latLng([15, 16])]]
@ -231,7 +231,7 @@ describe('Polygon', () => {
expect(polygon._defaultShape()).to.eql(latlngs[0][0]);
});
it("should return first latlngs on a multipolygon with hole", () => {
it('should return first latlngs on a multipolygon with hole', () => {
const latlngs = [
[[L.latLng([0, 10]), L.latLng([10, 10]), L.latLng([10, 0])],
[L.latLng([2, 3]), L.latLng([2, 4]), L.latLng([3, 4])]],
@ -244,8 +244,8 @@ describe('Polygon', () => {
});
});
describe("#addLatLng", () => {
it("should add latlng to latlngs", () => {
describe('#addLatLng', () => {
it('should add latlng to latlngs', () => {
const latLngs = [
[1, 2],
[3, 4]
@ -258,7 +258,7 @@ describe('Polygon', () => {
expect(polygon._latlngs).to.eql([[L.latLng([1, 2]), L.latLng([3, 4]), L.latLng([5, 6])]]);
});
it("should add latlng to first latlngs on a polygon with hole", () => {
it('should add latlng to first latlngs on a polygon with hole', () => {
const latLngs = [
[[0, 12], [13, 14], [15, 16]],
[[1, 2], [3, 4], [5, 6]]
@ -272,7 +272,7 @@ describe('Polygon', () => {
expect(polygon._latlngs[1]).to.eql([L.latLng([1, 2]), L.latLng([3, 4]), L.latLng([5, 6])]);
});
it("should add latlng by reference on a polygon with hole", () => {
it('should add latlng by reference on a polygon with hole', () => {
const latLngs = [
[[0, 12], [13, 14], [15, 16]],
[[1, 2], [3, 4], [5, 6]]
@ -286,7 +286,7 @@ describe('Polygon', () => {
expect(polygon._latlngs[1]).to.eql([L.latLng([1, 2]), L.latLng([3, 4]), L.latLng([5, 6]), L.latLng([7, 8])]);
});
it("should add latlng to first latlngs on a multi", () => {
it('should add latlng to first latlngs on a multi', () => {
const latLngs = [
[[[1, 2], [3, 4]]],
[[[11, 12], [13, 14], [15, 16]]]
@ -300,7 +300,7 @@ describe('Polygon', () => {
expect(polygon._latlngs[1]).to.eql([[L.latLng([11, 12]), L.latLng([13, 14]), L.latLng([15, 16])]]);
});
it("should add latlng to latlngs by reference on a multi", () => {
it('should add latlng to latlngs by reference on a multi', () => {
const latLngs = [
[[[11, 12], [13, 14], [15, 16]]],
[[[1, 2], [3, 4]]]
@ -314,7 +314,7 @@ describe('Polygon', () => {
expect(polygon._latlngs[0]).to.eql([[L.latLng([11, 12]), L.latLng([13, 14]), L.latLng([15, 16])]]);
});
it("should add latlng on first latlngs by default on a multipolygon with hole", () => {
it('should add latlng on first latlngs by default on a multipolygon with hole', () => {
const latLngs = [
[[[0, 10], [10, 10], [10, 0]], [[2, 3], [2, 4], [3, 4]]],
[[[10, 20], [30, 40], [50, 60]]]
@ -329,7 +329,7 @@ describe('Polygon', () => {
expect(polygon._latlngs[1][0]).to.eql([L.latLng([10, 20]), L.latLng([30, 40]), L.latLng([50, 60])]);
});
it("should add latlng by reference on a multipolygon with hole", () => {
it('should add latlng by reference on a multipolygon with hole', () => {
const latLngs = [
[[[10, 20], [30, 40], [50, 60]]],
[[[0, 10], [10, 10], [10, 0]], [[2, 3], [2, 4], [3, 4]]]
@ -345,8 +345,8 @@ describe('Polygon', () => {
});
});
describe("#setStyle", () => {
it("succeeds for empty Polygon already added to the map", () => {
describe('#setStyle', () => {
it('succeeds for empty Polygon already added to the map', () => {
const style = {
weight: 3
};

View File

@ -10,8 +10,8 @@ describe('Polyline', () => {
removeMapContainer(map, container);
});
describe("#initialize", () => {
it("doesn't overwrite the given latlng array", () => {
describe('#initialize', () => {
it('doesn\'t overwrite the given latlng array', () => {
const originalLatLngs = [
[1, 2],
[3, 4]
@ -25,7 +25,7 @@ describe('Polyline', () => {
expect(polyline.getLatLngs()).to.eql(polyline._latlngs);
});
it("should accept a multi", () => {
it('should accept a multi', () => {
const latLngs = [
[[1, 2], [3, 4], [5, 6]],
[[11, 12], [13, 14], [15, 16]]
@ -38,21 +38,21 @@ describe('Polyline', () => {
expect(polyline.getLatLngs()).to.eql(polyline._latlngs);
});
it("should accept an empty array", () => {
it('should accept an empty array', () => {
const polyline = L.polyline([]);
expect(polyline._latlngs).to.eql([]);
expect(polyline.getLatLngs()).to.eql(polyline._latlngs);
});
it("can be added to the map when empty", () => {
it('can be added to the map when empty', () => {
const polyline = L.polyline([]).addTo(map);
expect(map.hasLayer(polyline)).to.be(true);
});
});
describe("#isEmpty", () => {
describe('#isEmpty', () => {
it('should return true for a polyline with no latlngs', () => {
const polyline = L.polyline([]);
expect(polyline.isEmpty()).to.be(true);
@ -75,8 +75,8 @@ describe('Polyline', () => {
});
describe("#setLatLngs", () => {
it("doesn't overwrite the given latlng array", () => {
describe('#setLatLngs', () => {
it('doesn\'t overwrite the given latlng array', () => {
const originalLatLngs = [
[1, 2],
[3, 4]
@ -90,7 +90,7 @@ describe('Polyline', () => {
expect(sourceLatLngs).to.eql(originalLatLngs);
});
it("can be set a multi", () => {
it('can be set a multi', () => {
const latLngs = [
[[1, 2], [3, 4], [5, 6]],
[[11, 12], [13, 14], [15, 16]]
@ -164,8 +164,8 @@ describe('Polyline', () => {
});
describe("#_defaultShape", () => {
it("should return latlngs when flat", () => {
describe('#_defaultShape', () => {
it('should return latlngs when flat', () => {
const latLngs = [L.latLng([1, 2]), L.latLng([3, 4])];
const polyline = L.polyline(latLngs);
@ -173,7 +173,7 @@ describe('Polyline', () => {
expect(polyline._defaultShape()).to.eql(latLngs);
});
it("should return first latlngs on a multi", () => {
it('should return first latlngs on a multi', () => {
const latLngs = [
[L.latLng([1, 2]), L.latLng([3, 4])],
[L.latLng([11, 12]), L.latLng([13, 14])]
@ -186,8 +186,8 @@ describe('Polyline', () => {
});
describe("#addLatLng", () => {
it("should add latlng to latlngs", () => {
describe('#addLatLng', () => {
it('should add latlng to latlngs', () => {
const latLngs = [
[1, 2],
[3, 4]
@ -200,7 +200,7 @@ describe('Polyline', () => {
expect(polyline._latlngs).to.eql([L.latLng([1, 2]), L.latLng([3, 4]), L.latLng([5, 6])]);
});
it("should add latlng to first latlngs on a multi", () => {
it('should add latlng to first latlngs on a multi', () => {
const latLngs = [
[[1, 2], [3, 4]],
[[11, 12], [13, 14]]
@ -214,7 +214,7 @@ describe('Polyline', () => {
expect(polyline._latlngs[1]).to.eql([L.latLng([11, 12]), L.latLng([13, 14])]);
});
it("should add latlng to latlngs by reference", () => {
it('should add latlng to latlngs by reference', () => {
const latLngs = [
[[11, 12], [13, 14]],
[[1, 2], [3, 4]]
@ -228,7 +228,7 @@ describe('Polyline', () => {
expect(polyline._latlngs[0]).to.eql([L.latLng([11, 12]), L.latLng([13, 14])]);
});
it("should add latlng on empty polyline", () => {
it('should add latlng on empty polyline', () => {
const polyline = L.polyline([]);
polyline.addLatLng([1, 2]);
@ -237,8 +237,8 @@ describe('Polyline', () => {
});
});
describe("#setStyle", () => {
it("succeeds for empty Polyline already added to the map", () => {
describe('#setStyle', () => {
it('succeeds for empty Polyline already added to the map', () => {
const style = {
weight: 3
};
@ -253,8 +253,8 @@ describe('Polyline', () => {
});
});
describe("#setStyle", () => {
it("succeeds for empty Polyline already added to the map", () => {
describe('#setStyle', () => {
it('succeeds for empty Polyline already added to the map', () => {
const style = {
weight: 3
};
@ -269,8 +269,8 @@ describe('Polyline', () => {
});
});
describe("#distance", () => {
it("calculates closestLayerPoint", () => {
describe('#distance', () => {
it('calculates closestLayerPoint', () => {
const p1 = map.latLngToLayerPoint([55.8, 37.6]);
const p2 = map.latLngToLayerPoint([57.123076977278, 44.861962891635]);
const latlngs = [[56.485503424111, 35.545556640339], [55.972522915346, 36.116845702918], [55.502459116923, 34.930322265253], [55.31534617509, 38.973291015816]]

View File

@ -10,8 +10,8 @@ describe('Rectangle', () => {
removeMapContainer(map, container);
});
describe("#initialize", () => {
it("should never be flat", () => {
describe('#initialize', () => {
it('should never be flat', () => {
const latLngs = [[1, 2], [3, 4]];
const rectangle = L.rectangle(latLngs);
@ -20,7 +20,7 @@ describe('Rectangle', () => {
expect(rectangle.getLatLngs()).to.eql(rectangle._latlngs);
});
it("doesn't overwrite the given latlng array", () => {
it('doesn\'t overwrite the given latlng array', () => {
const originalLatLngs = [
[1, 2],
[3, 4]
@ -33,14 +33,14 @@ describe('Rectangle', () => {
expect(rectangle._latlngs).to.not.eql(sourceLatLngs);
});
it("cannot be called with an empty array", () => {
it('cannot be called with an empty array', () => {
// Throws error due to undefined lat
expect(() => {
L.rectangle([]);
}).to.throwException();
});
it("can be initialized with extending bounds", () => {
it('can be initialized with extending bounds', () => {
const originalLatLngs = [
[0, 10], [20, 30],
[40, 50], [60, 70] // extended bounds
@ -55,8 +55,8 @@ describe('Rectangle', () => {
});
});
describe("#setBounds", () => {
it("doesn't overwrite the given latlng array", () => {
describe('#setBounds', () => {
it('doesn\'t overwrite the given latlng array', () => {
const originalLatLngs = [
[1, 2],
[3, 4]
@ -70,7 +70,7 @@ describe('Rectangle', () => {
expect(sourceLatLngs).to.eql(originalLatLngs);
});
it("changes original bounds to new bounds", () => {
it('changes original bounds to new bounds', () => {
const originalLatLngs = [
[1, 2],
[3, 4]
@ -91,7 +91,7 @@ describe('Rectangle', () => {
expect(rectangle.getLatLngs()).to.eql(rectangle._latlngs);
});
it("can be set with extending bounds", () => {
it('can be set with extending bounds', () => {
const originalLatLngs = [
[[2, 3], [4, 5]]
];
@ -111,8 +111,8 @@ describe('Rectangle', () => {
});
});
describe("#Canvas", () => {
it("doesn't apply `focus` listener if element is undefined", () => {
describe('#Canvas', () => {
it('doesn\'t apply `focus` listener if element is undefined', () => {
map.remove();
map = L.map(container, {renderer: L.canvas()});

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
describe("Map.BoxZoom", () => {
describe('Map.BoxZoom', () => {
let container, map;
beforeEach(() => {
@ -14,7 +14,7 @@ describe("Map.BoxZoom", () => {
});
it("cancel boxZoom by pressing ESC and re-enable click event on the map", () => {
it('cancel boxZoom by pressing ESC and re-enable click event on the map', () => {
let mapClick = false;
map.on('click', () => {
mapClick = true;
@ -27,7 +27,7 @@ describe("Map.BoxZoom", () => {
// fire mousedown event with shiftKey = true, to start drawing the boxZoom
let clientX = 100;
let clientY = 100;
let event = new CustomEvent("mousedown");
let event = new CustomEvent('mousedown');
event.shiftKey = true;
event.clientX = clientX;
event.clientY = clientY;
@ -37,7 +37,7 @@ describe("Map.BoxZoom", () => {
// fire mousemove event with shiftKey = true, to draw the boxZoom
clientX += 100;
clientY += 100;
event = new CustomEvent("mousemove");
event = new CustomEvent('mousemove');
event.shiftKey = true;
event.clientX = clientX;
event.clientY = clientY;
@ -45,7 +45,7 @@ describe("Map.BoxZoom", () => {
document.dispatchEvent(event);
// fire keydown event with keyCode = 27 (ESC) to cancel boxZoom
event = new CustomEvent("keydown");
event = new CustomEvent('keydown');
event.keyCode = 27;
document.dispatchEvent(event);

View File

@ -1,4 +1,4 @@
describe("Map.DoubleClickZoom", () => {
describe('Map.DoubleClickZoom', () => {
let container, map;
beforeEach(() => {
@ -14,7 +14,7 @@ describe("Map.DoubleClickZoom", () => {
removeMapContainer(map, container);
});
it("zooms in while dblclick", (done) => {
it('zooms in while dblclick', (done) => {
const zoom = map.getZoom();
map.on('zoomend', () => {
@ -26,7 +26,7 @@ describe("Map.DoubleClickZoom", () => {
happen.dblclick(container);
});
it("zooms out while dblclick and holding shift", (done) => {
it('zooms out while dblclick and holding shift', (done) => {
const zoom = map.getZoom();
map.on('zoomend', () => {
@ -38,7 +38,7 @@ describe("Map.DoubleClickZoom", () => {
happen.dblclick(container, {shiftKey: true});
});
it("doubleClickZoom: 'center'", (done) => {
it('doubleClickZoom: \'center\'', (done) => {
const doubleClickZoomBefore = map.options.doubleClickZoom;
map.options.doubleClickZoom = 'center';
const zoom = map.getZoom();

View File

@ -1,4 +1,4 @@
describe("Map.Drag", () => {
describe('Map.Drag', () => {
let container, map;
beforeEach(() => {
@ -10,8 +10,8 @@ describe("Map.Drag", () => {
removeMapContainer(map, container);
});
describe("#addHook", () => {
it("calls the map with dragging enabled", () => {
describe('#addHook', () => {
it('calls the map with dragging enabled', () => {
map = L.map(container, {
dragging: true
});
@ -21,7 +21,7 @@ describe("Map.Drag", () => {
expect(map.dragging.enabled()).to.be(true);
});
it("calls the map with dragging and worldCopyJump enabled", () => {
it('calls the map with dragging and worldCopyJump enabled', () => {
map = L.map(container, {
dragging: true,
worldCopyJump: true
@ -32,8 +32,8 @@ describe("Map.Drag", () => {
expect(map.dragging.enabled()).to.be(true);
});
it("calls the map with dragging disabled and worldCopyJump enabled; " +
"enables dragging after setting center and zoom", () => {
it('calls the map with dragging disabled and worldCopyJump enabled; ' +
'enables dragging after setting center and zoom', () => {
map = L.map(container, {
dragging: false,
worldCopyJump: true
@ -57,8 +57,8 @@ describe("Map.Drag", () => {
this._initialPos = this._getPosition();
});
describe("mouse events", () => {
it("change the center of the map", (done) => {
describe('mouse events', () => {
it('change the center of the map', (done) => {
map = new MyMap(container, {
dragging: true,
inertia: false
@ -86,7 +86,7 @@ describe("Map.Drag", () => {
.down().moveBy(5, 0, 20).moveTo(finish.x, finish.y, 1000).up();
});
describe("in CSS scaled container", () => {
describe('in CSS scaled container', () => {
const scale = L.point(2, 1.5);
beforeEach(() => {
@ -94,7 +94,7 @@ describe("Map.Drag", () => {
container.style.webkitTransform = `scale(${scale.x}, ${scale.y})`;
});
it("change the center of the map, compensating for CSS scale", (done) => {
it('change the center of the map, compensating for CSS scale', (done) => {
map = new MyMap(container, {
dragging: true,
inertia: false
@ -125,7 +125,7 @@ describe("Map.Drag", () => {
});
});
it("does not change the center of the map when mouse is moved less than the drag threshold", (done) => {
it('does not change the center of the map when mouse is moved less than the drag threshold', (done) => {
map = L.map(container, {
dragging: true,
inertia: false
@ -156,7 +156,7 @@ describe("Map.Drag", () => {
.down().moveBy(1, 0, 20).moveBy(1, 0, 200).up();
});
it("does not trigger preclick nor click", (done) => {
it('does not trigger preclick nor click', (done) => {
map = L.map(container, {
dragging: true,
inertia: false
@ -187,7 +187,7 @@ describe("Map.Drag", () => {
.down().moveBy(5, 0, 20).moveTo(456, 232, 200).up();
});
it("does not trigger preclick nor click when dragging on top of a static marker", (done) => {
it('does not trigger preclick nor click when dragging on top of a static marker', (done) => {
container.style.width = container.style.height = '600px';
map = L.map(container, {
dragging: true,
@ -227,7 +227,7 @@ describe("Map.Drag", () => {
.down().moveBy(5, 0, 20).moveBy(20, 20, 100).up();
});
it("does not trigger preclick nor click when dragging a marker", (done) => {
it('does not trigger preclick nor click when dragging a marker', (done) => {
container.style.width = container.style.height = '600px';
map = L.map(container, {
dragging: true,
@ -267,7 +267,7 @@ describe("Map.Drag", () => {
.down().moveBy(5, 0, 20).moveBy(50, 50, 100).up();
});
it("does not change the center of the map when drag is disabled on click", (done) => {
it('does not change the center of the map when drag is disabled on click', (done) => {
map = L.map(container, {
dragging: true,
inertia: false
@ -301,8 +301,8 @@ describe("Map.Drag", () => {
});
});
describe("touch events", () => {
it.skipIfNotTouch("change the center of the map", (done) => {
describe('touch events', () => {
it.skipIfNotTouch('change the center of the map', (done) => {
map = new MyMap(container, {
dragging: true,
inertia: false
@ -330,7 +330,7 @@ describe("Map.Drag", () => {
.down().moveBy(5, 0, 20).moveTo(finish.x, finish.y, 1000).up();
});
it.skipIfNotTouch("does not change the center of the map when finger is moved less than the drag threshold", (done) => {
it.skipIfNotTouch('does not change the center of the map when finger is moved less than the drag threshold', (done) => {
map = L.map(container, {
dragging: true,
inertia: false

View File

@ -1,4 +1,4 @@
describe("Map.Keyboard", () => {
describe('Map.Keyboard', () => {
const KEYCODE_LOWERCASE_A = 65;
const KEYCODE_ARROW_LEFT = 37;
const KEYCODE_ARROW_UP = 38;
@ -31,8 +31,8 @@ describe("Map.Keyboard", () => {
removeMapContainer(map, container);
});
describe("arrow keys", () => {
it("move the map north", () => {
describe('arrow keys', () => {
it('move the map north', () => {
happen.keydown(document, {keyCode: KEYCODE_ARROW_UP});
happen.keypress(document, {keyCode: KEYCODE_ARROW_UP});
happen.keyup(document, {keyCode: KEYCODE_ARROW_UP});
@ -40,7 +40,7 @@ describe("Map.Keyboard", () => {
expect(map.getCenter().lat).to.be.greaterThan(0);
});
it("move the map south", () => {
it('move the map south', () => {
happen.keydown(document, {keyCode: KEYCODE_ARROW_DOWN});
happen.keypress(document, {keyCode: KEYCODE_ARROW_DOWN});
happen.keyup(document, {keyCode: KEYCODE_ARROW_DOWN});
@ -48,7 +48,7 @@ describe("Map.Keyboard", () => {
expect(map.getCenter().lat).to.be.lessThan(0);
});
it("move the map west", () => {
it('move the map west', () => {
happen.keydown(document, {keyCode: KEYCODE_ARROW_LEFT});
happen.keypress(document, {keyCode: KEYCODE_ARROW_LEFT});
happen.keyup(document, {keyCode: KEYCODE_ARROW_LEFT});
@ -56,7 +56,7 @@ describe("Map.Keyboard", () => {
expect(map.getCenter().lng).to.be.lessThan(0);
});
it("move the map east", () => {
it('move the map east', () => {
happen.keydown(document, {keyCode: KEYCODE_ARROW_RIGHT});
happen.keypress(document, {keyCode: KEYCODE_ARROW_RIGHT});
happen.keyup(document, {keyCode: KEYCODE_ARROW_RIGHT});
@ -64,7 +64,7 @@ describe("Map.Keyboard", () => {
expect(map.getCenter().lng).to.be.greaterThan(0);
});
it("move the map over 180° with worldCopyJump true", () => {
it('move the map over 180° with worldCopyJump true', () => {
map.panTo([0, 178], {animate: false});
map.options.worldCopyJump = true;
@ -76,8 +76,8 @@ describe("Map.Keyboard", () => {
});
});
describe("plus/minus keys", () => {
it("zoom in", () => {
describe('plus/minus keys', () => {
it('zoom in', () => {
happen.keydown(document, {keyCode: KEYCODE_PLUS});
happen.keypress(document, {keyCode: KEYCODE_PLUS});
happen.keyup(document, {keyCode: KEYCODE_PLUS});
@ -85,7 +85,7 @@ describe("Map.Keyboard", () => {
expect(map.getZoom()).to.be.greaterThan(5);
});
it("zoom out", () => {
it('zoom out', () => {
happen.keydown(document, {keyCode: KEYCODE_MINUS});
happen.keypress(document, {keyCode: KEYCODE_MINUS});
happen.keyup(document, {keyCode: KEYCODE_MINUS});
@ -94,8 +94,8 @@ describe("Map.Keyboard", () => {
});
});
describe("does not move the map if disabled", () => {
it("no zoom in", () => {
describe('does not move the map if disabled', () => {
it('no zoom in', () => {
map.keyboard.disable();
@ -106,7 +106,7 @@ describe("Map.Keyboard", () => {
expect(map.getZoom()).to.eql(5);
});
it("no move north", () => {
it('no move north', () => {
map.keyboard.disable();
@ -119,8 +119,8 @@ describe("Map.Keyboard", () => {
});
describe("popup closing", () => {
it("closes a popup when pressing escape", () => {
describe('popup closing', () => {
it('closes a popup when pressing escape', () => {
const popup = L.popup().setLatLng([0, 0]).setContent('Null Island');
map.openPopup(popup);
@ -134,8 +134,8 @@ describe("Map.Keyboard", () => {
});
});
describe("popup closing disabled", () => {
it("close of popup when pressing escape disabled via options", () => {
describe('popup closing disabled', () => {
it('close of popup when pressing escape disabled via options', () => {
const popup = L.popup({closeOnEscapeKey: false}).setLatLng([0, 0]).setContent('Null Island');
map.openPopup(popup);
@ -149,8 +149,8 @@ describe("Map.Keyboard", () => {
});
});
describe("keys events binding", () => {
it("keypress", (done) => {
describe('keys events binding', () => {
it('keypress', (done) => {
const keyDownSpy = sinon.spy();
const keyPressSpy = sinon.spy();
const keyUpSpy = sinon.spy();
@ -166,7 +166,7 @@ describe("Map.Keyboard", () => {
}, 50);
});
it("keydown", (done) => {
it('keydown', (done) => {
const keyDownSpy = sinon.spy();
const keyPressSpy = sinon.spy();
const keyUpSpy = sinon.spy();
@ -182,7 +182,7 @@ describe("Map.Keyboard", () => {
}, 50);
});
it("keyup", (done) => {
it('keyup', (done) => {
const keyDownSpy = sinon.spy();
const keyPressSpy = sinon.spy();
const keyUpSpy = sinon.spy();

View File

@ -1,4 +1,4 @@
describe("Map.ScrollWheelZoom", () => {
describe('Map.ScrollWheelZoom', () => {
let container, map;
const wheel = 'onwheel' in window ? 'wheel' : 'mousewheel';
const scrollIn = {
@ -25,7 +25,7 @@ describe("Map.ScrollWheelZoom", () => {
removeMapContainer(map, container);
});
it("zooms out while firing 'wheel' event", (done) => {
it('zooms out while firing \'wheel\' event', (done) => {
const zoom = map.getZoom();
happen.once(container, scrollOut);
@ -37,7 +37,7 @@ describe("Map.ScrollWheelZoom", () => {
});
});
it("zooms in while firing 'wheel' event", (done) => {
it('zooms in while firing \'wheel\' event', (done) => {
const zoom = map.getZoom();
happen.once(container, scrollIn);
@ -49,7 +49,7 @@ describe("Map.ScrollWheelZoom", () => {
});
});
it("scrollWheelZoom: 'center'", (done) => {
it('scrollWheelZoom: \'center\'', (done) => {
const scrollWheelZoomBefore = map.options.scrollWheelZoom;
map.options.scrollWheelZoom = 'center';
const zoom = map.getZoom();
@ -63,7 +63,7 @@ describe("Map.ScrollWheelZoom", () => {
});
});
it("changes the option 'wheelDebounceTime'", (done) => {
it('changes the option \'wheelDebounceTime\'', (done) => {
const wheelDebounceTimeBefore = map.options.wheelDebounceTime;
map.options.wheelDebounceTime = 100;
const zoom = map.getZoom();
@ -88,7 +88,7 @@ describe("Map.ScrollWheelZoom", () => {
});
});
it("changes the option 'wheelPxPerZoomLevel'", (done) => {
it('changes the option \'wheelPxPerZoomLevel\'', (done) => {
const wheelPxPerZoomLevelBefore = map.options.wheelPxPerZoomLevel;
map.setZoom(15, {animate: false});

View File

@ -1,4 +1,4 @@
describe("Map.TouchZoom", () => {
describe('Map.TouchZoom', () => {
let container, map;
beforeEach(() => {
@ -15,7 +15,7 @@ describe("Map.TouchZoom", () => {
removeMapContainer(map, container);
});
it.skipIfNotTouch("Increases zoom when pinching out", (done) => {
it.skipIfNotTouch('Increases zoom when pinching out', (done) => {
map.setView([0, 0], 1);
map.once('zoomend', () => {
expect(map.getCenter()).to.eql({lat:0, lng:0});
@ -36,7 +36,7 @@ describe("Map.TouchZoom", () => {
.down().moveBy(200, 0, 500).up(100);
});
it.skipIfNotTouch("Decreases zoom when pinching in", (done) => {
it.skipIfNotTouch('Decreases zoom when pinching in', (done) => {
map.setView([0, 0], 4);
map.once('zoomend', () => {
expect(map.getCenter()).to.eql({lat:0, lng:0});
@ -57,7 +57,7 @@ describe("Map.TouchZoom", () => {
.down().moveBy(-200, 0, 500).up(100);
});
it.skipIfNotTouch("fires zoom event while pinch zoom", (done) => {
it.skipIfNotTouch('fires zoom event while pinch zoom', (done) => {
map.setView([0, 0], 4);
const spy = sinon.spy();
@ -91,7 +91,7 @@ describe("Map.TouchZoom", () => {
.down().moveBy(-200, 0, 500).up(100);
});
it.skipIfNotTouch("Dragging is possible after pinch zoom", (done) => {
it.skipIfNotTouch('Dragging is possible after pinch zoom', (done) => {
map.setView([0, 0], 8);
L.polygon([
@ -127,7 +127,7 @@ describe("Map.TouchZoom", () => {
});
it.skipIfNotTouch("TouchZoom works with disabled map dragging", (done) => {
it.skipIfNotTouch('TouchZoom works with disabled map dragging', (done) => {
map.remove();
map = new L.Map(container, {