Skip to content

Commit

Permalink
enforce indentation in specs
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Sep 25, 2015
1 parent 301473a commit cfdbd10
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 153 deletions.
3 changes: 1 addition & 2 deletions spec/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"quotes": 0,
"no-shadow": 0,
"no-irregular-whitespace": 0,
"no-console": 0,
"indent": 0
"no-console": 0
},
"env": {
"mocha": true
Expand Down
16 changes: 8 additions & 8 deletions spec/suites/SpecHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ expect.Assertion.prototype.nearLatLng = function (expected, delta) {

happen.at = function (what, x, y, props) {
this.once(document.elementFromPoint(x, y), L.Util.extend({
type: what,
clientX: x,
clientY: y,
screenX: x,
screenY: y,
which: 1,
button: 0
}, props || {}));
type: what,
clientX: x,
clientY: y,
screenX: x,
screenY: y,
which: 1,
button: 0
}, props || {}));
};
happen.drag = function (fromX, fromY, toX, toY, then, duration) {
happen.at('mousemove', fromX, fromY);
Expand Down
16 changes: 8 additions & 8 deletions spec/suites/control/Control.LayersSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ describe("Control.Layers", function () {

it("is fired on input that changes the base layer", function () {
var baseLayers = {"Layer 1": L.tileLayer(''), "Layer 2": L.tileLayer('')},
layers = L.control.layers(baseLayers).addTo(map),
spy = sinon.spy();
layers = L.control.layers(baseLayers).addTo(map),
spy = sinon.spy();

map.on('baselayerchange', spy);
happen.click(layers._baseLayersList.getElementsByTagName("input")[0]);
Expand All @@ -28,8 +28,8 @@ describe("Control.Layers", function () {

it("is not fired on input that doesn't change the base layer", function () {
var overlays = {"Marker 1": L.marker([0, 0]), "Marker 2": L.marker([0, 0])},
layers = L.control.layers({}, overlays).addTo(map),
spy = sinon.spy();
layers = L.control.layers({}, overlays).addTo(map),
spy = sinon.spy();

map.on('baselayerchange', spy);
happen.click(layers._overlaysList.getElementsByTagName("input")[0]);
Expand All @@ -45,8 +45,8 @@ describe("Control.Layers", function () {

it("when an included layer is addded or removed", function () {
var baseLayer = L.tileLayer(),
overlay = L.marker([0, 0]),
layers = L.control.layers({"Base": baseLayer}, {"Overlay": overlay}).addTo(map);
overlay = L.marker([0, 0]),
layers = L.control.layers({"Base": baseLayer}, {"Overlay": overlay}).addTo(map);

var spy = sinon.spy(layers, '_update');

Expand All @@ -59,8 +59,8 @@ describe("Control.Layers", function () {

it("not when a non-included layer is added or removed", function () {
var baseLayer = L.tileLayer(),
overlay = L.marker([0, 0]),
layers = L.control.layers({"Base": baseLayer}).addTo(map);
overlay = L.marker([0, 0]),
layers = L.control.layers({"Base": baseLayer}).addTo(map);

var spy = sinon.spy(layers, '_update');

Expand Down
8 changes: 4 additions & 4 deletions spec/suites/core/ClassSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ describe("Class", function () {

describe("#extend", function () {
var Klass,
constructor,
method;
constructor,
method;

beforeEach(function () {
constructor = sinon.spy();
Expand Down Expand Up @@ -131,7 +131,7 @@ describe("Class", function () {

it("inherits constructor hooks", function () {
var spy1 = sinon.spy(),
spy2 = sinon.spy();
spy2 = sinon.spy();

var Klass2 = Klass.extend({});

Expand All @@ -146,7 +146,7 @@ describe("Class", function () {

it("does not call child constructor hooks", function () {
var spy1 = sinon.spy(),
spy2 = sinon.spy();
spy2 = sinon.spy();

var Klass2 = Klass.extend({});

Expand Down
86 changes: 43 additions & 43 deletions spec/suites/core/EventsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ describe('Events', function () {

it('fires all listeners added through #addEventListener', function () {
var obj = new L.Evented(),
spy1 = sinon.spy(),
spy2 = sinon.spy(),
spy3 = sinon.spy(),
spy4 = sinon.spy(),
spy5 = sinon.spy(),
spy6 = sinon.spy();
spy1 = sinon.spy(),
spy2 = sinon.spy(),
spy3 = sinon.spy(),
spy4 = sinon.spy(),
spy5 = sinon.spy(),
spy6 = sinon.spy();

obj.addEventListener('test', spy1);
obj.addEventListener('test', spy2);
Expand Down Expand Up @@ -37,10 +37,10 @@ describe('Events', function () {

it('provides event object to listeners and executes them in the right context', function () {
var obj = new L.Evented(),
obj2 = new L.Evented(),
obj3 = new L.Evented(),
obj4 = new L.Evented(),
foo = {};
obj2 = new L.Evented(),
obj3 = new L.Evented(),
obj4 = new L.Evented(),
foo = {};

function listener1(e) {
expect(e.type).to.eql('test');
Expand Down Expand Up @@ -83,11 +83,11 @@ describe('Events', function () {

it('calls no listeners removed through #removeEventListener', function () {
var obj = new L.Evented(),
spy = sinon.spy(),
spy2 = sinon.spy(),
spy3 = sinon.spy(),
spy4 = sinon.spy(),
spy5 = sinon.spy();
spy = sinon.spy(),
spy2 = sinon.spy(),
spy3 = sinon.spy(),
spy4 = sinon.spy(),
spy5 = sinon.spy();

obj.addEventListener('test', spy);
obj.removeEventListener('test', spy);
Expand Down Expand Up @@ -130,9 +130,9 @@ describe('Events', function () {
// added due to context-sensitive removeListener optimization
it('fires multiple listeners with the same context with id', function () {
var obj = new L.Evented(),
spy1 = sinon.spy(),
spy2 = sinon.spy(),
foo = {};
spy1 = sinon.spy(),
spy2 = sinon.spy(),
foo = {};

L.Util.stamp(foo);

Expand All @@ -147,9 +147,9 @@ describe('Events', function () {

it('removes listeners with stamped contexts', function () {
var obj = new L.Evented(),
spy1 = sinon.spy(),
spy2 = sinon.spy(),
foo = {};
spy1 = sinon.spy(),
spy2 = sinon.spy(),
foo = {};

L.Util.stamp(foo);

Expand All @@ -166,9 +166,9 @@ describe('Events', function () {

it('removes listeners with a stamp originally added without one', function () {
var obj = new L.Evented(),
spy1 = sinon.spy(),
spy2 = sinon.spy(),
foo = {};
spy1 = sinon.spy(),
spy2 = sinon.spy(),
foo = {};

obj.addEventListener('test', spy1, foo);
L.Util.stamp(foo);
Expand All @@ -185,10 +185,10 @@ describe('Events', function () {

it('removes listeners with context == this and a stamp originally added without one', function () {
var obj = new L.Evented(),
obj2 = new L.Evented(),
spy1 = sinon.spy(),
spy2 = sinon.spy(),
spy3 = sinon.spy();
obj2 = new L.Evented(),
spy1 = sinon.spy(),
spy2 = sinon.spy(),
spy3 = sinon.spy();

obj.addEventListener('test', spy1, obj);
L.Util.stamp(obj);
Expand Down Expand Up @@ -265,7 +265,7 @@ describe('Events', function () {

it('works like #addEventListener && #removeEventListener', function () {
var obj = new L.Evented(),
spy = sinon.spy();
spy = sinon.spy();

obj.on('test', spy);
obj.fire('test');
Expand All @@ -280,8 +280,8 @@ describe('Events', function () {

it('does not override existing methods with the same name', function () {
var spy1 = sinon.spy(),
spy2 = sinon.spy(),
spy3 = sinon.spy();
spy2 = sinon.spy(),
spy3 = sinon.spy();

var Klass = L.Evented.extend({
on: spy1,
Expand All @@ -305,8 +305,8 @@ describe('Events', function () {
describe("#clearEventListeners", function () {
it("clears all registered listeners on an object", function () {
var spy = sinon.spy(),
obj = new L.Evented(),
otherObj = new L.Evented();
obj = new L.Evented(),
otherObj = new L.Evented();

obj.on('test', spy, obj);
obj.on('testTwo', spy);
Expand All @@ -322,7 +322,7 @@ describe('Events', function () {
describe('#once', function () {
it('removes event listeners after first trigger', function () {
var obj = new L.Evented(),
spy = sinon.spy();
spy = sinon.spy();

obj.once('test', spy, obj);
obj.fire('test');
Expand All @@ -336,8 +336,8 @@ describe('Events', function () {

it('works with an object hash', function () {
var obj = new L.Evented(),
spy = sinon.spy(),
otherSpy = sinon.spy();
spy = sinon.spy(),
otherSpy = sinon.spy();

obj.once({
'test': spy,
Expand All @@ -359,7 +359,7 @@ describe('Events', function () {

it("doesn't call listeners to events that have been removed", function () {
var obj = new L.Evented(),
spy = sinon.spy();
spy = sinon.spy();

obj.once('test', spy, obj);
obj.off('test', spy, obj);
Expand All @@ -371,8 +371,8 @@ describe('Events', function () {

it('works if called from a context that doesnt implement #Events', function () {
var obj = new L.Evented(),
spy = sinon.spy(),
foo = {};
spy = sinon.spy(),
foo = {};

obj.once('test', spy, foo);

Expand All @@ -385,10 +385,10 @@ describe('Events', function () {
describe('addEventParent && removeEventParent', function () {
it('makes the object propagate events with to the given one if fired with propagate=true', function () {
var obj = new L.Evented(),
parent1 = new L.Evented(),
parent2 = new L.Evented(),
spy1 = sinon.spy(),
spy2 = sinon.spy();
parent1 = new L.Evented(),
parent2 = new L.Evented(),
spy1 = sinon.spy(),
spy2 = sinon.spy();

parent1.on('test', spy1);
parent2.on('test', spy2);
Expand Down
20 changes: 10 additions & 10 deletions spec/suites/core/UtilSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ describe('Util', function () {

it('passes additional arguments to the bound function', function () {
var fn = sinon.spy(),
foo = {},
a = {},
b = {},
c = {};
foo = {},
a = {},
b = {},
c = {};

var fn2 = L.Util.bind(fn, foo, a, b);

Expand All @@ -63,13 +63,13 @@ describe('Util', function () {
describe('#stamp', function () {
it('sets a unique id on the given object and returns it', function () {
var a = {},
id = L.Util.stamp(a);
id = L.Util.stamp(a);

expect(typeof id).to.eql('number');
expect(L.Util.stamp(a)).to.eql(id);

var b = {},
id2 = L.Util.stamp(b);
id2 = L.Util.stamp(b);

expect(id2).not.to.eql(id);
});
Expand Down Expand Up @@ -120,7 +120,7 @@ describe('Util', function () {
describe('#requestAnimFrame', function () {
it('calles a function on next frame, unless canceled', function (done) {
var spy = sinon.spy(),
foo = {};
foo = {};

L.Util.requestAnimFrame(spy);

Expand Down Expand Up @@ -179,21 +179,21 @@ describe('Util', function () {

it('creates a distinct options object', function () {
var opts = {},
o = L.Util.create({options: opts});
o = L.Util.create({options: opts});
L.Util.setOptions(o, {});
expect(o.options).not.to.equal(opts);
});

it("doesn't create a distinct options object if object already has own options", function () {
var opts = {},
o = {options: opts};
o = {options: opts};
L.Util.setOptions(o, {});
expect(o.options).to.equal(opts);
});

it('inherits options prototypally', function () {
var opts = {},
o = L.Util.create({options: opts});
o = L.Util.create({options: opts});
L.Util.setOptions(o, {});
opts.foo = 'bar';
expect(o.options.foo).to.eql('bar');
Expand Down
6 changes: 3 additions & 3 deletions spec/suites/dom/DomEventSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('DomEvent', function () {
describe('#addListener', function () {
it('adds a listener and calls it on event', function () {
var listener1 = sinon.spy(),
listener2 = sinon.spy();
listener2 = sinon.spy();

L.DomEvent.addListener(el, 'click', listener1);
L.DomEvent.addListener(el, 'click', listener2);
Expand All @@ -39,7 +39,7 @@ describe('DomEvent', function () {

it('binds "this" to the given context', function () {
var obj = {foo: 'bar'},
result;
result;

L.DomEvent.addListener(el, 'click', function () {
result = this;
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('DomEvent', function () {
describe('#stopPropagation', function () {
it('stops propagation of the given event', function () {
var child = document.createElement('div'),
listener = sinon.spy();
listener = sinon.spy();

el.appendChild(child);

Expand Down
Loading

0 comments on commit cfdbd10

Please sign in to comment.