Add linting to spec/behavior

This commit is contained in:
Kushan Joshi
2016-06-15 01:20:37 +05:30
parent 6c7786ab27
commit 0e4b1c9d04
5 changed files with 27 additions and 23 deletions
+2 -1
View File
@@ -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",
+4 -1
View File
@@ -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
+13 -13
View File
@@ -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));
+1 -1
View File
@@ -1,4 +1,4 @@
describe("iD.behavior.Lasso", function () {
describe('iD.behavior.Lasso', function () {
var lasso, context;
beforeEach(function () {
+7 -7
View File
@@ -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]);