fix a bunch of eslint warnings in the spec suite
This commit is contained in:
parent
e749d1915b
commit
d145b1fdba
@ -1,4 +1,5 @@
|
||||
if (!Array.prototype.map) {
|
||||
/*eslint no-extend-native:0*/
|
||||
Array.prototype.map = function (fun /*, thisp */) {
|
||||
"use strict";
|
||||
|
||||
@ -7,7 +8,6 @@ if (!Array.prototype.map) {
|
||||
}
|
||||
|
||||
var t = Object(this);
|
||||
// jshint bitwise: false
|
||||
var len = t.length >>> 0;
|
||||
if (typeof fun !== "function") {
|
||||
throw new TypeError();
|
||||
|
@ -14,7 +14,7 @@ describe('Events', function () {
|
||||
obj.addEventListener('test', spy1);
|
||||
obj.addEventListener('test', spy2);
|
||||
obj.addEventListener('other', spy3);
|
||||
obj.addEventListener({ test: spy4, other: spy5 });
|
||||
obj.addEventListener({test: spy4, other: spy5});
|
||||
// obj.addEventListener({'test other': spy6 });
|
||||
|
||||
expect(spy1.called).to.be(false);
|
||||
@ -72,8 +72,8 @@ describe('Events', function () {
|
||||
|
||||
obj.addEventListener('test', listener1);
|
||||
obj2.addEventListener('test', listener2, foo);
|
||||
obj3.addEventListener({ test: listener3 });
|
||||
obj4.addEventListener({ test: listener4 }, foo);
|
||||
obj3.addEventListener({test: listener3});
|
||||
obj4.addEventListener({test: listener4}, foo);
|
||||
|
||||
obj.fireEvent('test', {baz: 1});
|
||||
obj2.fireEvent('test', {baz: 2});
|
||||
|
@ -40,9 +40,9 @@ describe('Util', function () {
|
||||
return this;
|
||||
};
|
||||
|
||||
var fn2 = L.Util.bind(fn, { foo: 'bar' });
|
||||
var fn2 = L.Util.bind(fn, {foo: 'bar'});
|
||||
|
||||
expect(fn2()).to.eql({ foo: 'bar' });
|
||||
expect(fn2()).to.eql({foo: 'bar'});
|
||||
});
|
||||
|
||||
it('passes additional arguments to the bound function', function () {
|
||||
@ -230,6 +230,7 @@ describe('Util', function () {
|
||||
|
||||
describe('#isArray', function () {
|
||||
expect(L.Util.isArray([1, 2, 3])).to.be(true);
|
||||
/*eslint no-array-constructor:0*/
|
||||
expect(L.Util.isArray(new Array(1, 2, 3))).to.be(true);
|
||||
expect(L.Util.isArray('blabla')).to.be(false);
|
||||
expect(L.Util.isArray({0: 1, 1: 2})).to.be(false);
|
||||
|
@ -117,4 +117,3 @@ describe('LatLng', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
||||
it('iterates over all layers', function () {
|
||||
var lg = L.layerGroup(),
|
||||
marker = L.marker([0, 0]),
|
||||
ctx = { foo: 'bar' };
|
||||
ctx = {foo: 'bar'};
|
||||
|
||||
lg.addLayer(marker);
|
||||
|
||||
|
@ -48,11 +48,11 @@ describe("Marker", function () {
|
||||
});
|
||||
|
||||
it("changes the icon to another DivIcon", function () {
|
||||
var marker = new L.Marker([0, 0], {icon: new L.DivIcon({html: 'Inner1Text' }) });
|
||||
var marker = new L.Marker([0, 0], {icon: new L.DivIcon({html: 'Inner1Text'})});
|
||||
map.addLayer(marker);
|
||||
|
||||
var beforeIcon = marker._icon;
|
||||
marker.setIcon(new L.DivIcon({html: 'Inner2Text' }));
|
||||
marker.setIcon(new L.DivIcon({html: 'Inner2Text'}));
|
||||
var afterIcon = marker._icon;
|
||||
|
||||
expect(beforeIcon).to.be(afterIcon);
|
||||
@ -60,7 +60,7 @@ describe("Marker", function () {
|
||||
});
|
||||
|
||||
it("removes text when changing to a blank DivIcon", function () {
|
||||
var marker = new L.Marker([0, 0], {icon: new L.DivIcon({html: 'Inner1Text' }) });
|
||||
var marker = new L.Marker([0, 0], {icon: new L.DivIcon({html: 'Inner1Text'})});
|
||||
map.addLayer(marker);
|
||||
|
||||
marker.setIcon(new L.DivIcon());
|
||||
@ -70,7 +70,7 @@ describe("Marker", function () {
|
||||
});
|
||||
|
||||
it("changes a DivIcon to an image", function () {
|
||||
var marker = new L.Marker([0, 0], {icon: new L.DivIcon({html: 'Inner1Text' }) });
|
||||
var marker = new L.Marker([0, 0], {icon: new L.DivIcon({html: 'Inner1Text'})});
|
||||
map.addLayer(marker);
|
||||
var oldIcon = marker._icon;
|
||||
|
||||
@ -92,7 +92,7 @@ describe("Marker", function () {
|
||||
map.addLayer(marker);
|
||||
var oldIcon = marker._icon;
|
||||
|
||||
marker.setIcon(new L.DivIcon({html: 'Inner1Text' }));
|
||||
marker.setIcon(new L.DivIcon({html: 'Inner1Text'}));
|
||||
|
||||
expect(oldIcon).to.not.be(marker._icon);
|
||||
expect(oldIcon.parentNode).to.be(null);
|
||||
@ -102,7 +102,7 @@ describe("Marker", function () {
|
||||
});
|
||||
|
||||
it("reuses the icon/shadow when changing icon", function () {
|
||||
var marker = new L.Marker([0, 0], { icon: icon1});
|
||||
var marker = new L.Marker([0, 0], {icon: icon1});
|
||||
map.addLayer(marker);
|
||||
var oldIcon = marker._icon;
|
||||
var oldShadow = marker._shadow;
|
||||
@ -120,7 +120,7 @@ describe("Marker", function () {
|
||||
describe("#setLatLng", function () {
|
||||
it("fires a move event", function () {
|
||||
|
||||
var marker = new L.Marker([0, 0], { icon: icon1 });
|
||||
var marker = new L.Marker([0, 0], {icon: icon1});
|
||||
map.addLayer(marker);
|
||||
|
||||
var beforeLatLng = marker._latlng;
|
||||
|
@ -202,11 +202,12 @@ describe('GridLayer', function () {
|
||||
});
|
||||
describe("when a tilelayer is removed from a map", function () {
|
||||
it("has its zoomlevels updated to only fit the layers it currently has", function () {
|
||||
var tiles = [ L.gridLayer({minZoom: 10, maxZoom: 15}).addTo(map),
|
||||
L.gridLayer({minZoom: 5, maxZoom: 10}).addTo(map),
|
||||
L.gridLayer({minZoom: 10, maxZoom: 20}).addTo(map),
|
||||
L.gridLayer({minZoom: 0, maxZoom: 25}).addTo(map)
|
||||
];
|
||||
var tiles = [
|
||||
L.gridLayer({minZoom: 10, maxZoom: 15}).addTo(map),
|
||||
L.gridLayer({minZoom: 5, maxZoom: 10}).addTo(map),
|
||||
L.gridLayer({minZoom: 10, maxZoom: 20}).addTo(map),
|
||||
L.gridLayer({minZoom: 0, maxZoom: 25}).addTo(map)
|
||||
];
|
||||
map.whenReady(function () {
|
||||
expect(map.getMinZoom()).to.be(0);
|
||||
expect(map.getMaxZoom()).to.be(25);
|
||||
|
@ -8,7 +8,7 @@
|
||||
describe("when a CircleMarker is added to the map ", function () {
|
||||
describe("with a radius set as an option", function () {
|
||||
it("takes that radius", function () {
|
||||
var marker = L.circleMarker([0, 0], { radius: 20 }).addTo(map);
|
||||
var marker = L.circleMarker([0, 0], {radius: 20}).addTo(map);
|
||||
|
||||
expect(marker._radius).to.be(20);
|
||||
});
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
describe("and radius is set before adding it", function () {
|
||||
it("takes that radius", function () {
|
||||
var marker = L.circleMarker([0, 0], { radius: 20 });
|
||||
var marker = L.circleMarker([0, 0], {radius: 20});
|
||||
marker.setRadius(15);
|
||||
marker.addTo(map);
|
||||
expect(marker._radius).to.be(15);
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
describe("and radius is set after adding it", function () {
|
||||
it("takes that radius", function () {
|
||||
var marker = L.circleMarker([0, 0], { radius: 20 });
|
||||
var marker = L.circleMarker([0, 0], {radius: 20});
|
||||
marker.addTo(map);
|
||||
marker.setRadius(15);
|
||||
expect(marker._radius).to.be(15);
|
||||
@ -34,16 +34,16 @@
|
||||
|
||||
describe("and setStyle is used to change the radius after adding", function () {
|
||||
it("takes the given radius", function () {
|
||||
var marker = L.circleMarker([0, 0], { radius: 20 });
|
||||
var marker = L.circleMarker([0, 0], {radius: 20});
|
||||
marker.addTo(map);
|
||||
marker.setStyle({ radius: 15 });
|
||||
marker.setStyle({radius: 15});
|
||||
expect(marker._radius).to.be(15);
|
||||
});
|
||||
});
|
||||
describe("and setStyle is used to change the radius before adding", function () {
|
||||
it("takes the given radius", function () {
|
||||
var marker = L.circleMarker([0, 0], { radius: 20 });
|
||||
marker.setStyle({ radius: 15 });
|
||||
var marker = L.circleMarker([0, 0], {radius: 20});
|
||||
marker.setStyle({radius: 15});
|
||||
marker.addTo(map);
|
||||
expect(marker._radius).to.be(15);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user