diff --git a/package.json b/package.json index 99d4e036c..b74751978 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "start": "http-server .", "lint": "eslint js/id && npm run lint:spec:actions", "lint:modules": "eslint modules", - "lint:spec:actions": "eslint test/spec/actions" + "lint:spec:actions": "eslint test/spec/actions", + "lint:spec:behavior": "eslint test/spec/behavior" }, "repository": { "type": "git", diff --git a/test/spec/.eslintrc b/test/spec/.eslintrc index 0ac2e20c4..94c7b0c84 100644 --- a/test/spec/.eslintrc +++ b/test/spec/.eslintrc @@ -5,7 +5,10 @@ "expect": true, "specify": true, "beforeEach": true, - "afterEach": true + "afterEach": true, + "mocha": true, + "sinon": true, + "happen": true }, "rules": { "no-unused-expressions": 0 diff --git a/test/spec/behavior/hover.js b/test/spec/behavior/hover.js index 46fcc1f3a..157b988be 100644 --- a/test/spec/behavior/hover.js +++ b/test/spec/behavior/hover.js @@ -1,4 +1,4 @@ -describe("iD.behavior.Hover", function() { +describe('iD.behavior.Hover', function() { var container, context; beforeEach(function() { @@ -12,16 +12,16 @@ describe("iD.behavior.Hover", function() { container.remove(); }); - describe("#off", function () { - it("removes the .hover class from all elements", function () { + describe('#off', function () { + it('removes the .hover class from all elements', function () { container.append('span').attr('class', 'hover'); container.call(iD.behavior.Hover(context).off); - expect(container.select('span')).not.to.be.classed('hover') + expect(container.select('span')).not.to.be.classed('hover'); }); }); - describe("mouseover", function () { - it("adds the .hover class to all elements to which the same datum is bound", function () { + describe('mouseover', function () { + it('adds the .hover class to all elements to which the same datum is bound', function () { var a = iD.Node({id: 'a'}), b = iD.Node({id: 'b'}); @@ -36,7 +36,7 @@ describe("iD.behavior.Hover", function() { expect(container.selectAll('.b.hover')[0]).to.have.length(0); }); - it("adds the .hover class to all members of a relation", function() { + it('adds the .hover class to all members of a relation', function() { container.selectAll('span') .data([iD.Relation({id: 'a', members: [{id: 'b'}]}), iD.Node({id: 'b'})]) .enter().append('span').attr('class', function(d) { return d.id; }); @@ -49,8 +49,8 @@ describe("iD.behavior.Hover", function() { }); }); - describe("mouseout", function () { - it("removes the .hover class from all elements", function () { + describe('mouseout', function () { + it('removes the .hover class from all elements', function () { container.append('span').attr('class', 'hover'); container.call(iD.behavior.Hover(context)); @@ -60,8 +60,8 @@ describe("iD.behavior.Hover", function() { }); }); - describe("alt keydown", function () { - it("replaces the .hover class with .hover-suppressed", function () { + describe('alt keydown', function () { + it('replaces the .hover class with .hover-suppressed', function () { container.append('span').attr('class', 'hover'); container.call(iD.behavior.Hover(context).altDisables(true)); @@ -72,8 +72,8 @@ describe("iD.behavior.Hover", function() { }); }); - describe("alt keyup", function () { - it("replaces the .hover-suppressed class with .hover", function () { + describe('alt keyup', function () { + it('replaces the .hover-suppressed class with .hover', function () { container.append('span').attr('class', 'hover-suppressed'); container.call(iD.behavior.Hover(context).altDisables(true)); diff --git a/test/spec/behavior/lasso.js b/test/spec/behavior/lasso.js index 160cb2f52..aca4137b3 100644 --- a/test/spec/behavior/lasso.js +++ b/test/spec/behavior/lasso.js @@ -1,4 +1,4 @@ -describe("iD.behavior.Lasso", function () { +describe('iD.behavior.Lasso', function () { var lasso, context; beforeEach(function () { diff --git a/test/spec/behavior/select.js b/test/spec/behavior/select.js index 9e7df8d0f..bb801ec9d 100644 --- a/test/spec/behavior/select.js +++ b/test/spec/behavior/select.js @@ -1,4 +1,4 @@ -describe("iD.behavior.Select", function() { +describe('iD.behavior.Select', function() { var a, b, context, behavior, container; beforeEach(function() { @@ -32,36 +32,36 @@ describe("iD.behavior.Select", function() { container.remove(); }); - specify("click on entity selects the entity", function() { + specify('click on entity selects the entity', function() { happen.click(context.surface().selectAll('.' + a.id).node()); expect(context.selectedIDs()).to.eql([a.id]); }); - specify("click on empty space clears the selection", function() { + specify('click on empty space clears the selection', function() { context.enter(iD.modes.Select(context, [a.id])); happen.click(context.surface().node()); expect(context.mode().id).to.eql('browse'); }); - specify("shift-click on unselected entity adds it to the selection", function() { + specify('shift-click on unselected entity adds it to the selection', function() { context.enter(iD.modes.Select(context, [a.id])); happen.click(context.surface().selectAll('.' + b.id).node(), {shiftKey: true}); expect(context.selectedIDs()).to.eql([a.id, b.id]); }); - specify("shift-click on selected entity removes it from the selection", function() { + specify('shift-click on selected entity removes it from the selection', function() { context.enter(iD.modes.Select(context, [a.id, b.id])); happen.click(context.surface().selectAll('.' + b.id).node(), {shiftKey: true}); expect(context.selectedIDs()).to.eql([a.id]); }); - specify("shift-click on last selected entity clears the selection", function() { + specify('shift-click on last selected entity clears the selection', function() { context.enter(iD.modes.Select(context, [a.id])); happen.click(context.surface().selectAll('.' + a.id).node(), {shiftKey: true}); expect(context.mode().id).to.eql('browse'); }); - specify("shift-click on empty space leaves the selection unchanged", function() { + specify('shift-click on empty space leaves the selection unchanged', function() { context.enter(iD.modes.Select(context, [a.id])); happen.click(context.surface().node(), {shiftKey: true}); expect(context.selectedIDs()).to.eql([a.id]);