diff --git a/package.json b/package.json
index 99d4e036c..90f35873c 100644
--- a/package.json
+++ b/package.json
@@ -10,9 +10,8 @@
"scripts": {
"test": "npm run lint && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html dot && make && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index_packaged.html dot",
"start": "http-server .",
- "lint": "eslint js/id && npm run lint:spec:actions",
- "lint:modules": "eslint modules",
- "lint:spec:actions": "eslint test/spec/actions"
+ "lint": "eslint js/id test/spec",
+ "lint:modules": "eslint modules"
},
"repository": {
"type": "git",
diff --git a/test/spec/.eslintrc b/test/.eslintrc
similarity index 63%
rename from test/spec/.eslintrc
rename to test/.eslintrc
index 0ac2e20c4..cc5c83a3e 100644
--- a/test/spec/.eslintrc
+++ b/test/.eslintrc
@@ -5,7 +5,11 @@
"expect": true,
"specify": true,
"beforeEach": true,
- "afterEach": true
+ "afterEach": true,
+ "mocha": true,
+ "sinon": true,
+ "happen": true,
+ "before": 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]);
diff --git a/test/spec/core/connection.js b/test/spec/core/connection.js
index 04f14355f..718707598 100644
--- a/test/spec/core/connection.js
+++ b/test/spec/core/connection.js
@@ -39,20 +39,20 @@ describe('iD.Connection', function () {
});
});
- describe("#switch", function() {
- it("changes the URL", function() {
+ describe('#switch', function() {
+ it('changes the URL', function() {
c.switch({
- url: "http://example.com"
+ url: 'http://example.com'
});
- expect(c.changesetURL(1)).to.equal("http://example.com/changeset/1")
+ expect(c.changesetURL(1)).to.equal('http://example.com/changeset/1');
});
- it("emits an auth event", function(done) {
+ it('emits an auth event', function(done) {
c.on('auth', function() {
done();
});
c.switch({
- url: "http://example.com"
+ url: 'http://example.com'
});
});
});
@@ -111,8 +111,8 @@ describe('iD.Connection', function () {
done();
});
- server.respondWith("GET", "http://www.openstreetmap.org/api/0.6/node/1",
- [200, { "Content-Type": "text/xml" }, nodeXML]);
+ server.respondWith('GET', 'http://www.openstreetmap.org/api/0.6/node/1',
+ [200, { 'Content-Type': 'text/xml' }, nodeXML]);
server.respond();
});
@@ -124,8 +124,8 @@ describe('iD.Connection', function () {
done();
});
- server.respondWith("GET", "http://www.openstreetmap.org/api/0.6/way/1/full",
- [200, { "Content-Type": "text/xml" }, wayXML]);
+ server.respondWith('GET', 'http://www.openstreetmap.org/api/0.6/way/1/full',
+ [200, { 'Content-Type': 'text/xml' }, wayXML]);
server.respond();
});
});
@@ -155,8 +155,8 @@ describe('iD.Connection', function () {
done();
});
- server.respondWith("GET", "http://www.openstreetmap.org/api/0.6/node/1/1",
- [200, { "Content-Type": "text/xml" }, nodeXML]);
+ server.respondWith('GET', 'http://www.openstreetmap.org/api/0.6/node/1/1',
+ [200, { 'Content-Type': 'text/xml' }, nodeXML]);
server.respond();
});
@@ -168,13 +168,14 @@ describe('iD.Connection', function () {
done();
});
- server.respondWith("GET", "http://www.openstreetmap.org/api/0.6/way/1/1",
- [200, { "Content-Type": "text/xml" }, wayXML]);
+ server.respondWith('GET', 'http://www.openstreetmap.org/api/0.6/way/1/1',
+ [200, { 'Content-Type': 'text/xml' }, wayXML]);
server.respond();
});
});
describe('#loadMultiple', function () {
+ var server;
beforeEach(function() {
server = sinon.fakeServer.create();
});
@@ -211,7 +212,7 @@ describe('iD.Connection', function () {
changes = {created: [r, w, n], modified: [], deleted: []},
jxon = c.osmChangeJXON('1234', changes);
- expect(d3.entries(jxon.osmChange['create'])).to.eql([
+ expect(d3.entries(jxon.osmChange.create)).to.eql([
{key: 'node', value: [n.asJXON('1234').node]},
{key: 'way', value: [w.asJXON('1234').way]},
{key: 'relation', value: [r.asJXON('1234').relation]}
@@ -225,7 +226,7 @@ describe('iD.Connection', function () {
changes = {created: [], modified: [r, w, n], deleted: []},
jxon = c.osmChangeJXON('1234', changes);
- expect(jxon.osmChange['modify']).to.eql({
+ expect(jxon.osmChange.modify).to.eql({
node: [n.asJXON('1234').node],
way: [w.asJXON('1234').way],
relation: [r.asJXON('1234').relation]
@@ -239,7 +240,7 @@ describe('iD.Connection', function () {
changes = {created: [], modified: [], deleted: [n, w, r]},
jxon = c.osmChangeJXON('1234', changes);
- expect(d3.entries(jxon.osmChange['delete'])).to.eql([
+ expect(d3.entries(jxon.osmChange.delete)).to.eql([
{key: 'relation', value: [r.asJXON('1234').relation]},
{key: 'way', value: [w.asJXON('1234').way]},
{key: 'node', value: [n.asJXON('1234').node]},
@@ -280,8 +281,8 @@ describe('iD.Connection', function () {
done();
});
- server.respondWith("GET", "http://www.openstreetmap.org/api/0.6/changesets?user=1",
- [200, { "Content-Type": "text/xml" }, changesetsXML]);
+ server.respondWith('GET', 'http://www.openstreetmap.org/api/0.6/changesets?user=1',
+ [200, { 'Content-Type': 'text/xml' }, changesetsXML]);
server.respond();
});
});
@@ -289,6 +290,6 @@ describe('iD.Connection', function () {
describe('#changesetTags', function() {
it('omits comment when empty', function() {
expect(c.changesetTags('', [])).not.to.have.property('comment');
- })
- })
+ });
+ });
});
diff --git a/test/spec/core/difference.js b/test/spec/core/difference.js
index 3a51c4926..b3829127d 100644
--- a/test/spec/core/difference.js
+++ b/test/spec/core/difference.js
@@ -1,6 +1,6 @@
-describe("iD.Difference", function () {
- describe("#changes", function () {
- it("includes created entities", function () {
+describe('iD.Difference', function () {
+ describe('#changes', function () {
+ it('includes created entities', function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph(),
head = base.replace(node),
@@ -8,7 +8,7 @@ describe("iD.Difference", function () {
expect(diff.changes()).to.eql({n: {base: undefined, head: node}});
});
- it("includes undone created entities", function () {
+ it('includes undone created entities', function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph(),
head = base.replace(node),
@@ -16,7 +16,7 @@ describe("iD.Difference", function () {
expect(diff.changes()).to.eql({n: {base: node, head: undefined}});
});
- it("includes modified entities", function () {
+ it('includes modified entities', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.update({ tags: { yes: 'no' } }),
base = iD.Graph([n1]),
@@ -25,7 +25,7 @@ describe("iD.Difference", function () {
expect(diff.changes()).to.eql({n: {base: n1, head: n2}});
});
- it("includes undone modified entities", function () {
+ it('includes undone modified entities', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.update({ tags: { yes: 'no' } }),
base = iD.Graph([n1]),
@@ -34,7 +34,7 @@ describe("iD.Difference", function () {
expect(diff.changes()).to.eql({n: {base: n2, head: n1}});
});
- it("doesn't include updated but identical entities", function () {
+ it('doesn\'t include updated but identical entities', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.update(),
base = iD.Graph([n1]),
@@ -43,7 +43,7 @@ describe("iD.Difference", function () {
expect(diff.changes()).to.eql({});
});
- it("includes deleted entities", function () {
+ it('includes deleted entities', function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph([node]),
head = base.remove(node),
@@ -51,7 +51,7 @@ describe("iD.Difference", function () {
expect(diff.changes()).to.eql({n: {base: node, head: undefined}});
});
- it("includes undone deleted entities", function () {
+ it('includes undone deleted entities', function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph([node]),
head = base.remove(node),
@@ -59,7 +59,7 @@ describe("iD.Difference", function () {
expect(diff.changes()).to.eql({n: {base: undefined, head: node}});
});
- it("doesn't include created entities that were subsequently deleted", function () {
+ it('doesn\'t include created entities that were subsequently deleted', function () {
var node = iD.Node(),
base = iD.Graph(),
head = base.replace(node).remove(node),
@@ -67,7 +67,7 @@ describe("iD.Difference", function () {
expect(diff.changes()).to.eql({});
});
- it("doesn't include created entities that were subsequently reverted", function () {
+ it('doesn\'t include created entities that were subsequently reverted', function () {
var node = iD.Node({id: 'n-1'}),
base = iD.Graph(),
head = base.replace(node).revert('n-1'),
@@ -75,7 +75,7 @@ describe("iD.Difference", function () {
expect(diff.changes()).to.eql({});
});
- it("doesn't include modified entities that were subsequently reverted", function () {
+ it('doesn\'t include modified entities that were subsequently reverted', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.update({ tags: { yes: 'no' } }),
base = iD.Graph([n1]),
@@ -84,7 +84,7 @@ describe("iD.Difference", function () {
expect(diff.changes()).to.eql({});
});
- it("doesn't include deleted entities that were subsequently reverted", function () {
+ it('doesn\'t include deleted entities that were subsequently reverted', function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph([node]),
head = base.remove(node).revert('n'),
@@ -93,8 +93,8 @@ describe("iD.Difference", function () {
});
});
- describe("#extantIDs", function () {
- it("includes the ids of created entities", function () {
+ describe('#extantIDs', function () {
+ it('includes the ids of created entities', function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph(),
head = base.replace(node),
@@ -102,7 +102,7 @@ describe("iD.Difference", function () {
expect(diff.extantIDs()).to.eql(['n']);
});
- it("includes the ids of modified entities", function () {
+ it('includes the ids of modified entities', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.move([1, 2]),
base = iD.Graph([n1]),
@@ -111,7 +111,7 @@ describe("iD.Difference", function () {
expect(diff.extantIDs()).to.eql(['n']);
});
- it("omits the ids of deleted entities", function () {
+ it('omits the ids of deleted entities', function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph([node]),
head = base.remove(node),
@@ -120,8 +120,8 @@ describe("iD.Difference", function () {
});
});
- describe("#created", function () {
- it("returns an array of created entities", function () {
+ describe('#created', function () {
+ it('returns an array of created entities', function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph(),
head = base.replace(node),
@@ -130,8 +130,8 @@ describe("iD.Difference", function () {
});
});
- describe("#modified", function () {
- it("returns an array of modified entities", function () {
+ describe('#modified', function () {
+ it('returns an array of modified entities', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.move([1, 2]),
base = iD.Graph([n1]),
@@ -141,8 +141,8 @@ describe("iD.Difference", function () {
});
});
- describe("#deleted", function () {
- it("returns an array of deleted entities", function () {
+ describe('#deleted', function () {
+ it('returns an array of deleted entities', function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph([node]),
head = base.remove(node),
@@ -151,7 +151,7 @@ describe("iD.Difference", function () {
});
});
- describe("#summary", function () {
+ describe('#summary', function () {
var base = iD.Graph([
iD.Node({id: 'a', tags: {crossing: 'zebra'}}),
iD.Node({id: 'b'}),
@@ -159,7 +159,7 @@ describe("iD.Difference", function () {
iD.Way({id: '-', nodes: ['a', 'b']})
]);
- it("reports a created way as created", function() {
+ it('reports a created way as created', function() {
var way = iD.Way({id: '+'}),
head = base.replace(way),
diff = iD.Difference(base, head);
@@ -171,7 +171,7 @@ describe("iD.Difference", function () {
}]);
});
- it("reports a deleted way as deleted", function() {
+ it('reports a deleted way as deleted', function() {
var way = base.entity('-'),
head = base.remove(way),
diff = iD.Difference(base, head);
@@ -183,7 +183,7 @@ describe("iD.Difference", function () {
}]);
});
- it("reports a modified way as modified", function() {
+ it('reports a modified way as modified', function() {
var way = base.entity('-').mergeTags({highway: 'primary'}),
head = base.replace(way),
diff = iD.Difference(base, head);
@@ -195,7 +195,7 @@ describe("iD.Difference", function () {
}]);
});
- it("reports a way as modified when a member vertex is moved", function() {
+ it('reports a way as modified when a member vertex is moved', function() {
var vertex = base.entity('b').move([0,3]),
head = base.replace(vertex),
diff = iD.Difference(base, head);
@@ -207,7 +207,7 @@ describe("iD.Difference", function () {
}]);
});
- it("reports a way as modified when a member vertex is added", function() {
+ it('reports a way as modified when a member vertex is added', function() {
var vertex = iD.Node({id: 'c'}),
way = base.entity('-').addNode('c'),
head = base.replace(vertex).replace(way),
@@ -220,7 +220,7 @@ describe("iD.Difference", function () {
}]);
});
- it("reports a way as modified when a member vertex is removed", function() {
+ it('reports a way as modified when a member vertex is removed', function() {
var way = base.entity('-').removeNode('b'),
head = base.replace(way),
diff = iD.Difference(base, head);
@@ -232,7 +232,7 @@ describe("iD.Difference", function () {
}]);
});
- it("reports a created way containing a moved vertex as being created", function() {
+ it('reports a created way containing a moved vertex as being created', function() {
var vertex = base.entity('b').move([0,3]),
way = iD.Way({id: '+', nodes: ['b']}),
head = base.replace(way).replace(vertex),
@@ -249,7 +249,7 @@ describe("iD.Difference", function () {
}]);
});
- it("reports a created way with a created vertex as being created", function() {
+ it('reports a created way with a created vertex as being created', function() {
var vertex = iD.Node({id: 'c'}),
way = iD.Way({id: '+', nodes: ['c']}),
head = base.replace(vertex).replace(way),
@@ -262,7 +262,7 @@ describe("iD.Difference", function () {
}]);
});
- it("reports a vertex as modified when it has tags and they are changed", function() {
+ it('reports a vertex as modified when it has tags and they are changed', function() {
var vertex = base.entity('a').mergeTags({highway: 'traffic_signals'}),
head = base.replace(vertex),
diff = iD.Difference(base, head);
@@ -274,7 +274,7 @@ describe("iD.Difference", function () {
}]);
});
- it("reports a vertex as modified when it has tags and is moved", function() {
+ it('reports a vertex as modified when it has tags and is moved', function() {
var vertex = base.entity('a').move([1, 2]),
head = base.replace(vertex),
diff = iD.Difference(base, head);
@@ -290,7 +290,7 @@ describe("iD.Difference", function () {
}]);
});
- it("does not report a vertex as modified when it is moved and has no-op tag changes", function() {
+ it('does not report a vertex as modified when it is moved and has no-op tag changes', function() {
var vertex = base.entity('b').update({tags: {}, loc: [1, 2]}),
head = base.replace(vertex),
diff = iD.Difference(base, head);
@@ -302,7 +302,7 @@ describe("iD.Difference", function () {
}]);
});
- it("reports a vertex as deleted when it had tags", function() {
+ it('reports a vertex as deleted when it had tags', function() {
var vertex = base.entity('v'),
head = base.remove(vertex),
diff = iD.Difference(base, head);
@@ -314,7 +314,7 @@ describe("iD.Difference", function () {
}]);
});
- it("reports a vertex as created when it has tags", function() {
+ it('reports a vertex as created when it has tags', function() {
var vertex = iD.Node({id: 'c', tags: {crossing: 'zebra'}}),
way = base.entity('-').addNode('c'),
head = base.replace(way).replace(vertex),
@@ -332,25 +332,25 @@ describe("iD.Difference", function () {
});
});
- describe("#complete", function () {
- it("includes created entities", function () {
+ describe('#complete', function () {
+ it('includes created entities', function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph(),
head = base.replace(node),
diff = iD.Difference(base, head);
- expect(diff.complete()['n']).to.equal(node);
+ expect(diff.complete().n).to.equal(node);
});
- it("includes modified entities", function () {
+ it('includes modified entities', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.move([1, 2]),
base = iD.Graph([n1]),
head = base.replace(n2),
diff = iD.Difference(base, head);
- expect(diff.complete()['n']).to.equal(n2);
+ expect(diff.complete().n).to.equal(n2);
});
- it("includes deleted entities", function () {
+ it('includes deleted entities', function () {
var node = iD.Node({id: 'n'}),
base = iD.Graph([node]),
head = base.remove(node),
@@ -358,7 +358,7 @@ describe("iD.Difference", function () {
expect(diff.complete()).to.eql({n: undefined});
});
- it("includes nodes added to a way", function () {
+ it('includes nodes added to a way', function () {
var n1 = iD.Node({id: 'n1'}),
n2 = iD.Node({id: 'n2'}),
w1 = iD.Way({id: 'w', nodes: ['n1']}),
@@ -367,10 +367,10 @@ describe("iD.Difference", function () {
head = base.replace(w2),
diff = iD.Difference(base, head);
- expect(diff.complete()['n2']).to.equal(n2);
+ expect(diff.complete().n2).to.equal(n2);
});
- it("includes nodes removed from a way", function () {
+ it('includes nodes removed from a way', function () {
var n1 = iD.Node({id: 'n1'}),
n2 = iD.Node({id: 'n2'}),
w1 = iD.Way({id: 'w', nodes: ['n1', 'n2']}),
@@ -379,10 +379,10 @@ describe("iD.Difference", function () {
head = base.replace(w2),
diff = iD.Difference(base, head);
- expect(diff.complete()['n2']).to.equal(n2);
+ expect(diff.complete().n2).to.equal(n2);
});
- it("includes parent ways of modified nodes", function () {
+ it('includes parent ways of modified nodes', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.move([1, 2]),
way = iD.Way({id: 'w', nodes: ['n']}),
@@ -390,10 +390,10 @@ describe("iD.Difference", function () {
head = base.replace(n2),
diff = iD.Difference(base, head);
- expect(diff.complete()['w']).to.equal(way);
+ expect(diff.complete().w).to.equal(way);
});
- it("includes parent relations of modified entities", function () {
+ it('includes parent relations of modified entities', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.move([1, 2]),
rel = iD.Relation({id: 'r', members: [{id: 'n'}]}),
@@ -401,10 +401,10 @@ describe("iD.Difference", function () {
head = base.replace(n2),
diff = iD.Difference(base, head);
- expect(diff.complete()['r']).to.equal(rel);
+ expect(diff.complete().r).to.equal(rel);
});
- it("includes parent relations of modified entities, recursively", function () {
+ it('includes parent relations of modified entities, recursively', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.move([1, 2]),
rel1 = iD.Relation({id: 'r1', members: [{id: 'n'}]}),
@@ -413,10 +413,10 @@ describe("iD.Difference", function () {
head = base.replace(n2),
diff = iD.Difference(base, head);
- expect(diff.complete()['r2']).to.equal(rel2);
+ expect(diff.complete().r2).to.equal(rel2);
});
- it("includes parent relations of parent ways of modified nodes", function () {
+ it('includes parent relations of parent ways of modified nodes', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.move([1, 2]),
way = iD.Way({id: 'w', nodes: ['n']}),
@@ -425,10 +425,10 @@ describe("iD.Difference", function () {
head = base.replace(n2),
diff = iD.Difference(base, head);
- expect(diff.complete()['r']).to.equal(rel);
+ expect(diff.complete().r).to.equal(rel);
});
- it("copes with recursive relations", function () {
+ it('copes with recursive relations', function () {
var node = iD.Node({id: 'n'}),
rel1 = iD.Relation({id: 'r1', members: [{id: 'n'}, {id: 'r2'}]}),
rel2 = iD.Relation({id: 'r2', members: [{id: 'r1'}]}),
@@ -439,6 +439,6 @@ describe("iD.Difference", function () {
expect(diff.complete()).to.be.ok;
});
- it("limits changes to those within a given extent");
+ it('limits changes to those within a given extent');
});
});
diff --git a/test/spec/core/entity.js b/test/spec/core/entity.js
index 50012798f..03c308f1c 100644
--- a/test/spec/core/entity.js
+++ b/test/spec/core/entity.js
@@ -1,5 +1,5 @@
describe('iD.Entity', function () {
- it("returns a subclass of the appropriate type", function () {
+ it('returns a subclass of the appropriate type', function () {
expect(iD.Entity({type: 'node'})).be.an.instanceOf(iD.Node);
expect(iD.Entity({type: 'way'})).be.an.instanceOf(iD.Way);
expect(iD.Entity({type: 'relation'})).be.an.instanceOf(iD.Relation);
@@ -9,42 +9,42 @@ describe('iD.Entity', function () {
});
if (iD.debug) {
- it("is frozen", function () {
+ it('is frozen', function () {
expect(Object.isFrozen(iD.Entity())).to.be.true;
});
- it("freezes tags", function () {
+ it('freezes tags', function () {
expect(Object.isFrozen(iD.Entity().tags)).to.be.true;
});
}
- describe(".id", function () {
- it("generates unique IDs", function () {
+ describe('.id', function () {
+ it('generates unique IDs', function () {
expect(iD.Entity.id('node')).not.to.equal(iD.Entity.id('node'));
});
- describe(".fromOSM", function () {
- it("returns a ID string unique across entity types", function () {
- expect(iD.Entity.id.fromOSM('node', '1')).to.equal("n1");
+ describe('.fromOSM', function () {
+ it('returns a ID string unique across entity types', function () {
+ expect(iD.Entity.id.fromOSM('node', '1')).to.equal('n1');
});
});
- describe(".toOSM", function () {
- it("reverses fromOSM", function () {
+ describe('.toOSM', function () {
+ it('reverses fromOSM', function () {
expect(iD.Entity.id.toOSM(iD.Entity.id.fromOSM('node', '1'))).to.equal('1');
});
});
});
- describe("#copy", function () {
- it("returns a new Entity", function () {
+ describe('#copy', function () {
+ it('returns a new Entity', function () {
var n = iD.Entity({id: 'n'}),
result = n.copy(null, {});
expect(result).to.be.an.instanceof(iD.Entity);
expect(result).not.to.equal(n);
});
- it("adds the new Entity to input object", function () {
+ it('adds the new Entity to input object', function () {
var n = iD.Entity({id: 'n'}),
copies = {},
result = n.copy(null, copies);
@@ -52,7 +52,7 @@ describe('iD.Entity', function () {
expect(copies.n).to.equal(result);
});
- it("returns an existing copy in input object", function () {
+ it('returns an existing copy in input object', function () {
var n = iD.Entity({id: 'n'}),
copies = {},
result1 = n.copy(null, copies),
@@ -61,7 +61,7 @@ describe('iD.Entity', function () {
expect(result1).to.equal(result2);
});
- it("resets 'id', 'user', and 'version' properties", function () {
+ it('resets \'id\', \'user\', and \'version\' properties', function () {
var n = iD.Entity({id: 'n', version: 10, user: 'user'}),
copies = {};
n.copy(null, copies);
@@ -70,7 +70,7 @@ describe('iD.Entity', function () {
expect(copies.n.user).to.be.undefined;
});
- it("copies tags", function () {
+ it('copies tags', function () {
var n = iD.Entity({id: 'n', tags: {foo: 'foo'}}),
copies = {};
n.copy(null, copies);
@@ -78,77 +78,77 @@ describe('iD.Entity', function () {
});
});
- describe("#update", function () {
- it("returns a new Entity", function () {
+ describe('#update', function () {
+ it('returns a new Entity', function () {
var a = iD.Entity(),
b = a.update({});
expect(b instanceof iD.Entity).to.be.true;
expect(a).not.to.equal(b);
});
- it("updates the specified attributes", function () {
+ it('updates the specified attributes', function () {
var tags = {foo: 'bar'},
e = iD.Entity().update({tags: tags});
expect(e.tags).to.equal(tags);
});
- it("preserves existing attributes", function () {
+ it('preserves existing attributes', function () {
var e = iD.Entity({id: 'w1'}).update({});
expect(e.id).to.equal('w1');
});
- it("doesn't modify the input", function () {
- var attrs = {tags: {foo: 'bar'}},
- e = iD.Entity().update(attrs);
+ it('doesn\'t modify the input', function () {
+ var attrs = {tags: {foo: 'bar'}};
+ iD.Entity().update(attrs);
expect(attrs).to.eql({tags: {foo: 'bar'}});
});
- it("doesn't copy prototype properties", function () {
+ it('doesn\'t copy prototype properties', function () {
expect(iD.Entity().update({})).not.to.have.ownProperty('update');
});
- it("sets v to 1 if previously undefined", function() {
+ it('sets v to 1 if previously undefined', function() {
expect(iD.Entity().update({}).v).to.equal(1);
});
- it("increments v", function() {
+ it('increments v', function() {
expect(iD.Entity({v: 1}).update({}).v).to.equal(2);
});
});
- describe("#mergeTags", function () {
- it("returns self if unchanged", function () {
+ describe('#mergeTags', function () {
+ it('returns self if unchanged', function () {
var a = iD.Entity({tags: {a: 'a'}}),
b = a.mergeTags({a: 'a'});
expect(a).to.equal(b);
});
- it("returns a new Entity if changed", function () {
+ it('returns a new Entity if changed', function () {
var a = iD.Entity({tags: {a: 'a'}}),
b = a.mergeTags({a: 'b'});
expect(b instanceof iD.Entity).to.be.true;
expect(a).not.to.equal(b);
});
- it("merges tags", function () {
+ it('merges tags', function () {
var a = iD.Entity({tags: {a: 'a'}}),
b = a.mergeTags({b: 'b'});
expect(b.tags).to.eql({a: 'a', b: 'b'});
});
- it("combines non-conflicting tags", function () {
+ it('combines non-conflicting tags', function () {
var a = iD.Entity({tags: {a: 'a'}}),
b = a.mergeTags({a: 'a'});
expect(b.tags).to.eql({a: 'a'});
});
- it("combines conflicting tags with semicolons", function () {
+ it('combines conflicting tags with semicolons', function () {
var a = iD.Entity({tags: {a: 'a'}}),
b = a.mergeTags({a: 'b'});
expect(b.tags).to.eql({a: 'a;b'});
});
- it("combines combined tags", function () {
+ it('combines combined tags', function () {
var a = iD.Entity({tags: {a: 'a;b'}}),
b = iD.Entity({tags: {a: 'b'}});
@@ -156,7 +156,7 @@ describe('iD.Entity', function () {
expect(b.mergeTags(a.tags).tags).to.eql({a: 'b;a'});
});
- it("combines combined tags with whitespace", function () {
+ it('combines combined tags with whitespace', function () {
var a = iD.Entity({tags: {a: 'a; b'}}),
b = iD.Entity({tags: {a: 'b'}});
@@ -165,23 +165,23 @@ describe('iD.Entity', function () {
});
});
- describe("#osmId", function () {
- it("returns an OSM ID as a string", function () {
+ describe('#osmId', function () {
+ it('returns an OSM ID as a string', function () {
expect(iD.Entity({id: 'w1234'}).osmId()).to.eql('1234');
expect(iD.Entity({id: 'n1234'}).osmId()).to.eql('1234');
expect(iD.Entity({id: 'r1234'}).osmId()).to.eql('1234');
});
});
- describe("#intersects", function () {
- it("returns true for a way with a node within the given extent", function () {
+ describe('#intersects', function () {
+ it('returns true for a way with a node within the given extent', function () {
var node = iD.Node({loc: [0, 0]}),
way = iD.Way({nodes: [node.id]}),
graph = iD.Graph([node, way]);
expect(way.intersects([[-5, -5], [5, 5]], graph)).to.equal(true);
});
- it("returns false for way with no nodes within the given extent", function () {
+ it('returns false for way with no nodes within the given extent', function () {
var node = iD.Node({loc: [6, 6]}),
way = iD.Way({nodes: [node.id]}),
graph = iD.Graph([node, way]);
@@ -189,26 +189,26 @@ describe('iD.Entity', function () {
});
});
- describe("#isUsed", function () {
- it("returns false for an entity without tags", function () {
+ describe('#isUsed', function () {
+ it('returns false for an entity without tags', function () {
var node = iD.Node(),
graph = iD.Graph([node]);
expect(node.isUsed(graph)).to.equal(false);
});
- it("returns true for an entity with tags", function () {
+ it('returns true for an entity with tags', function () {
var node = iD.Node({tags: {foo: 'bar'}}),
graph = iD.Graph([node]);
expect(node.isUsed(graph)).to.equal(true);
});
- it("returns false for an entity with only an area=yes tag", function () {
+ it('returns false for an entity with only an area=yes tag', function () {
var node = iD.Node({tags: {area: 'yes'}}),
graph = iD.Graph([node]);
expect(node.isUsed(graph)).to.equal(false);
});
- it("returns true for an entity that is a relation member", function () {
+ it('returns true for an entity that is a relation member', function () {
var node = iD.Node(),
relation = iD.Relation({members: [{id: node.id}]}),
graph = iD.Graph([node, relation]);
@@ -216,30 +216,30 @@ describe('iD.Entity', function () {
});
});
- describe("#hasDeprecatedTags", function () {
- it("returns false if entity has no tags", function () {
+ describe('#hasDeprecatedTags', function () {
+ it('returns false if entity has no tags', function () {
expect(iD.Entity().deprecatedTags()).to.eql({});
});
- it("returns true if entity has deprecated tags", function () {
+ it('returns true if entity has deprecated tags', function () {
expect(iD.Entity({ tags: { barrier: 'wire_fence' } }).deprecatedTags()).to.eql({ barrier: 'wire_fence' });
});
});
- describe("#hasInterestingTags", function () {
- it("returns false if the entity has no tags", function () {
+ describe('#hasInterestingTags', function () {
+ it('returns false if the entity has no tags', function () {
expect(iD.Entity().hasInterestingTags()).to.equal(false);
});
- it("returns true if the entity has tags other than 'attribution', 'created_by', 'source', 'odbl' and tiger tags", function () {
+ it('returns true if the entity has tags other than \'attribution\', \'created_by\', \'source\', \'odbl\' and tiger tags', function () {
expect(iD.Entity({tags: {foo: 'bar'}}).hasInterestingTags()).to.equal(true);
});
- it("return false if the entity has only uninteresting tags", function () {
+ it('return false if the entity has only uninteresting tags', function () {
expect(iD.Entity({tags: {source: 'Bing'}}).hasInterestingTags()).to.equal(false);
});
- it("return false if the entity has only tiger tags", function () {
+ it('return false if the entity has only tiger tags', function () {
expect(iD.Entity({tags: {'tiger:source': 'blah', 'tiger:foo': 'bar'}}).hasInterestingTags()).to.equal(false);
});
});
diff --git a/test/spec/core/graph.js b/test/spec/core/graph.js
index 46cb46a69..c1badeecc 100644
--- a/test/spec/core/graph.js
+++ b/test/spec/core/graph.js
@@ -1,65 +1,65 @@
describe('iD.Graph', function() {
- describe("constructor", function () {
- it("accepts an entities Array", function () {
+ describe('constructor', function () {
+ it('accepts an entities Array', function () {
var entity = iD.Entity(),
graph = iD.Graph([entity]);
expect(graph.entity(entity.id)).to.equal(entity);
});
- it("accepts a Graph", function () {
+ it('accepts a Graph', function () {
var entity = iD.Entity(),
graph = iD.Graph(iD.Graph([entity]));
expect(graph.entity(entity.id)).to.equal(entity);
});
- it("copies other's entities", function () {
+ it('copies other\'s entities', function () {
var entity = iD.Entity(),
base = iD.Graph([entity]),
graph = iD.Graph(base);
expect(graph.entities).not.to.equal(base.entities);
});
- it("rebases on other's base", function () {
+ it('rebases on other\'s base', function () {
var base = iD.Graph(),
graph = iD.Graph(base);
expect(graph.base().entities).to.equal(base.base().entities);
});
- it("freezes by default", function () {
+ it('freezes by default', function () {
expect(iD.Graph().frozen).to.be.true;
});
- it("remains mutable if passed true as second argument", function () {
+ it('remains mutable if passed true as second argument', function () {
expect(iD.Graph([], true).frozen).to.be.false;
});
});
- describe("#hasEntity", function () {
- it("returns the entity when present", function () {
+ describe('#hasEntity', function () {
+ it('returns the entity when present', function () {
var node = iD.Node(),
graph = iD.Graph([node]);
expect(graph.hasEntity(node.id)).to.equal(node);
});
- it("returns undefined when the entity is not present", function () {
+ it('returns undefined when the entity is not present', function () {
expect(iD.Graph().hasEntity('1')).to.be.undefined;
});
});
- describe("#entity", function () {
- it("returns the entity when present", function () {
+ describe('#entity', function () {
+ it('returns the entity when present', function () {
var node = iD.Node(),
graph = iD.Graph([node]);
expect(graph.entity(node.id)).to.equal(node);
});
- it("throws when the entity is not present", function () {
+ it('throws when the entity is not present', function () {
expect(function() { iD.Graph().entity('1'); }).to.throw;
});
});
- describe("#rebase", function () {
- it("preserves existing entities", function () {
+ describe('#rebase', function () {
+ it('preserves existing entities', function () {
var node = iD.Node({id: 'n'}),
graph = iD.Graph([node]);
@@ -68,7 +68,7 @@ describe('iD.Graph', function() {
expect(graph.entity('n')).to.equal(node);
});
- it("includes new entities", function () {
+ it('includes new entities', function () {
var node = iD.Node({id: 'n'}),
graph = iD.Graph();
@@ -77,7 +77,7 @@ describe('iD.Graph', function() {
expect(graph.entity('n')).to.equal(node);
});
- it("doesn't rebase deleted entities", function () {
+ it('doesn\'t rebase deleted entities', function () {
var node = iD.Node({id: 'n', visible: false}),
graph = iD.Graph();
@@ -86,7 +86,7 @@ describe('iD.Graph', function() {
expect(graph.hasEntity('n')).to.be.not.ok;
});
- it("gives precedence to existing entities", function () {
+ it('gives precedence to existing entities', function () {
var a = iD.Node({id: 'n'}),
b = iD.Node({id: 'n'}),
graph = iD.Graph([a]);
@@ -96,7 +96,7 @@ describe('iD.Graph', function() {
expect(graph.entity('n')).to.equal(a);
});
- it("gives precedence to new entities when force = true", function () {
+ it('gives precedence to new entities when force = true', function () {
var a = iD.Node({id: 'n'}),
b = iD.Node({id: 'n'}),
graph = iD.Graph([a]);
@@ -106,7 +106,7 @@ describe('iD.Graph', function() {
expect(graph.entity('n')).to.equal(b);
});
- it("inherits entities from base prototypally", function () {
+ it('inherits entities from base prototypally', function () {
var graph = iD.Graph();
graph.rebase([iD.Node({id: 'n'})], [graph]);
@@ -114,7 +114,7 @@ describe('iD.Graph', function() {
expect(graph.entities).not.to.have.ownProperty('n');
});
- it("updates parentWays", function () {
+ it('updates parentWays', function () {
var n = iD.Node({id: 'n'}),
w1 = iD.Way({id: 'w1', nodes: ['n']}),
w2 = iD.Way({id: 'w2', nodes: ['n']}),
@@ -126,7 +126,7 @@ describe('iD.Graph', function() {
expect(graph._parentWays.hasOwnProperty('n')).to.be.false;
});
- it("avoids adding duplicate parentWays", function () {
+ it('avoids adding duplicate parentWays', function () {
var n = iD.Node({id: 'n'}),
w1 = iD.Way({id: 'w1', nodes: ['n']}),
graph = iD.Graph([n, w1]);
@@ -136,7 +136,7 @@ describe('iD.Graph', function() {
expect(graph.parentWays(n)).to.eql([w1]);
});
- it("updates parentWays for nodes with modified parentWays", function () {
+ it('updates parentWays for nodes with modified parentWays', function () {
var n = iD.Node({id: 'n'}),
w1 = iD.Way({id: 'w1', nodes: ['n']}),
w2 = iD.Way({id: 'w2', nodes: ['n']}),
@@ -149,7 +149,7 @@ describe('iD.Graph', function() {
expect(graph2.parentWays(n)).to.eql([w1, w2, w3]);
});
- it("avoids re-adding a modified way as a parent way", function() {
+ it('avoids re-adding a modified way as a parent way', function() {
var n1 = iD.Node({id: 'n1'}),
n2 = iD.Node({id: 'n2'}),
w1 = iD.Way({id: 'w1', nodes: ['n1', 'n2']}),
@@ -162,7 +162,7 @@ describe('iD.Graph', function() {
expect(graph2.parentWays(n2)).to.eql([]);
});
- it("avoids re-adding a deleted way as a parent way", function() {
+ it('avoids re-adding a deleted way as a parent way', function() {
var n = iD.Node({id: 'n'}),
w1 = iD.Way({id: 'w1', nodes: ['n']}),
graph = iD.Graph([n, w1]),
@@ -173,7 +173,7 @@ describe('iD.Graph', function() {
expect(graph2.parentWays(n)).to.eql([]);
});
- it("re-adds a deleted node that is discovered to have another parent", function() {
+ it('re-adds a deleted node that is discovered to have another parent', function() {
var n = iD.Node({id: 'n'}),
w1 = iD.Way({id: 'w1', nodes: ['n']}),
w2 = iD.Way({id: 'w2', nodes: ['n']}),
@@ -185,7 +185,7 @@ describe('iD.Graph', function() {
expect(graph2.entity('n')).to.eql(n);
});
- it("updates parentRelations", function () {
+ it('updates parentRelations', function () {
var n = iD.Node({id: 'n'}),
r1 = iD.Relation({id: 'r1', members: [{id: 'n'}]}),
r2 = iD.Relation({id: 'r2', members: [{id: 'n'}]}),
@@ -197,7 +197,7 @@ describe('iD.Graph', function() {
expect(graph._parentRels.hasOwnProperty('n')).to.be.false;
});
- it("avoids re-adding a modified relation as a parent relation", function() {
+ it('avoids re-adding a modified relation as a parent relation', function() {
var n = iD.Node({id: 'n'}),
r1 = iD.Relation({id: 'r1', members: [{id: 'n'}]}),
r2 = r1.removeMembersWithID('n'),
@@ -209,7 +209,7 @@ describe('iD.Graph', function() {
expect(graph2.parentRelations(n)).to.eql([]);
});
- it("avoids re-adding a deleted relation as a parent relation", function() {
+ it('avoids re-adding a deleted relation as a parent relation', function() {
var n = iD.Node({id: 'n'}),
r1 = iD.Relation({id: 'r1', members: [{id: 'n'}]}),
graph = iD.Graph([n, r1]),
@@ -220,7 +220,7 @@ describe('iD.Graph', function() {
expect(graph2.parentRelations(n)).to.eql([]);
});
- it("updates parentRels for nodes with modified parentWays", function () {
+ it('updates parentRels for nodes with modified parentWays', function () {
var n = iD.Node({id: 'n'}),
r1 = iD.Relation({id: 'r1', members: [{id: 'n'}]}),
r2 = iD.Relation({id: 'r2', members: [{id: 'n'}]}),
@@ -233,7 +233,7 @@ describe('iD.Graph', function() {
expect(graph2.parentRelations(n)).to.eql([r1, r2, r3]);
});
- it("invalidates transients", function() {
+ it('invalidates transients', function() {
var n = iD.Node({id: 'n'}),
w1 = iD.Way({id: 'w1', nodes: ['n']}),
w2 = iD.Way({id: 'w2', nodes: ['n']}),
@@ -251,34 +251,34 @@ describe('iD.Graph', function() {
});
});
- describe("#remove", function () {
- it("returns a new graph", function () {
+ describe('#remove', function () {
+ it('returns a new graph', function () {
var node = iD.Node(),
graph = iD.Graph([node]);
expect(graph.remove(node)).not.to.equal(graph);
});
- it("doesn't modify the receiver", function () {
+ it('doesn\'t modify the receiver', function () {
var node = iD.Node(),
graph = iD.Graph([node]);
graph.remove(node);
expect(graph.entity(node.id)).to.equal(node);
});
- it("removes the entity from the result", function () {
+ it('removes the entity from the result', function () {
var node = iD.Node(),
graph = iD.Graph([node]);
expect(graph.remove(node).hasEntity(node.id)).to.be.undefined;
});
- it("removes the entity as a parentWay", function () {
+ it('removes the entity as a parentWay', function () {
var node = iD.Node({id: 'n' }),
w1 = iD.Way({id: 'w', nodes: ['n']}),
graph = iD.Graph([node, w1]);
expect(graph.remove(w1).parentWays(node)).to.eql([]);
});
- it("removes the entity as a parentRelation", function () {
+ it('removes the entity as a parentRelation', function () {
var node = iD.Node({id: 'n' }),
r1 = iD.Relation({id: 'w', members: [{id: 'n' }]}),
graph = iD.Graph([node, r1]);
@@ -286,69 +286,69 @@ describe('iD.Graph', function() {
});
});
- describe("#replace", function () {
- it("is a no-op if the replacement is identical to the existing entity", function () {
+ describe('#replace', function () {
+ it('is a no-op if the replacement is identical to the existing entity', function () {
var node = iD.Node(),
graph = iD.Graph([node]);
expect(graph.replace(node)).to.equal(graph);
});
- it("returns a new graph", function () {
+ it('returns a new graph', function () {
var node = iD.Node(),
graph = iD.Graph([node]);
expect(graph.replace(node.update())).not.to.equal(graph);
});
- it("doesn't modify the receiver", function () {
+ it('doesn\'t modify the receiver', function () {
var node = iD.Node(),
graph = iD.Graph([node]);
graph.replace(node);
expect(graph.entity(node.id)).to.equal(node);
});
- it("replaces the entity in the result", function () {
+ it('replaces the entity in the result', function () {
var node1 = iD.Node(),
node2 = node1.update({}),
graph = iD.Graph([node1]);
expect(graph.replace(node2).entity(node2.id)).to.equal(node2);
});
- it("adds parentWays", function () {
+ it('adds parentWays', function () {
var node = iD.Node({id: 'n' }),
w1 = iD.Way({id: 'w', nodes: ['n']}),
graph = iD.Graph([node]);
expect(graph.replace(w1).parentWays(node)).to.eql([w1]);
});
- it("removes parentWays", function () {
+ it('removes parentWays', function () {
var node = iD.Node({id: 'n' }),
w1 = iD.Way({id: 'w', nodes: ['n']}),
graph = iD.Graph([node, w1]);
expect(graph.remove(w1).parentWays(node)).to.eql([]);
});
- it("doesn't add duplicate parentWays", function () {
+ it('doesn\'t add duplicate parentWays', function () {
var node = iD.Node({id: 'n' }),
w1 = iD.Way({id: 'w', nodes: ['n']}),
graph = iD.Graph([node, w1]);
expect(graph.replace(w1).parentWays(node)).to.eql([w1]);
});
- it("adds parentRelations", function () {
+ it('adds parentRelations', function () {
var node = iD.Node({id: 'n' }),
r1 = iD.Relation({id: 'r', members: [{id: 'n'}]}),
graph = iD.Graph([node]);
expect(graph.replace(r1).parentRelations(node)).to.eql([r1]);
});
- it("removes parentRelations", function () {
+ it('removes parentRelations', function () {
var node = iD.Node({id: 'n' }),
r1 = iD.Relation({id: 'r', members: [{id: 'n'}]}),
graph = iD.Graph([node, r1]);
expect(graph.remove(r1).parentRelations(node)).to.eql([]);
});
- it("doesn't add duplicate parentRelations", function () {
+ it('doesn\'t add duplicate parentRelations', function () {
var node = iD.Node({id: 'n' }),
r1 = iD.Relation({id: 'r', members: [{id: 'n'}]}),
graph = iD.Graph([node, r1]);
@@ -356,21 +356,21 @@ describe('iD.Graph', function() {
});
});
- describe("#revert", function () {
- it("is a no-op if the head entity is identical to the base entity", function () {
+ describe('#revert', function () {
+ it('is a no-op if the head entity is identical to the base entity', function () {
var n1 = iD.Node({id: 'n'}),
graph = iD.Graph([n1]);
expect(graph.revert('n')).to.equal(graph);
});
- it("returns a new graph", function () {
+ it('returns a new graph', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.update({}),
graph = iD.Graph([n1]).replace(n2);
expect(graph.revert('n')).not.to.equal(graph);
});
- it("doesn't modify the receiver", function () {
+ it('doesn\'t modify the receiver', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.update({}),
graph = iD.Graph([n1]).replace(n2);
@@ -378,7 +378,7 @@ describe('iD.Graph', function() {
expect(graph.hasEntity('n')).to.equal(n2);
});
- it("removes a new entity", function () {
+ it('removes a new entity', function () {
var n1 = iD.Node({id: 'n'}),
graph = iD.Graph().replace(n1);
@@ -386,7 +386,7 @@ describe('iD.Graph', function() {
expect(graph.hasEntity('n')).to.be.undefined;
});
- it("reverts an updated entity to the base version", function () {
+ it('reverts an updated entity to the base version', function () {
var n1 = iD.Node({id: 'n'}),
n2 = n1.update({}),
graph = iD.Graph([n1]).replace(n2);
@@ -395,7 +395,7 @@ describe('iD.Graph', function() {
expect(graph.hasEntity('n')).to.equal(n1);
});
- it("restores a deleted entity", function () {
+ it('restores a deleted entity', function () {
var n1 = iD.Node({id: 'n'}),
graph = iD.Graph([n1]).remove(n1);
@@ -403,7 +403,7 @@ describe('iD.Graph', function() {
expect(graph.hasEntity('n')).to.equal(n1);
});
- it("removes new parentWays", function () {
+ it('removes new parentWays', function () {
var n1 = iD.Node({id: 'n'}),
w1 = iD.Way({id: 'w', nodes: ['n']}),
graph = iD.Graph().replace(n1).replace(w1);
@@ -413,7 +413,7 @@ describe('iD.Graph', function() {
expect(graph.parentWays(n1)).to.eql([]);
});
- it("removes new parentRelations", function () {
+ it('removes new parentRelations', function () {
var n1 = iD.Node({id: 'n'}),
r1 = iD.Relation({id: 'r', members: [{id: 'n'}]}),
graph = iD.Graph().replace(n1).replace(r1);
@@ -423,7 +423,7 @@ describe('iD.Graph', function() {
expect(graph.parentRelations(n1)).to.eql([]);
});
- it("reverts updated parentWays", function () {
+ it('reverts updated parentWays', function () {
var n1 = iD.Node({id: 'n'}),
w1 = iD.Way({id: 'w', nodes: ['n']}),
w2 = w1.removeNode('n'),
@@ -434,7 +434,7 @@ describe('iD.Graph', function() {
expect(graph.parentWays(n1)).to.eql([w1]);
});
- it("reverts updated parentRelations", function () {
+ it('reverts updated parentRelations', function () {
var n1 = iD.Node({id: 'n'}),
r1 = iD.Relation({id: 'r', members: [{id: 'n'}]}),
r2 = r1.removeMembersWithID('n'),
@@ -445,7 +445,7 @@ describe('iD.Graph', function() {
expect(graph.parentRelations(n1)).to.eql([r1]);
});
- it("restores deleted parentWays", function () {
+ it('restores deleted parentWays', function () {
var n1 = iD.Node({id: 'n'}),
w1 = iD.Way({id: 'w', nodes: ['n']}),
graph = iD.Graph([n1, w1]).remove(w1);
@@ -455,7 +455,7 @@ describe('iD.Graph', function() {
expect(graph.parentWays(n1)).to.eql([w1]);
});
- it("restores deleted parentRelations", function () {
+ it('restores deleted parentRelations', function () {
var n1 = iD.Node({id: 'n'}),
r1 = iD.Relation({id: 'r', members: [{id: 'n'}]}),
graph = iD.Graph([n1, r1]).remove(r1);
@@ -466,18 +466,18 @@ describe('iD.Graph', function() {
});
});
- describe("#update", function () {
- it("returns a new graph if self is frozen", function () {
+ describe('#update', function () {
+ it('returns a new graph if self is frozen', function () {
var graph = iD.Graph();
expect(graph.update()).not.to.equal(graph);
});
- it("returns self if self is not frozen", function () {
+ it('returns self if self is not frozen', function () {
var graph = iD.Graph([], true);
expect(graph.update()).to.equal(graph);
});
- it("doesn't modify self is self is frozen", function () {
+ it('doesn\'t modify self is self is frozen', function () {
var node = iD.Node(),
graph = iD.Graph([node]);
@@ -486,7 +486,7 @@ describe('iD.Graph', function() {
expect(graph.entity(node.id)).to.equal(node);
});
- it("modifies self is self is not frozen", function () {
+ it('modifies self is self is not frozen', function () {
var node = iD.Node(),
graph = iD.Graph([node], true);
@@ -495,7 +495,7 @@ describe('iD.Graph', function() {
expect(graph.hasEntity(node.id)).to.be.undefined;
});
- it("executes all of the given functions", function () {
+ it('executes all of the given functions', function () {
var a = iD.Node(),
b = iD.Node(),
graph = iD.Graph([a]);
@@ -510,31 +510,31 @@ describe('iD.Graph', function() {
});
});
- describe("#parentWays", function() {
- it("returns an array of ways that contain the given node id", function () {
- var node = iD.Node({id: "n1"}),
- way = iD.Way({id: "w1", nodes: ["n1"]}),
+ describe('#parentWays', function() {
+ it('returns an array of ways that contain the given node id', function () {
+ var node = iD.Node({id: 'n1'}),
+ way = iD.Way({id: 'w1', nodes: ['n1']}),
graph = iD.Graph([node, way]);
expect(graph.parentWays(node)).to.eql([way]);
expect(graph.parentWays(way)).to.eql([]);
});
});
- describe("#parentRelations", function() {
- it("returns an array of relations that contain the given entity id", function () {
- var node = iD.Node({id: "n1"}),
- nonnode = iD.Node({id: "n2"}),
- relation = iD.Relation({id: "r1", members: [{ id: "n1", role: 'from' }]}),
+ describe('#parentRelations', function() {
+ it('returns an array of relations that contain the given entity id', function () {
+ var node = iD.Node({id: 'n1'}),
+ nonnode = iD.Node({id: 'n2'}),
+ relation = iD.Relation({id: 'r1', members: [{ id: 'n1', role: 'from' }]}),
graph = iD.Graph([node, relation]);
expect(graph.parentRelations(node)).to.eql([relation]);
expect(graph.parentRelations(nonnode)).to.eql([]);
});
});
- describe("#childNodes", function () {
- it("returns an array of child nodes", function () {
- var node = iD.Node({id: "n1"}),
- way = iD.Way({id: "w1", nodes: ["n1"]}),
+ describe('#childNodes', function () {
+ it('returns an array of child nodes', function () {
+ var node = iD.Node({id: 'n1'}),
+ way = iD.Way({id: 'w1', nodes: ['n1']}),
graph = iD.Graph([node, way]);
expect(graph.childNodes(way)).to.eql([node]);
});
diff --git a/test/spec/core/history.js b/test/spec/core/history.js
index 4bcd1d477..7e3ee1d32 100644
--- a/test/spec/core/history.js
+++ b/test/spec/core/history.js
@@ -1,4 +1,4 @@
-describe("iD.History", function () {
+describe('iD.History', function () {
var context, history, spy,
action = function() { return iD.Graph(); };
@@ -10,20 +10,20 @@ describe("iD.History", function () {
context.storage(history._getKey('lock'), null);
});
- describe("#graph", function () {
- it("returns the current graph", function () {
+ describe('#graph', function () {
+ it('returns the current graph', function () {
expect(history.graph()).to.be.an.instanceOf(iD.Graph);
});
});
- describe("#merge", function () {
- it("merges the entities into all graph versions", function () {
+ describe('#merge', function () {
+ it('merges the entities into all graph versions', function () {
var n = iD.Node({id: 'n'});
history.merge([n]);
expect(history.graph().entity('n')).to.equal(n);
});
- it("emits a change event with the specified extent", function () {
+ it('emits a change event with the specified extent', function () {
var extent = {};
history.on('change', spy);
history.merge([], extent);
@@ -31,90 +31,90 @@ describe("iD.History", function () {
});
});
- describe("#perform", function () {
- it("returns a difference", function () {
+ describe('#perform', function () {
+ it('returns a difference', function () {
expect(history.perform(action).changes()).to.eql({});
});
- it("updates the graph", function () {
+ it('updates the graph', function () {
var node = iD.Node();
history.perform(function (graph) { return graph.replace(node); });
expect(history.graph().entity(node.id)).to.equal(node);
});
- it("pushes an undo annotation", function () {
- history.perform(action, "annotation");
- expect(history.undoAnnotation()).to.equal("annotation");
+ it('pushes an undo annotation', function () {
+ history.perform(action, 'annotation');
+ expect(history.undoAnnotation()).to.equal('annotation');
});
- it("emits a change event", function () {
+ it('emits a change event', function () {
history.on('change', spy);
var difference = history.perform(action);
expect(spy).to.have.been.calledWith(difference);
});
- it("performs multiple actions", function () {
+ it('performs multiple actions', function () {
var action1 = sinon.stub().returns(iD.Graph()),
action2 = sinon.stub().returns(iD.Graph());
- history.perform(action1, action2, "annotation");
+ history.perform(action1, action2, 'annotation');
expect(action1).to.have.been.called;
expect(action2).to.have.been.called;
- expect(history.undoAnnotation()).to.equal("annotation");
+ expect(history.undoAnnotation()).to.equal('annotation');
});
});
- describe("#replace", function () {
- it("returns a difference", function () {
+ describe('#replace', function () {
+ it('returns a difference', function () {
expect(history.replace(action).changes()).to.eql({});
});
- it("updates the graph", function () {
+ it('updates the graph', function () {
var node = iD.Node();
history.replace(function (graph) { return graph.replace(node); });
expect(history.graph().entity(node.id)).to.equal(node);
});
- it("replaces the undo annotation", function () {
- history.perform(action, "annotation1");
- history.replace(action, "annotation2");
- expect(history.undoAnnotation()).to.equal("annotation2");
+ it('replaces the undo annotation', function () {
+ history.perform(action, 'annotation1');
+ history.replace(action, 'annotation2');
+ expect(history.undoAnnotation()).to.equal('annotation2');
});
- it("emits a change event", function () {
+ it('emits a change event', function () {
history.on('change', spy);
var difference = history.replace(action);
expect(spy).to.have.been.calledWith(difference);
});
- it("performs multiple actions", function () {
+ it('performs multiple actions', function () {
var action1 = sinon.stub().returns(iD.Graph()),
action2 = sinon.stub().returns(iD.Graph());
- history.replace(action1, action2, "annotation");
+ history.replace(action1, action2, 'annotation');
expect(action1).to.have.been.called;
expect(action2).to.have.been.called;
- expect(history.undoAnnotation()).to.equal("annotation");
+ expect(history.undoAnnotation()).to.equal('annotation');
});
});
- describe("#pop", function () {
- it("returns a difference", function () {
- history.perform(action, "annotation");
+ describe('#pop', function () {
+ it('returns a difference', function () {
+ history.perform(action, 'annotation');
expect(history.pop().changes()).to.eql({});
});
- it("updates the graph", function () {
- history.perform(action, "annotation");
+ it('updates the graph', function () {
+ history.perform(action, 'annotation');
history.pop();
expect(history.undoAnnotation()).to.be.undefined;
});
- it("does not push the redo stack", function () {
- history.perform(action, "annotation");
+ it('does not push the redo stack', function () {
+ history.perform(action, 'annotation');
history.pop();
expect(history.redoAnnotation()).to.be.undefined;
});
- it("emits a change event", function () {
+ it('emits a change event', function () {
history.perform(action);
history.on('change', spy);
var difference = history.pop();
@@ -122,74 +122,74 @@ describe("iD.History", function () {
});
});
- describe("#overwrite", function () {
- it("returns a difference", function () {
- history.perform(action, "annotation");
+ describe('#overwrite', function () {
+ it('returns a difference', function () {
+ history.perform(action, 'annotation');
expect(history.overwrite(action).changes()).to.eql({});
});
- it("updates the graph", function () {
- history.perform(action, "annotation");
+ it('updates the graph', function () {
+ history.perform(action, 'annotation');
var node = iD.Node();
history.overwrite(function (graph) { return graph.replace(node); });
expect(history.graph().entity(node.id)).to.equal(node);
});
- it("replaces the undo annotation", function () {
- history.perform(action, "annotation1");
- history.overwrite(action, "annotation2");
- expect(history.undoAnnotation()).to.equal("annotation2");
+ it('replaces the undo annotation', function () {
+ history.perform(action, 'annotation1');
+ history.overwrite(action, 'annotation2');
+ expect(history.undoAnnotation()).to.equal('annotation2');
});
- it("does not push the redo stack", function () {
- history.perform(action, "annotation");
- history.overwrite(action, "annotation2");
+ it('does not push the redo stack', function () {
+ history.perform(action, 'annotation');
+ history.overwrite(action, 'annotation2');
expect(history.redoAnnotation()).to.be.undefined;
});
- it("emits a change event", function () {
- history.perform(action, "annotation");
+ it('emits a change event', function () {
+ history.perform(action, 'annotation');
history.on('change', spy);
- var difference = history.overwrite(action, "annotation2");
+ var difference = history.overwrite(action, 'annotation2');
expect(spy).to.have.been.calledWith(difference);
});
- it("performs multiple actions", function () {
+ it('performs multiple actions', function () {
var action1 = sinon.stub().returns(iD.Graph()),
action2 = sinon.stub().returns(iD.Graph());
- history.perform(action, "annotation");
- history.overwrite(action1, action2, "annotation2");
+ history.perform(action, 'annotation');
+ history.overwrite(action1, action2, 'annotation2');
expect(action1).to.have.been.called;
expect(action2).to.have.been.called;
- expect(history.undoAnnotation()).to.equal("annotation2");
+ expect(history.undoAnnotation()).to.equal('annotation2');
});
});
- describe("#undo", function () {
- it("returns a difference", function () {
+ describe('#undo', function () {
+ it('returns a difference', function () {
expect(history.undo().changes()).to.eql({});
});
- it("pops the undo stack", function () {
- history.perform(action, "annotation");
+ it('pops the undo stack', function () {
+ history.perform(action, 'annotation');
history.undo();
expect(history.undoAnnotation()).to.be.undefined;
});
- it("pushes the redo stack", function () {
- history.perform(action, "annotation");
+ it('pushes the redo stack', function () {
+ history.perform(action, 'annotation');
history.undo();
- expect(history.redoAnnotation()).to.equal("annotation");
+ expect(history.redoAnnotation()).to.equal('annotation');
});
- it("emits an undone event", function () {
+ it('emits an undone event', function () {
history.perform(action);
history.on('undone', spy);
history.undo();
expect(spy).to.have.been.called;
});
- it("emits a change event", function () {
+ it('emits a change event', function () {
history.perform(action);
history.on('change', spy);
var difference = history.undo();
@@ -197,12 +197,12 @@ describe("iD.History", function () {
});
});
- describe("#redo", function () {
- it("returns a difference", function () {
+ describe('#redo', function () {
+ it('returns a difference', function () {
expect(history.redo().changes()).to.eql({});
});
- it("emits an redone event", function () {
+ it('emits an redone event', function () {
history.perform(action);
history.undo();
history.on('change', spy);
@@ -210,7 +210,7 @@ describe("iD.History", function () {
expect(spy).to.have.been.called;
});
- it("emits a change event", function () {
+ it('emits a change event', function () {
history.perform(action);
history.undo();
history.on('change', spy);
@@ -219,67 +219,67 @@ describe("iD.History", function () {
});
});
- describe("#changes", function () {
- it("includes created entities", function () {
+ describe('#changes', function () {
+ it('includes created entities', function () {
var node = iD.Node();
history.perform(function (graph) { return graph.replace(node); });
expect(history.changes().created).to.eql([node]);
});
- it("includes modified entities", function () {
- var node1 = iD.Node({id: "n1"}),
- node2 = node1.update({ tags: { yes: "no" } });
+ it('includes modified entities', function () {
+ var node1 = iD.Node({id: 'n1'}),
+ node2 = node1.update({ tags: { yes: 'no' } });
history.merge([node1]);
history.perform(function (graph) { return graph.replace(node2); });
expect(history.changes().modified).to.eql([node2]);
});
- it("includes deleted entities", function () {
- var node = iD.Node({id: "n1"});
+ it('includes deleted entities', function () {
+ var node = iD.Node({id: 'n1'});
history.merge([node]);
history.perform(function (graph) { return graph.remove(node); });
expect(history.changes().deleted).to.eql([node]);
});
});
- describe("#hasChanges", function() {
- it("is true when any of change's values are nonempty", function() {
+ describe('#hasChanges', function() {
+ it('is true when any of change\'s values are nonempty', function() {
var node = iD.Node();
history.perform(function (graph) { return graph.replace(node); });
expect(history.hasChanges()).to.eql(true);
});
- it("is false when all of change's values are empty", function() {
+ it('is false when all of change\'s values are empty', function() {
expect(history.hasChanges()).to.eql(false);
});
});
- describe("#reset", function () {
- it("clears the version stack", function () {
- history.perform(action, "annotation");
- history.perform(action, "annotation");
+ describe('#reset', function () {
+ it('clears the version stack', function () {
+ history.perform(action, 'annotation');
+ history.perform(action, 'annotation');
history.undo();
history.reset();
expect(history.undoAnnotation()).to.be.undefined;
expect(history.redoAnnotation()).to.be.undefined;
});
- it("emits a change event", function () {
+ it('emits a change event', function () {
history.on('change', spy);
history.reset();
expect(spy).to.have.been.called;
});
});
- describe("#toJSON", function() {
- it("doesn't generate unsaveable changes", function() {
+ describe('#toJSON', function() {
+ it('doesn\'t generate unsaveable changes', function() {
var node_1 = iD.Node({id: 'n-1'});
history.perform(iD.actions.AddEntity(node_1));
history.perform(iD.actions.DeleteNode('n-1'));
expect(history.toJSON()).to.be.not.ok;
});
- it("generates v3 JSON", function() {
+ it('generates v3 JSON', function() {
var node_1 = iD.Node({id: 'n-1'}),
node1 = iD.Node({id: 'n1'}),
node2 = iD.Node({id: 'n2'}),
@@ -295,180 +295,180 @@ describe("iD.History", function () {
});
});
- describe("#fromJSON", function() {
- it("restores from v1 JSON (creation)", function() {
+ describe('#fromJSON', function() {
+ it('restores from v1 JSON (creation)', function() {
var json = {
- "stack": [
- {"entities": {}},
- {"entities": {"n-1": {"loc": [1, 2], "id": "n-1"}}, "imageryUsed": ["Bing"], "annotation": "Added a point."}
+ 'stack': [
+ {'entities': {}},
+ {'entities': {'n-1': {'loc': [1, 2], 'id': 'n-1'}}, 'imageryUsed': ['Bing'], 'annotation': 'Added a point.'}
],
- "nextIDs": {"node": -2, "way": -1, "relation": -1},
- "index": 1
+ 'nextIDs': {'node': -2, 'way': -1, 'relation': -1},
+ 'index': 1
};
history.fromJSON(JSON.stringify(json));
expect(history.graph().entity('n-1')).to.eql(iD.Node({id: 'n-1', loc: [1, 2]}));
- expect(history.undoAnnotation()).to.eql("Added a point.");
- expect(history.imageryUsed()).to.eql(["Bing"]);
+ expect(history.undoAnnotation()).to.eql('Added a point.');
+ expect(history.imageryUsed()).to.eql(['Bing']);
expect(iD.Entity.id.next).to.eql({node: -2, way: -1, relation: -1});
});
- it("restores from v1 JSON (modification)", function() {
+ it('restores from v1 JSON (modification)', function() {
var json = {
- "stack": [
- {"entities": {}},
- {"entities": {"n-1": {"loc": [1, 2], "id": "n-1"}}, "imageryUsed": ["Bing"], "annotation": "Added a point."},
- {"entities": {"n-1": {"loc": [2, 3], "id": "n-1", "v": 1}}, "imageryUsed": ["Bing"], "annotation": "Moved a point."}
+ 'stack': [
+ {'entities': {}},
+ {'entities': {'n-1': {'loc': [1, 2], 'id': 'n-1'}}, 'imageryUsed': ['Bing'], 'annotation': 'Added a point.'},
+ {'entities': {'n-1': {'loc': [2, 3], 'id': 'n-1', 'v': 1}}, 'imageryUsed': ['Bing'], 'annotation': 'Moved a point.'}
],
- "nextIDs": {"node": -2, "way": -1, "relation": -1},
- "index": 2
+ 'nextIDs': {'node': -2, 'way': -1, 'relation': -1},
+ 'index': 2
};
history.fromJSON(JSON.stringify(json));
expect(history.graph().entity('n-1')).to.eql(iD.Node({id: 'n-1', loc: [2, 3], v: 1}));
- expect(history.undoAnnotation()).to.eql("Moved a point.");
- expect(history.imageryUsed()).to.eql(["Bing"]);
+ expect(history.undoAnnotation()).to.eql('Moved a point.');
+ expect(history.imageryUsed()).to.eql(['Bing']);
expect(iD.Entity.id.next).to.eql({node: -2, way: -1, relation: -1});
});
- it("restores from v1 JSON (deletion)", function() {
+ it('restores from v1 JSON (deletion)', function() {
var json = {
- "stack": [
- {"entities": {}},
- {"entities": {"n1": "undefined"}, "imageryUsed": ["Bing"], "annotation": "Deleted a point."}
+ 'stack': [
+ {'entities': {}},
+ {'entities': {'n1': 'undefined'}, 'imageryUsed': ['Bing'], 'annotation': 'Deleted a point.'}
],
- "nextIDs": {"node": -1, "way": -2, "relation": -3},
- "index": 1
+ 'nextIDs': {'node': -1, 'way': -2, 'relation': -3},
+ 'index': 1
};
history.fromJSON(JSON.stringify(json));
history.merge([iD.Node({id: 'n1'})]);
expect(history.graph().hasEntity('n1')).to.be.undefined;
- expect(history.undoAnnotation()).to.eql("Deleted a point.");
- expect(history.imageryUsed()).to.eql(["Bing"]);
+ expect(history.undoAnnotation()).to.eql('Deleted a point.');
+ expect(history.imageryUsed()).to.eql(['Bing']);
expect(iD.Entity.id.next).to.eql({node: -1, way: -2, relation: -3});
});
- it("restores from v2 JSON (creation)", function() {
+ it('restores from v2 JSON (creation)', function() {
var json = {
- "version": 2,
- "entities": [
- {"loc": [1, 2], "id": "n-1"}
+ 'version': 2,
+ 'entities': [
+ {'loc': [1, 2], 'id': 'n-1'}
],
- "stack": [
+ 'stack': [
{},
- {"modified": ["n-1v0"], "imageryUsed": ["Bing"], "annotation": "Added a point."}
+ {'modified': ['n-1v0'], 'imageryUsed': ['Bing'], 'annotation': 'Added a point.'}
],
- "nextIDs": {"node": -2, "way": -1, "relation": -1},
- "index": 1
+ 'nextIDs': {'node': -2, 'way': -1, 'relation': -1},
+ 'index': 1
};
history.fromJSON(JSON.stringify(json));
expect(history.graph().entity('n-1')).to.eql(iD.Node({id: 'n-1', loc: [1, 2]}));
- expect(history.undoAnnotation()).to.eql("Added a point.");
- expect(history.imageryUsed()).to.eql(["Bing"]);
+ expect(history.undoAnnotation()).to.eql('Added a point.');
+ expect(history.imageryUsed()).to.eql(['Bing']);
expect(iD.Entity.id.next).to.eql({node: -2, way: -1, relation: -1});
expect(history.difference().created().length).to.eql(1);
});
- it("restores from v2 JSON (modification)", function() {
+ it('restores from v2 JSON (modification)', function() {
var json = {
- "version": 2,
- "entities": [
- {"loc": [2, 3], "id": "n1", "v": 1}
+ 'version': 2,
+ 'entities': [
+ {'loc': [2, 3], 'id': 'n1', 'v': 1}
],
- "stack": [
+ 'stack': [
{},
- {"modified": ["n1v1"], "imageryUsed": ["Bing"], "annotation": "Moved a point."}
+ {'modified': ['n1v1'], 'imageryUsed': ['Bing'], 'annotation': 'Moved a point.'}
],
- "nextIDs": {"node": -2, "way": -1, "relation": -1},
- "index": 1
+ 'nextIDs': {'node': -2, 'way': -1, 'relation': -1},
+ 'index': 1
};
history.fromJSON(JSON.stringify(json));
history.merge([iD.Node({id: 'n1'})]); // Shouldn't be necessary; flaw in v2 format (see #2135)
expect(history.graph().entity('n1')).to.eql(iD.Node({id: 'n1', loc: [2, 3], v: 1}));
- expect(history.undoAnnotation()).to.eql("Moved a point.");
- expect(history.imageryUsed()).to.eql(["Bing"]);
+ expect(history.undoAnnotation()).to.eql('Moved a point.');
+ expect(history.imageryUsed()).to.eql(['Bing']);
expect(iD.Entity.id.next).to.eql({node: -2, way: -1, relation: -1});
expect(history.difference().modified().length).to.eql(1);
});
- it("restores from v2 JSON (deletion)", function() {
+ it('restores from v2 JSON (deletion)', function() {
var json = {
- "version": 2,
- "entities": [],
- "stack": [
+ 'version': 2,
+ 'entities': [],
+ 'stack': [
{},
- {"deleted": ["n1"], "imageryUsed": ["Bing"], "annotation": "Deleted a point."}
+ {'deleted': ['n1'], 'imageryUsed': ['Bing'], 'annotation': 'Deleted a point.'}
],
- "nextIDs": {"node": -1, "way": -2, "relation": -3},
- "index": 1
+ 'nextIDs': {'node': -1, 'way': -2, 'relation': -3},
+ 'index': 1
};
history.fromJSON(JSON.stringify(json));
history.merge([iD.Node({id: 'n1'})]); // Shouldn't be necessary; flaw in v2 format (see #2135)
expect(history.graph().hasEntity('n1')).to.be.undefined;
- expect(history.undoAnnotation()).to.eql("Deleted a point.");
- expect(history.imageryUsed()).to.eql(["Bing"]);
+ expect(history.undoAnnotation()).to.eql('Deleted a point.');
+ expect(history.imageryUsed()).to.eql(['Bing']);
expect(iD.Entity.id.next).to.eql({node: -1, way: -2, relation: -3});
expect(history.difference().deleted().length).to.eql(1);
});
- it("restores from v3 JSON (creation)", function() {
+ it('restores from v3 JSON (creation)', function() {
var json = {
- "version": 3,
- "entities": [
- {"loc": [1, 2], "id": "n-1"}
+ 'version': 3,
+ 'entities': [
+ {'loc': [1, 2], 'id': 'n-1'}
],
- "baseEntities": [],
- "stack": [
+ 'baseEntities': [],
+ 'stack': [
{},
- {"modified": ["n-1v0"], "imageryUsed": ["Bing"], "annotation": "Added a point."}
+ {'modified': ['n-1v0'], 'imageryUsed': ['Bing'], 'annotation': 'Added a point.'}
],
- "nextIDs": {"node": -2, "way": -1, "relation": -1},
- "index": 1
+ 'nextIDs': {'node': -2, 'way': -1, 'relation': -1},
+ 'index': 1
};
history.fromJSON(JSON.stringify(json));
expect(history.graph().entity('n-1')).to.eql(iD.Node({id: 'n-1', loc: [1, 2]}));
- expect(history.undoAnnotation()).to.eql("Added a point.");
- expect(history.imageryUsed()).to.eql(["Bing"]);
+ expect(history.undoAnnotation()).to.eql('Added a point.');
+ expect(history.imageryUsed()).to.eql(['Bing']);
expect(iD.Entity.id.next).to.eql({node: -2, way: -1, relation: -1});
expect(history.difference().created().length).to.eql(1);
});
- it("restores from v3 JSON (modification)", function() {
+ it('restores from v3 JSON (modification)', function() {
var json = {
- "version": 3,
- "entities": [
- {"loc": [2, 3], "id": "n1", "v": 1}
+ 'version': 3,
+ 'entities': [
+ {'loc': [2, 3], 'id': 'n1', 'v': 1}
],
- "baseEntities": [{"loc": [1, 2], "id": "n1"}],
- "stack": [
+ 'baseEntities': [{'loc': [1, 2], 'id': 'n1'}],
+ 'stack': [
{},
- {"modified": ["n1v1"], "imageryUsed": ["Bing"], "annotation": "Moved a point."}
+ {'modified': ['n1v1'], 'imageryUsed': ['Bing'], 'annotation': 'Moved a point.'}
],
- "nextIDs": {"node": -2, "way": -1, "relation": -1},
- "index": 1
+ 'nextIDs': {'node': -2, 'way': -1, 'relation': -1},
+ 'index': 1
};
history.fromJSON(JSON.stringify(json));
expect(history.graph().entity('n1')).to.eql(iD.Node({id: 'n1', loc: [2, 3], v: 1}));
- expect(history.undoAnnotation()).to.eql("Moved a point.");
- expect(history.imageryUsed()).to.eql(["Bing"]);
+ expect(history.undoAnnotation()).to.eql('Moved a point.');
+ expect(history.imageryUsed()).to.eql(['Bing']);
expect(iD.Entity.id.next).to.eql({node: -2, way: -1, relation: -1});
expect(history.difference().modified().length).to.eql(1);
});
- it("restores from v3 JSON (deletion)", function() {
+ it('restores from v3 JSON (deletion)', function() {
var json = {
- "version": 3,
- "entities": [],
- "baseEntities": [{"loc": [1, 2], "id": "n1"}],
- "stack": [
+ 'version': 3,
+ 'entities': [],
+ 'baseEntities': [{'loc': [1, 2], 'id': 'n1'}],
+ 'stack': [
{},
- {"deleted": ["n1"], "imageryUsed": ["Bing"], "annotation": "Deleted a point."}
+ {'deleted': ['n1'], 'imageryUsed': ['Bing'], 'annotation': 'Deleted a point.'}
],
- "nextIDs": {"node": -1, "way": -2, "relation": -3},
- "index": 1
+ 'nextIDs': {'node': -1, 'way': -2, 'relation': -3},
+ 'index': 1
};
history.fromJSON(JSON.stringify(json));
expect(history.graph().hasEntity('n1')).to.be.undefined;
- expect(history.undoAnnotation()).to.eql("Deleted a point.");
- expect(history.imageryUsed()).to.eql(["Bing"]);
+ expect(history.undoAnnotation()).to.eql('Deleted a point.');
+ expect(history.imageryUsed()).to.eql(['Bing']);
expect(iD.Entity.id.next).to.eql({node: -1, way: -2, relation: -3});
expect(history.difference().deleted().length).to.eql(1);
});
diff --git a/test/spec/core/node.js b/test/spec/core/node.js
index dfaaf19d8..24fd968bb 100644
--- a/test/spec/core/node.js
+++ b/test/spec/core/node.js
@@ -1,50 +1,50 @@
describe('iD.Node', function () {
- it("returns a node", function () {
+ it('returns a node', function () {
expect(iD.Node()).to.be.an.instanceOf(iD.Node);
- expect(iD.Node().type).to.equal("node");
+ expect(iD.Node().type).to.equal('node');
});
- it("defaults tags to an empty object", function () {
+ it('defaults tags to an empty object', function () {
expect(iD.Node().tags).to.eql({});
});
- it("sets tags as specified", function () {
+ it('sets tags as specified', function () {
expect(iD.Node({tags: {foo: 'bar'}}).tags).to.eql({foo: 'bar'});
});
- describe("#extent", function() {
- it("returns a point extent", function() {
+ describe('#extent', function() {
+ it('returns a point extent', function() {
expect(iD.Node({loc: [5, 10]}).extent().equals([[5, 10], [5, 10]])).to.be.ok;
});
});
- describe("#intersects", function () {
- it("returns true for a node within the given extent", function () {
+ describe('#intersects', function () {
+ it('returns true for a node within the given extent', function () {
expect(iD.Node({loc: [0, 0]}).intersects([[-5, -5], [5, 5]])).to.equal(true);
});
- it("returns false for a node outside the given extend", function () {
+ it('returns false for a node outside the given extend', function () {
expect(iD.Node({loc: [6, 6]}).intersects([[-5, -5], [5, 5]])).to.equal(false);
});
});
- describe("#geometry", function () {
- it("returns 'vertex' if the node is a member of any way", function () {
+ describe('#geometry', function () {
+ it('returns \'vertex\' if the node is a member of any way', function () {
var node = iD.Node(),
way = iD.Way({nodes: [node.id]}),
graph = iD.Graph([node, way]);
expect(node.geometry(graph)).to.equal('vertex');
});
- it("returns 'point' if the node is not a member of any way", function () {
+ it('returns \'point\' if the node is not a member of any way', function () {
var node = iD.Node(),
graph = iD.Graph([node]);
expect(node.geometry(graph)).to.equal('point');
});
});
- describe("#isIntersection", function () {
- it("returns true for a node shared by more than one highway", function () {
+ describe('#isIntersection', function () {
+ it('returns true for a node shared by more than one highway', function () {
var node = iD.Node(),
w1 = iD.Way({nodes: [node.id], tags: {highway: 'residential'}}),
w2 = iD.Way({nodes: [node.id], tags: {highway: 'residential'}}),
@@ -52,7 +52,7 @@ describe('iD.Node', function () {
expect(node.isIntersection(graph)).to.equal(true);
});
- it("returns true for a node shared by more than one waterway", function () {
+ it('returns true for a node shared by more than one waterway', function () {
var node = iD.Node(),
w1 = iD.Way({nodes: [node.id], tags: {waterway: 'river'}}),
w2 = iD.Way({nodes: [node.id], tags: {waterway: 'river'}}),
@@ -61,8 +61,8 @@ describe('iD.Node', function () {
});
});
- describe("#isHighwayIntersection", function () {
- it("returns true for a node shared by more than one highway", function () {
+ describe('#isHighwayIntersection', function () {
+ it('returns true for a node shared by more than one highway', function () {
var node = iD.Node(),
w1 = iD.Way({nodes: [node.id], tags: {highway: 'residential'}}),
w2 = iD.Way({nodes: [node.id], tags: {highway: 'residential'}}),
@@ -70,7 +70,7 @@ describe('iD.Node', function () {
expect(node.isHighwayIntersection(graph)).to.equal(true);
});
- it("returns false for a node shared by more than one waterway", function () {
+ it('returns false for a node shared by more than one waterway', function () {
var node = iD.Node(),
w1 = iD.Way({nodes: [node.id], tags: {waterway: 'river'}}),
w2 = iD.Way({nodes: [node.id], tags: {waterway: 'river'}}),
@@ -79,7 +79,7 @@ describe('iD.Node', function () {
});
});
- describe("#asJXON", function () {
+ describe('#asJXON', function () {
it('converts a node to jxon', function() {
var node = iD.Node({id: 'n-1', loc: [-77, 38], tags: {amenity: 'cafe'}});
expect(node.asJXON()).to.eql({node: {
@@ -95,8 +95,8 @@ describe('iD.Node', function () {
});
});
- describe("#asGeoJSON", function () {
- it("converts to a GeoJSON Point geometry", function () {
+ describe('#asGeoJSON', function () {
+ it('converts to a GeoJSON Point geometry', function () {
var node = iD.Node({tags: {amenity: 'cafe'}, loc: [1, 2]}),
json = node.asGeoJSON();
diff --git a/test/spec/core/relation.js b/test/spec/core/relation.js
index 1d30f32b0..34b8df795 100644
--- a/test/spec/core/relation.js
+++ b/test/spec/core/relation.js
@@ -1,33 +1,33 @@
describe('iD.Relation', function () {
if (iD.debug) {
- it("freezes nodes", function () {
+ it('freezes nodes', function () {
expect(Object.isFrozen(iD.Relation().members)).to.be.true;
});
}
- it("returns a relation", function () {
+ it('returns a relation', function () {
expect(iD.Relation()).to.be.an.instanceOf(iD.Relation);
- expect(iD.Relation().type).to.equal("relation");
+ expect(iD.Relation().type).to.equal('relation');
});
- it("defaults members to an empty array", function () {
+ it('defaults members to an empty array', function () {
expect(iD.Relation().members).to.eql([]);
});
- it("sets members as specified", function () {
- expect(iD.Relation({members: ["n-1"]}).members).to.eql(["n-1"]);
+ it('sets members as specified', function () {
+ expect(iD.Relation({members: ['n-1']}).members).to.eql(['n-1']);
});
- it("defaults tags to an empty object", function () {
+ it('defaults tags to an empty object', function () {
expect(iD.Relation().tags).to.eql({});
});
- it("sets tags as specified", function () {
+ it('sets tags as specified', function () {
expect(iD.Relation({tags: {foo: 'bar'}}).tags).to.eql({foo: 'bar'});
});
- describe("#copy", function () {
- it("returns a new Relation", function () {
+ describe('#copy', function () {
+ it('returns a new Relation', function () {
var r = iD.Relation({id: 'r'}),
result = r.copy(null, {});
@@ -35,7 +35,7 @@ describe('iD.Relation', function () {
expect(result).not.to.equal(r);
});
- it("adds the new Relation to input object", function () {
+ it('adds the new Relation to input object', function () {
var r = iD.Relation({id: 'r'}),
copies = {},
result = r.copy(null, copies);
@@ -43,7 +43,7 @@ describe('iD.Relation', function () {
expect(copies.r).to.equal(result);
});
- it("returns an existing copy in input object", function () {
+ it('returns an existing copy in input object', function () {
var r = iD.Relation({id: 'r'}),
copies = {},
result1 = r.copy(null, copies),
@@ -52,14 +52,14 @@ describe('iD.Relation', function () {
expect(result1).to.equal(result2);
});
- it("deep copies members", function () {
+ it('deep copies members', function () {
var a = iD.Node({id: 'a'}),
b = iD.Node({id: 'b'}),
c = iD.Node({id: 'c'}),
w = iD.Way({id: 'w', nodes: ['a','b','c','a']}),
r = iD.Relation({id: 'r', members: [{id: 'w', role: 'outer'}]}),
graph = iD.Graph([a, b, c, w, r]),
- copies = {}
+ copies = {},
result = r.copy(graph, copies);
expect(Object.keys(copies)).to.have.length(5);
@@ -71,7 +71,7 @@ describe('iD.Relation', function () {
expect(result.members[0].role).to.equal(r.members[0].role);
});
- it("deep copies non-tree relation graphs without duplicating children", function () {
+ it('deep copies non-tree relation graphs without duplicating children', function () {
var w = iD.Way({id: 'w'}),
r1 = iD.Relation({id: 'r1', members: [{id: 'r2'}, {id: 'w'}]}),
r2 = iD.Relation({id: 'r2', members: [{id: 'w'}]}),
@@ -88,7 +88,7 @@ describe('iD.Relation', function () {
expect(copies.r2.members[0].id).to.equal(copies.w.id);
});
- it("deep copies cyclical relation graphs without issue", function () {
+ it('deep copies cyclical relation graphs without issue', function () {
var r1 = iD.Relation({id: 'r1', members: [{id: 'r2'}]}),
r2 = iD.Relation({id: 'r2', members: [{id: 'r1'}]}),
graph = iD.Graph([r1, r2]),
@@ -100,7 +100,7 @@ describe('iD.Relation', function () {
expect(copies.r2.members[0].id).to.equal(copies.r1.id);
});
- it("deep copies self-referencing relations without issue", function () {
+ it('deep copies self-referencing relations without issue', function () {
var r = iD.Relation({id: 'r', members: [{id: 'r'}]}),
graph = iD.Graph([r]),
copies = {};
@@ -111,8 +111,8 @@ describe('iD.Relation', function () {
});
});
- describe("#extent", function () {
- it("returns the minimal extent containing the extents of all members", function () {
+ describe('#extent', function () {
+ it('returns the minimal extent containing the extents of all members', function () {
var a = iD.Node({loc: [0, 0]}),
b = iD.Node({loc: [5, 10]}),
r = iD.Relation({members: [{id: a.id}, {id: b.id}]}),
@@ -121,7 +121,7 @@ describe('iD.Relation', function () {
expect(r.extent(graph).equals([[0, 0], [5, 10]])).to.be.ok;
});
- it("returns the known extent of incomplete relations", function () {
+ it('returns the known extent of incomplete relations', function () {
var a = iD.Node({loc: [0, 0]}),
b = iD.Node({loc: [5, 10]}),
r = iD.Relation({members: [{id: a.id}, {id: b.id}]}),
@@ -130,35 +130,35 @@ describe('iD.Relation', function () {
expect(r.extent(graph).equals([[0, 0], [0, 0]])).to.be.ok;
});
- it("does not error on self-referencing relations", function () {
+ it('does not error on self-referencing relations', function () {
var r = iD.Relation();
r = r.addMember({id: r.id});
expect(r.extent(iD.Graph([r]))).to.eql(iD.geo.Extent());
});
});
- describe("#geometry", function () {
- it("returns 'area' for multipolygons", function () {
+ describe('#geometry', function () {
+ it('returns \'area\' for multipolygons', function () {
expect(iD.Relation({tags: {type: 'multipolygon'}}).geometry(iD.Graph())).to.equal('area');
});
- it("returns 'relation' for other relations", function () {
+ it('returns \'relation\' for other relations', function () {
expect(iD.Relation().geometry(iD.Graph())).to.equal('relation');
});
});
- describe("#isDegenerate", function () {
- it("returns true for a relation without members", function () {
+ describe('#isDegenerate', function () {
+ it('returns true for a relation without members', function () {
expect(iD.Relation().isDegenerate()).to.equal(true);
});
- it("returns false for a relation with members", function () {
+ it('returns false for a relation with members', function () {
expect(iD.Relation({members: [{id: 'a', role: 'inner'}]}).isDegenerate()).to.equal(false);
});
});
- describe("#memberByRole", function () {
- it("returns the first member with the given role", function () {
+ describe('#memberByRole', function () {
+ it('returns the first member with the given role', function () {
var r = iD.Relation({members: [
{id: 'a', role: 'inner'},
{id: 'b', role: 'outer'},
@@ -166,13 +166,13 @@ describe('iD.Relation', function () {
expect(r.memberByRole('outer')).to.eql({id: 'b', role: 'outer', index: 1});
});
- it("returns undefined if no members have the given role", function () {
+ it('returns undefined if no members have the given role', function () {
expect(iD.Relation().memberByRole('outer')).to.be.undefined;
});
});
- describe("#memberById", function () {
- it("returns the first member with the given id", function () {
+ describe('#memberById', function () {
+ it('returns the first member with the given id', function () {
var r = iD.Relation({members: [
{id: 'a', role: 'outer'},
{id: 'b', role: 'outer'},
@@ -180,98 +180,98 @@ describe('iD.Relation', function () {
expect(r.memberById('b')).to.eql({id: 'b', role: 'outer', index: 1});
});
- it("returns undefined if no members have the given role", function () {
+ it('returns undefined if no members have the given role', function () {
expect(iD.Relation().memberById('b')).to.be.undefined;
});
});
- describe("#isRestriction", function () {
- it("returns true for 'restriction' type", function () {
+ describe('#isRestriction', function () {
+ it('returns true for \'restriction\' type', function () {
expect(iD.Relation({tags: {type: 'restriction'}}).isRestriction()).to.be.true;
});
- it("returns true for 'restriction:type' types", function () {
+ it('returns true for \'restriction:type\' types', function () {
expect(iD.Relation({tags: {type: 'restriction:bus'}}).isRestriction()).to.be.true;
});
- it("returns false otherwise", function () {
+ it('returns false otherwise', function () {
expect(iD.Relation().isRestriction()).to.be.false;
expect(iD.Relation({tags: {type: 'multipolygon'}}).isRestriction()).to.be.false;
});
});
- describe("#indexedMembers", function () {
- it("returns an array of members extended with indexes", function () {
+ describe('#indexedMembers', function () {
+ it('returns an array of members extended with indexes', function () {
var r = iD.Relation({members: [{id: '1'}, {id: '3'}]});
expect(r.indexedMembers()).to.eql([{id: '1', index: 0}, {id: '3', index: 1}]);
});
});
- describe("#addMember", function () {
- it("adds a member at the end of the relation", function () {
+ describe('#addMember', function () {
+ it('adds a member at the end of the relation', function () {
var r = iD.Relation();
expect(r.addMember({id: '1'}).members).to.eql([{id: '1'}]);
});
- it("adds a member at index 0", function () {
+ it('adds a member at index 0', function () {
var r = iD.Relation({members: [{id: '1'}]});
expect(r.addMember({id: '2'}, 0).members).to.eql([{id: '2'}, {id: '1'}]);
});
- it("adds a member at a positive index", function () {
+ it('adds a member at a positive index', function () {
var r = iD.Relation({members: [{id: '1'}, {id: '3'}]});
expect(r.addMember({id: '2'}, 1).members).to.eql([{id: '1'}, {id: '2'}, {id: '3'}]);
});
- it("adds a member at a negative index", function () {
+ it('adds a member at a negative index', function () {
var r = iD.Relation({members: [{id: '1'}, {id: '3'}]});
expect(r.addMember({id: '2'}, -1).members).to.eql([{id: '1'}, {id: '2'}, {id: '3'}]);
});
});
- describe("#updateMember", function () {
- it("updates the properties of the relation member at the specified index", function () {
+ describe('#updateMember', function () {
+ it('updates the properties of the relation member at the specified index', function () {
var r = iD.Relation({members: [{role: 'forward'}]});
expect(r.updateMember({role: 'backward'}, 0).members).to.eql([{role: 'backward'}]);
});
});
- describe("#removeMember", function () {
- it("removes the member at the specified index", function () {
+ describe('#removeMember', function () {
+ it('removes the member at the specified index', function () {
var r = iD.Relation({members: [{id: 'a'}, {id: 'b'}, {id: 'c'}]});
expect(r.removeMember(1).members).to.eql([{id: 'a'}, {id: 'c'}]);
});
});
- describe("#removeMembersWithID", function () {
- it("removes members with the given ID", function () {
+ describe('#removeMembersWithID', function () {
+ it('removes members with the given ID', function () {
var r = iD.Relation({members: [{id: 'a'}, {id: 'b'}, {id: 'a'}]});
expect(r.removeMembersWithID('a').members).to.eql([{id: 'b'}]);
});
});
- describe("#replaceMember", function () {
- it("returns self if self does not contain needle", function () {
+ describe('#replaceMember', function () {
+ it('returns self if self does not contain needle', function () {
var r = iD.Relation({members: []});
expect(r.replaceMember({id: 'a'}, {id: 'b'})).to.equal(r);
});
- it("replaces a member which doesn't already exist", function () {
+ it('replaces a member which doesn\'t already exist', function () {
var r = iD.Relation({members: [{id: 'a', role: 'a'}]});
expect(r.replaceMember({id: 'a'}, {id: 'b', type: 'node'}).members).to.eql([{id: 'b', role: 'a', type: 'node'}]);
});
- it("preserves the existing role", function () {
+ it('preserves the existing role', function () {
var r = iD.Relation({members: [{id: 'a', role: 'a', type: 'node'}]});
expect(r.replaceMember({id: 'a'}, {id: 'b', type: 'node'}).members).to.eql([{id: 'b', role: 'a', type: 'node'}]);
});
- it("uses the replacement type", function () {
+ it('uses the replacement type', function () {
var r = iD.Relation({members: [{id: 'a', role: 'a', type: 'node'}]});
expect(r.replaceMember({id: 'a'}, {id: 'b', type: 'way'}).members).to.eql([{id: 'b', role: 'a', type: 'way'}]);
});
- it("removes members if replacing them would produce duplicates", function () {
+ it('removes members if replacing them would produce duplicates', function () {
var r = iD.Relation({members: [
{id: 'a', role: 'b', type: 'node'},
{id: 'b', role: 'b', type: 'node'}]});
@@ -279,7 +279,7 @@ describe('iD.Relation', function () {
});
});
- describe("#asJXON", function () {
+ describe('#asJXON', function () {
it('converts a relation to jxon', function() {
var relation = iD.Relation({id: 'r-1', members: [{id: 'w1', role: 'forward', type: 'way'}], tags: {type: 'route'}});
expect(relation.asJXON()).to.eql({relation: {
@@ -294,7 +294,7 @@ describe('iD.Relation', function () {
});
});
- describe("#asGeoJSON", function (){
+ describe('#asGeoJSON', function (){
it('converts a multipolygon to a GeoJSON MultiPolygon geometry', function() {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [3, 3]}),
@@ -347,8 +347,8 @@ describe('iD.Relation', function () {
});
});
- describe("#multipolygon", function () {
- specify("single polygon consisting of a single way", function () {
+ describe('#multipolygon', function () {
+ specify('single polygon consisting of a single way', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [3, 3]}),
c = iD.Node({loc: [2, 2]}),
@@ -359,7 +359,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(g)).to.eql([[[a.loc, b.loc, c.loc, a.loc]]]);
});
- specify("single polygon consisting of multiple ways", function () {
+ specify('single polygon consisting of multiple ways', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [3, 3]}),
c = iD.Node({loc: [2, 2]}),
@@ -371,7 +371,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(g)).to.eql([[[a.loc, b.loc, c.loc, a.loc]]]);
});
- specify("single polygon consisting of multiple ways, one needing reversal", function () {
+ specify('single polygon consisting of multiple ways, one needing reversal', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [3, 3]}),
c = iD.Node({loc: [2, 2]}),
@@ -383,7 +383,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(g)).to.eql([[[a.loc, b.loc, c.loc, a.loc]]]);
});
- specify("multiple polygons consisting of single ways", function () {
+ specify('multiple polygons consisting of single ways', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [3, 3]}),
c = iD.Node({loc: [2, 2]}),
@@ -398,7 +398,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(g)).to.eql([[[a.loc, b.loc, c.loc, a.loc]], [[d.loc, e.loc, f.loc, d.loc]]]);
});
- specify("invalid geometry: unclosed ring consisting of a single way", function () {
+ specify('invalid geometry: unclosed ring consisting of a single way', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [3, 3]}),
c = iD.Node({loc: [2, 2]}),
@@ -409,7 +409,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(g)).to.eql([[[a.loc, b.loc, c.loc]]]);
});
- specify("invalid geometry: unclosed ring consisting of multiple ways", function () {
+ specify('invalid geometry: unclosed ring consisting of multiple ways', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [3, 3]}),
c = iD.Node({loc: [2, 2]}),
@@ -421,7 +421,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(g)).to.eql([[[a.loc, b.loc, c.loc]]]);
});
- specify("invalid geometry: unclosed ring consisting of multiple ways, alternate order", function () {
+ specify('invalid geometry: unclosed ring consisting of multiple ways, alternate order', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [2, 2]}),
c = iD.Node({loc: [3, 3]}),
@@ -434,7 +434,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(g)).to.eql([[[d.loc, c.loc, b.loc, a.loc]]]);
});
- specify("invalid geometry: unclosed ring consisting of multiple ways, one needing reversal", function () {
+ specify('invalid geometry: unclosed ring consisting of multiple ways, one needing reversal', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [2, 2]}),
c = iD.Node({loc: [3, 3]}),
@@ -447,7 +447,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(g)).to.eql([[[d.loc, c.loc, b.loc, a.loc]]]);
});
- specify("invalid geometry: unclosed ring consisting of multiple ways, one needing reversal, alternate order", function () {
+ specify('invalid geometry: unclosed ring consisting of multiple ways, one needing reversal, alternate order', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [2, 2]}),
c = iD.Node({loc: [3, 3]}),
@@ -460,7 +460,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(g)).to.eql([[[d.loc, c.loc, b.loc, a.loc]]]);
});
- specify("single polygon with single single-way inner", function () {
+ specify('single polygon with single single-way inner', function () {
var a = iD.Node({loc: [0, 0]}),
b = iD.Node({loc: [0, 1]}),
c = iD.Node({loc: [1, 0]}),
@@ -475,7 +475,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(g)).to.eql([[[a.loc, b.loc, c.loc, a.loc], [d.loc, e.loc, f.loc, d.loc]]]);
});
- specify("single polygon with single multi-way inner", function () {
+ specify('single polygon with single multi-way inner', function () {
var a = iD.Node({loc: [0, 0]}),
b = iD.Node({loc: [0, 1]}),
c = iD.Node({loc: [1, 0]}),
@@ -494,7 +494,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(graph)).to.eql([[[a.loc, b.loc, c.loc, a.loc], [d.loc, e.loc, f.loc, d.loc]]]);
});
- specify("single polygon with multiple single-way inners", function () {
+ specify('single polygon with multiple single-way inners', function () {
var a = iD.Node({loc: [0, 0]}),
b = iD.Node({loc: [0, 1]}),
c = iD.Node({loc: [1, 0]}),
@@ -516,7 +516,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(graph)).to.eql([[[a.loc, b.loc, c.loc, a.loc], [d.loc, e.loc, f.loc, d.loc], [g.loc, h.loc, i.loc, g.loc]]]);
});
- specify("multiple polygons with single single-way inner", function () {
+ specify('multiple polygons with single single-way inner', function () {
var a = iD.Node({loc: [0, 0]}),
b = iD.Node({loc: [0, 1]}),
c = iD.Node({loc: [1, 0]}),
@@ -538,7 +538,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(graph)).to.eql([[[a.loc, b.loc, c.loc, a.loc], [d.loc, e.loc, f.loc, d.loc]], [[g.loc, h.loc, i.loc, g.loc]]]);
});
- specify("invalid geometry: unmatched inner", function () {
+ specify('invalid geometry: unmatched inner', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [2, 2]}),
c = iD.Node({loc: [3, 3]}),
@@ -549,7 +549,7 @@ describe('iD.Relation', function () {
expect(r.multipolygon(g)).to.eql([[[a.loc, b.loc, c.loc, a.loc]]]);
});
- specify("incomplete relation", function () {
+ specify('incomplete relation', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [2, 2]}),
c = iD.Node({loc: [3, 3]}),
@@ -562,15 +562,15 @@ describe('iD.Relation', function () {
});
});
- describe(".creationOrder comparator", function () {
- specify("orders existing relations newest-first", function () {
+ describe('.creationOrder comparator', function () {
+ specify('orders existing relations newest-first', function () {
var a = iD.Relation({ id: 'r1' }),
b = iD.Relation({ id: 'r2' });
expect(iD.Relation.creationOrder(a, b)).to.be.above(0);
expect(iD.Relation.creationOrder(b, a)).to.be.below(0);
});
- specify("orders new relations newest-first", function () {
+ specify('orders new relations newest-first', function () {
var a = iD.Relation({ id: 'r-1' }),
b = iD.Relation({ id: 'r-2' });
expect(iD.Relation.creationOrder(a, b)).to.be.above(0);
diff --git a/test/spec/core/tree.js b/test/spec/core/tree.js
index 2176aa777..6d2e6ee20 100644
--- a/test/spec/core/tree.js
+++ b/test/spec/core/tree.js
@@ -1,6 +1,6 @@
-describe("iD.Tree", function() {
- describe("#rebase", function() {
- it("adds entities to the tree", function() {
+describe('iD.Tree', function() {
+ describe('#rebase', function() {
+ it('adds entities to the tree', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
node = iD.Node({id: 'n', loc: [1, 1]});
@@ -11,7 +11,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(iD.geo.Extent([0, 0], [2, 2]), graph)).to.eql([node]);
});
- it("is idempotent", function() {
+ it('is idempotent', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
node = iD.Node({id: 'n', loc: [1, 1]}),
@@ -26,7 +26,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(extent, graph)).to.eql([node]);
});
- it("does not insert if entity has a modified version", function() {
+ it('does not insert if entity has a modified version', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
node = iD.Node({id: 'n', loc: [1, 1]}),
@@ -42,7 +42,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(iD.geo.Extent([0, 0], [11, 11]), g)).to.eql([node_]);
});
- it("does not error on self-referencing relations", function() {
+ it('does not error on self-referencing relations', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
node = iD.Node({id: 'n', loc: [1, 1]}),
@@ -57,7 +57,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(iD.geo.Extent([0, 0], [2, 2]), graph)).to.eql([relation]);
});
- it("adjusts entities that are force-rebased", function() {
+ it('adjusts entities that are force-rebased', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
node = iD.Node({id: 'n', loc: [1, 1]});
@@ -73,8 +73,8 @@ describe("iD.Tree", function() {
});
});
- describe("#intersects", function() {
- it("includes entities within extent, excludes those without", function() {
+ describe('#intersects', function() {
+ it('includes entities within extent, excludes those without', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
n1 = iD.Node({loc: [1, 1]}),
@@ -85,7 +85,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(extent, graph)).to.eql([n1]);
});
- it("includes intersecting relations after incomplete members are loaded", function() {
+ it('includes intersecting relations after incomplete members are loaded', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
n1 = iD.Node({id: 'n1', loc: [0, 0]}),
@@ -103,7 +103,7 @@ describe("iD.Tree", function() {
});
// This happens when local storage includes a changed way but not its nodes.
- it("includes intersecting ways after missing nodes are loaded", function() {
+ it('includes intersecting ways after missing nodes are loaded', function() {
var base = iD.Graph(),
tree = iD.Tree(base),
node = iD.Node({id: 'n', loc: [0.5, 0.5]}),
@@ -118,7 +118,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(extent, graph)).to.eql([node, way]);
});
- it("adjusts parent ways when a member node is moved", function() {
+ it('adjusts parent ways when a member node is moved', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
node = iD.Node({id: 'n', loc: [1, 1]}),
@@ -132,7 +132,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(extent, graph)).to.eql([]);
});
- it("adjusts parent relations when a member node is moved", function() {
+ it('adjusts parent relations when a member node is moved', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
node = iD.Node({id: 'n', loc: [1, 1]}),
@@ -146,7 +146,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(extent, graph)).to.eql([]);
});
- it("adjusts parent relations of parent ways when a member node is moved", function() {
+ it('adjusts parent relations of parent ways when a member node is moved', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
node = iD.Node({id: 'n', loc: [1, 1]}),
@@ -161,7 +161,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(extent, graph)).to.eql([]);
});
- it("adjusts parent ways when a member node is removed", function() {
+ it('adjusts parent ways when a member node is removed', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
n1 = iD.Node({id: 'n1', loc: [1, 1]}),
@@ -176,7 +176,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(extent, graph)).to.eql([n1]);
});
- it("don't include parent way multiple times when multiple child nodes are moved", function() {
+ it('don\'t include parent way multiple times when multiple child nodes are moved', function() {
// checks against the following regression: https://github.com/openstreetmap/iD/issues/1978
var graph = iD.Graph(),
tree = iD.Tree(graph),
@@ -196,7 +196,7 @@ describe("iD.Tree", function() {
);
});
- it("doesn't include removed entities", function() {
+ it('doesn\'t include removed entities', function() {
var graph = iD.Graph(),
tree = iD.Tree(graph),
node = iD.Node({loc: [1, 1]}),
@@ -209,7 +209,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(extent, graph)).to.eql([]);
});
- it("doesn't include removed entities after rebase", function() {
+ it('doesn\'t include removed entities after rebase', function() {
var base = iD.Graph(),
tree = iD.Tree(base),
node = iD.Node({id: 'n', loc: [1, 1]}),
@@ -223,7 +223,7 @@ describe("iD.Tree", function() {
expect(tree.intersects(extent, graph)).to.eql([]);
});
- it("handles recursive relations", function() {
+ it('handles recursive relations', function() {
var base = iD.Graph(),
tree = iD.Tree(base),
node = iD.Node({id: 'n', loc: [1, 1]}),
diff --git a/test/spec/core/way.js b/test/spec/core/way.js
index 19118c1af..2e701e670 100644
--- a/test/spec/core/way.js
+++ b/test/spec/core/way.js
@@ -1,33 +1,33 @@
describe('iD.Way', function() {
if (iD.debug) {
- it("freezes nodes", function () {
+ it('freezes nodes', function () {
expect(Object.isFrozen(iD.Way().nodes)).to.be.true;
});
}
- it("returns a way", function () {
+ it('returns a way', function () {
expect(iD.Way()).to.be.an.instanceOf(iD.Way);
- expect(iD.Way().type).to.equal("way");
+ expect(iD.Way().type).to.equal('way');
});
- it("defaults nodes to an empty array", function () {
+ it('defaults nodes to an empty array', function () {
expect(iD.Way().nodes).to.eql([]);
});
- it("sets nodes as specified", function () {
- expect(iD.Way({nodes: ["n-1"]}).nodes).to.eql(["n-1"]);
+ it('sets nodes as specified', function () {
+ expect(iD.Way({nodes: ['n-1']}).nodes).to.eql(['n-1']);
});
- it("defaults tags to an empty object", function () {
+ it('defaults tags to an empty object', function () {
expect(iD.Way().tags).to.eql({});
});
- it("sets tags as specified", function () {
+ it('sets tags as specified', function () {
expect(iD.Way({tags: {foo: 'bar'}}).tags).to.eql({foo: 'bar'});
});
- describe("#copy", function () {
- it("returns a new Way", function () {
+ describe('#copy', function () {
+ it('returns a new Way', function () {
var w = iD.Way({id: 'w'}),
result = w.copy(null, {});
@@ -35,7 +35,7 @@ describe('iD.Way', function() {
expect(result).not.to.equal(w);
});
- it("adds the new Way to input object", function () {
+ it('adds the new Way to input object', function () {
var w = iD.Way({id: 'w'}),
copies = {},
result = w.copy(null, copies);
@@ -43,7 +43,7 @@ describe('iD.Way', function() {
expect(copies.w).to.equal(result);
});
- it("returns an existing copy in input object", function () {
+ it('returns an existing copy in input object', function () {
var w = iD.Way({id: 'w'}),
copies = {},
result1 = w.copy(null, copies),
@@ -52,7 +52,7 @@ describe('iD.Way', function() {
expect(result1).to.equal(result2);
});
- it("deep copies nodes", function () {
+ it('deep copies nodes', function () {
var a = iD.Node({id: 'a'}),
b = iD.Node({id: 'b'}),
w = iD.Way({id: 'w', nodes: ['a', 'b']}),
@@ -68,7 +68,7 @@ describe('iD.Way', function() {
expect(result.nodes).to.deep.eql([copies.a.id, copies.b.id]);
});
- it("creates only one copy of shared nodes", function () {
+ it('creates only one copy of shared nodes', function () {
var a = iD.Node({id: 'a'}),
w = iD.Way({id: 'w', nodes: ['a', 'a']}),
graph = iD.Graph([a, w]),
@@ -79,45 +79,45 @@ describe('iD.Way', function() {
});
});
- describe("#first", function () {
- it("returns the first node", function () {
+ describe('#first', function () {
+ it('returns the first node', function () {
expect(iD.Way({nodes: ['a', 'b', 'c']}).first()).to.equal('a');
});
});
- describe("#last", function () {
- it("returns the last node", function () {
+ describe('#last', function () {
+ it('returns the last node', function () {
expect(iD.Way({nodes: ['a', 'b', 'c']}).last()).to.equal('c');
});
});
- describe("#contains", function () {
- it("returns true if the way contains the given node", function () {
+ describe('#contains', function () {
+ it('returns true if the way contains the given node', function () {
expect(iD.Way({nodes: ['a', 'b', 'c']}).contains('b')).to.be.true;
});
- it("returns false if the way does not contain the given node", function () {
+ it('returns false if the way does not contain the given node', function () {
expect(iD.Way({nodes: ['a', 'b', 'c']}).contains('d')).to.be.false;
});
});
- describe("#affix", function () {
- it("returns 'prefix' if the way starts with the given node", function () {
+ describe('#affix', function () {
+ it('returns \'prefix\' if the way starts with the given node', function () {
expect(iD.Way({nodes: ['a', 'b', 'c']}).affix('a')).to.equal('prefix');
});
- it("returns 'suffix' if the way ends with the given node", function () {
+ it('returns \'suffix\' if the way ends with the given node', function () {
expect(iD.Way({nodes: ['a', 'b', 'c']}).affix('c')).to.equal('suffix');
});
- it("returns falsy if the way does not start or end with the given node", function () {
+ it('returns falsy if the way does not start or end with the given node', function () {
expect(iD.Way({nodes: ['a', 'b', 'c']}).affix('b')).not.to.be.ok;
expect(iD.Way({nodes: []}).affix('b')).not.to.be.ok;
});
});
- describe("#extent", function () {
- it("returns the minimal extent containing all member nodes", function () {
+ describe('#extent', function () {
+ it('returns the minimal extent containing all member nodes', function () {
var node1 = iD.Node({loc: [0, 0]}),
node2 = iD.Node({loc: [5, 10]}),
way = iD.Way({nodes: [node1.id, node2.id]}),
@@ -340,48 +340,48 @@ describe('iD.Way', function() {
});
});
- describe("#isDegenerate", function() {
- it("returns true for a linear way with zero or one nodes", function () {
+ describe('#isDegenerate', function() {
+ it('returns true for a linear way with zero or one nodes', function () {
expect(iD.Way({nodes: []}).isDegenerate()).to.equal(true);
expect(iD.Way({nodes: ['a']}).isDegenerate()).to.equal(true);
});
- it("returns true for a circular way with only one unique node", function () {
+ it('returns true for a circular way with only one unique node', function () {
expect(iD.Way({nodes: ['a', 'a']}).isDegenerate()).to.equal(true);
});
- it("returns false for a linear way with two or more nodes", function () {
+ it('returns false for a linear way with two or more nodes', function () {
expect(iD.Way({nodes: ['a', 'b']}).isDegenerate()).to.equal(false);
});
- it("returns true for an area with zero, one, or two unique nodes", function () {
+ it('returns true for an area with zero, one, or two unique nodes', function () {
expect(iD.Way({tags: {area: 'yes'}, nodes: []}).isDegenerate()).to.equal(true);
expect(iD.Way({tags: {area: 'yes'}, nodes: ['a', 'a']}).isDegenerate()).to.equal(true);
expect(iD.Way({tags: {area: 'yes'}, nodes: ['a', 'b', 'a']}).isDegenerate()).to.equal(true);
});
- it("returns false for an area with three or more unique nodes", function () {
+ it('returns false for an area with three or more unique nodes', function () {
expect(iD.Way({tags: {area: 'yes'}, nodes: ['a', 'b', 'c', 'a']}).isDegenerate()).to.equal(false);
});
});
- describe("#areAdjacent", function() {
- it("returns false for nodes not in the way", function() {
+ describe('#areAdjacent', function() {
+ it('returns false for nodes not in the way', function() {
expect(iD.Way().areAdjacent('a', 'b')).to.equal(false);
});
- it("returns false for non-adjacent nodes in the way", function() {
+ it('returns false for non-adjacent nodes in the way', function() {
expect(iD.Way({nodes: ['a', 'b', 'c']}).areAdjacent('a', 'c')).to.equal(false);
});
- it("returns true for adjacent nodes in the way (forward)", function() {
+ it('returns true for adjacent nodes in the way (forward)', function() {
var way = iD.Way({nodes: ['a', 'b', 'c', 'd']});
expect(way.areAdjacent('a', 'b')).to.equal(true);
expect(way.areAdjacent('b', 'c')).to.equal(true);
expect(way.areAdjacent('c', 'd')).to.equal(true);
});
- it("returns true for adjacent nodes in the way (reverse)", function() {
+ it('returns true for adjacent nodes in the way (reverse)', function() {
var way = iD.Way({nodes: ['a', 'b', 'c', 'd']});
expect(way.areAdjacent('b', 'a')).to.equal(true);
expect(way.areAdjacent('c', 'b')).to.equal(true);
@@ -389,54 +389,54 @@ describe('iD.Way', function() {
});
});
- describe("#geometry", function() {
- it("returns 'line' when the way is not an area", function () {
+ describe('#geometry', function() {
+ it('returns \'line\' when the way is not an area', function () {
expect(iD.Way().geometry(iD.Graph())).to.equal('line');
});
- it("returns 'area' when the way is an area", function () {
+ it('returns \'area\' when the way is an area', function () {
expect(iD.Way({tags: { area: 'yes' }}).geometry(iD.Graph())).to.equal('area');
});
});
- describe("#addNode", function () {
- it("adds a node to the end of a way", function () {
+ describe('#addNode', function () {
+ it('adds a node to the end of a way', function () {
var w = iD.Way();
expect(w.addNode('a').nodes).to.eql(['a']);
});
- it("adds a node to a way at index 0", function () {
+ it('adds a node to a way at index 0', function () {
var w = iD.Way({nodes: ['a', 'b']});
expect(w.addNode('c', 0).nodes).to.eql(['c', 'a', 'b']);
});
- it("adds a node to a way at a positive index", function () {
+ it('adds a node to a way at a positive index', function () {
var w = iD.Way({nodes: ['a', 'b']});
expect(w.addNode('c', 1).nodes).to.eql(['a', 'c', 'b']);
});
- it("adds a node to a way at a negative index", function () {
+ it('adds a node to a way at a negative index', function () {
var w = iD.Way({nodes: ['a', 'b']});
expect(w.addNode('c', -1).nodes).to.eql(['a', 'c', 'b']);
});
});
- describe("#updateNode", function () {
- it("updates the node id at the specified index", function () {
+ describe('#updateNode', function () {
+ it('updates the node id at the specified index', function () {
var w = iD.Way({nodes: ['a', 'b', 'c']});
expect(w.updateNode('d', 1).nodes).to.eql(['a', 'd', 'c']);
});
});
- describe("#removeNode", function () {
- it("removes the node", function () {
+ describe('#removeNode', function () {
+ it('removes the node', function () {
var a = iD.Node({id: 'a'}),
w = iD.Way({nodes: ['a']});
expect(w.removeNode('a').nodes).to.eql([]);
});
- it("prevents duplicate consecutive nodes", function () {
+ it('prevents duplicate consecutive nodes', function () {
var a = iD.Node({id: 'a'}),
b = iD.Node({id: 'b'}),
c = iD.Node({id: 'c'}),
@@ -445,7 +445,7 @@ describe('iD.Way', function() {
expect(w.removeNode('c').nodes).to.eql(['a', 'b']);
});
- it("preserves circularity", function () {
+ it('preserves circularity', function () {
var a = iD.Node({id: 'a'}),
b = iD.Node({id: 'b'}),
c = iD.Node({id: 'c'}),
@@ -455,7 +455,7 @@ describe('iD.Way', function() {
expect(w.removeNode('a').nodes).to.eql(['b', 'c', 'd', 'b']);
});
- it("prevents duplicate consecutive nodes when preserving circularity", function () {
+ it('prevents duplicate consecutive nodes when preserving circularity', function () {
var a = iD.Node({id: 'a'}),
b = iD.Node({id: 'b'}),
c = iD.Node({id: 'c'}),
@@ -466,7 +466,7 @@ describe('iD.Way', function() {
});
});
- describe("#asJXON", function () {
+ describe('#asJXON', function () {
it('converts a way to jxon', function() {
var node = iD.Way({id: 'w-1', nodes: ['n1', 'n2'], tags: {highway: 'residential'}});
expect(node.asJXON()).to.eql({way: {
@@ -481,8 +481,8 @@ describe('iD.Way', function() {
});
});
- describe("#asGeoJSON", function () {
- it("converts a line to a GeoJSON LineString geometry", function () {
+ describe('#asGeoJSON', function () {
+ it('converts a line to a GeoJSON LineString geometry', function () {
var a = iD.Node({loc: [1, 2]}),
b = iD.Node({loc: [3, 4]}),
w = iD.Way({tags: {highway: 'residential'}, nodes: [a.id, b.id]}),
@@ -493,7 +493,7 @@ describe('iD.Way', function() {
expect(json.coordinates).to.eql([a.loc, b.loc]);
});
- it("converts an area to a GeoJSON Polygon geometry", function () {
+ it('converts an area to a GeoJSON Polygon geometry', function () {
var a = iD.Node({loc: [1, 2]}),
b = iD.Node({loc: [5, 6]}),
c = iD.Node({loc: [3, 4]}),
@@ -505,7 +505,7 @@ describe('iD.Way', function() {
expect(json.coordinates).to.eql([[a.loc, b.loc, c.loc, a.loc]]);
});
- it("converts an unclosed area to a GeoJSON LineString geometry", function () {
+ it('converts an unclosed area to a GeoJSON LineString geometry', function () {
var a = iD.Node({loc: [1, 2]}),
b = iD.Node({loc: [5, 6]}),
c = iD.Node({loc: [3, 4]}),
@@ -518,8 +518,8 @@ describe('iD.Way', function() {
});
});
- describe("#area", function() {
- it("returns a relative measure of area", function () {
+ describe('#area', function() {
+ it('returns a relative measure of area', function () {
var graph = iD.Graph([
iD.Node({id: 'a', loc: [-0.0002, 0.0001]}),
iD.Node({id: 'b', loc: [ 0.0002, 0.0001]}),
@@ -539,7 +539,7 @@ describe('iD.Way', function() {
expect(s).to.be.lt(l);
});
- it("treats unclosed areas as if they were closed", function () {
+ it('treats unclosed areas as if they were closed', function () {
var graph = iD.Graph([
iD.Node({id: 'a', loc: [-0.0002, 0.0001]}),
iD.Node({id: 'b', loc: [ 0.0002, 0.0001]}),
@@ -555,7 +555,7 @@ describe('iD.Way', function() {
expect(s).to.equal(l);
});
- it("returns 0 for degenerate areas", function () {
+ it('returns 0 for degenerate areas', function () {
var graph = iD.Graph([
iD.Node({id: 'a', loc: [-0.0002, 0.0001]}),
iD.Node({id: 'b', loc: [ 0.0002, 0.0001]}),
diff --git a/test/spec/geo.js b/test/spec/geo.js
index 854caf984..c42062c99 100644
--- a/test/spec/geo.js
+++ b/test/spec/geo.js
@@ -194,7 +194,7 @@ describe('iD.geo', function() {
index: undefined,
distance: Infinity,
loc: undefined
- })
+ });
});
it('returns undefined properties for a degenerate way (single node)', function() {
@@ -202,7 +202,7 @@ describe('iD.geo', function() {
index: undefined,
distance: Infinity,
loc: undefined
- })
+ });
});
it('calculates the orthogonal projection of a point onto a segment', function() {
diff --git a/test/spec/geo/extent.js b/test/spec/geo/extent.js
index b58dbefec..ce8627624 100644
--- a/test/spec/geo/extent.js
+++ b/test/spec/geo/extent.js
@@ -1,52 +1,52 @@
-describe("iD.geo.Extent", function () {
- describe("constructor", function () {
- it("defaults to infinitely empty extent", function () {
+describe('iD.geo.Extent', function () {
+ describe('constructor', function () {
+ it('defaults to infinitely empty extent', function () {
expect(iD.geo.Extent().equals([[Infinity, Infinity], [-Infinity, -Infinity]])).to.be.ok;
});
- it("constructs via a point", function () {
+ it('constructs via a point', function () {
var p = [0, 0];
expect(iD.geo.Extent(p).equals([p, p])).to.be.ok;
});
- it("constructs via two points", function () {
+ it('constructs via two points', function () {
var min = [0, 0],
max = [5, 10];
expect(iD.geo.Extent(min, max).equals([min, max])).to.be.ok;
});
- it("constructs via an extent", function () {
+ it('constructs via an extent', function () {
var min = [0, 0],
max = [5, 10];
expect(iD.geo.Extent([min, max]).equals([min, max])).to.be.ok;
});
- it("constructs via an iD.geo.Extent", function () {
+ it('constructs via an iD.geo.Extent', function () {
var min = [0, 0],
max = [5, 10],
extent = iD.geo.Extent(min, max);
expect(iD.geo.Extent(extent).equals(extent)).to.be.ok;
});
- it("has length 2", function () {
+ it('has length 2', function () {
expect(iD.geo.Extent().length).to.equal(2);
});
- it("has min element", function () {
+ it('has min element', function () {
var min = [0, 0],
max = [5, 10];
expect(iD.geo.Extent(min, max)[0]).to.equal(min);
});
- it("has max element", function () {
+ it('has max element', function () {
var min = [0, 0],
max = [5, 10];
expect(iD.geo.Extent(min, max)[1]).to.equal(max);
});
});
- describe("#equals", function () {
- it("tests extent equality", function () {
+ describe('#equals', function () {
+ it('tests extent equality', function () {
var e1 = iD.geo.Extent([0, 0], [10, 10]),
e2 = iD.geo.Extent([0, 0], [10, 10]),
e3 = iD.geo.Extent([0, 0], [12, 12]);
@@ -55,63 +55,63 @@ describe("iD.geo.Extent", function () {
});
});
- describe("#center", function () {
- it("returns the center point", function () {
+ describe('#center', function () {
+ it('returns the center point', function () {
expect(iD.geo.Extent([0, 0], [5, 10]).center()).to.eql([2.5, 5]);
});
});
- describe("#rectangle", function () {
- it("returns the extent as a rectangle", function () {
+ describe('#rectangle', function () {
+ it('returns the extent as a rectangle', function () {
expect(iD.geo.Extent([0, 0], [5, 10]).rectangle()).to.eql([0, 0, 5, 10]);
});
});
- describe("#polygon", function () {
- it("returns the extent as a polygon", function () {
+ describe('#polygon', function () {
+ it('returns the extent as a polygon', function () {
expect(iD.geo.Extent([0, 0], [5, 10]).polygon())
.to.eql([[0, 0], [0, 10], [5, 10], [5, 0], [0, 0]]);
});
});
- describe("#area", function () {
- it("returns the area", function () {
+ describe('#area', function () {
+ it('returns the area', function () {
expect(iD.geo.Extent([0, 0], [5, 10]).area()).to.eql(50);
});
});
- describe("#padByMeters", function () {
- it("does not change centerpoint of an extent", function () {
+ describe('#padByMeters', function () {
+ it('does not change centerpoint of an extent', function () {
var min = [0, 0], max = [5, 10];
expect(iD.geo.Extent(min, max).padByMeters(100).center()).to.eql([2.5, 5]);
});
- it("does not affect the extent with a pad of zero", function () {
+ it('does not affect the extent with a pad of zero', function () {
var min = [0, 0], max = [5, 10];
expect(iD.geo.Extent(min, max).padByMeters(0)[0]).to.eql([0, 0]);
});
});
- describe("#extend", function () {
- it("does not modify self", function () {
+ describe('#extend', function () {
+ it('does not modify self', function () {
var extent = iD.geo.Extent([0, 0], [0, 0]);
extent.extend([1, 1]);
expect(extent.equals([[0, 0], [0, 0]])).to.be.ok;
});
- it("returns the minimal extent containing self and the given point", function () {
+ it('returns the minimal extent containing self and the given point', function () {
expect(iD.geo.Extent().extend([0, 0]).equals([[0, 0], [0, 0]])).to.be.ok;
expect(iD.geo.Extent([0, 0], [0, 0]).extend([5, 10]).equals([[0, 0], [5, 10]])).to.be.ok;
});
- it("returns the minimal extent containing self and the given extent", function () {
+ it('returns the minimal extent containing self and the given extent', function () {
expect(iD.geo.Extent().extend([[0, 0], [5, 10]]).equals([[0, 0], [5, 10]])).to.be.ok;
expect(iD.geo.Extent([0, 0], [0, 0]).extend([[4, -1], [5, 10]]).equals([[0, -1], [5, 10]])).to.be.ok;
});
});
- describe("#_extend", function () {
- it("extends self to the minimal extent containing self and the given extent", function () {
+ describe('#_extend', function () {
+ it('extends self to the minimal extent containing self and the given extent', function () {
var e = iD.geo.Extent();
e._extend([[0, 0], [5, 10]]);
expect(e.equals([[0, 0], [5, 10]])).to.be.ok;
@@ -123,99 +123,99 @@ describe("iD.geo.Extent", function () {
});
describe('#contains', function () {
- it("returns true for a point inside self", function () {
+ it('returns true for a point inside self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).contains([2, 2])).to.be.true;
});
- it("returns true for a point on the boundary of self", function () {
+ it('returns true for a point on the boundary of self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).contains([0, 0])).to.be.true;
});
- it("returns false for a point outside self", function () {
+ it('returns false for a point outside self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).contains([6, 6])).to.be.false;
});
- it("returns true for an extent contained by self", function () {
+ it('returns true for an extent contained by self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).contains([[1, 1], [2, 2]])).to.be.true;
expect(iD.geo.Extent([1, 1], [2, 2]).contains([[0, 0], [5, 5]])).to.be.false;
});
- it("returns false for an extent partially contained by self", function () {
+ it('returns false for an extent partially contained by self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).contains([[1, 1], [6, 6]])).to.be.false;
expect(iD.geo.Extent([1, 1], [6, 6]).contains([[0, 0], [5, 5]])).to.be.false;
});
- it("returns false for an extent not intersected by self", function () {
+ it('returns false for an extent not intersected by self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).contains([[6, 6], [7, 7]])).to.be.false;
expect(iD.geo.Extent([[6, 6], [7, 7]]).contains([[0, 0], [5, 5]])).to.be.false;
});
});
describe('#intersects', function () {
- it("returns true for a point inside self", function () {
+ it('returns true for a point inside self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).intersects([2, 2])).to.be.true;
});
- it("returns true for a point on the boundary of self", function () {
+ it('returns true for a point on the boundary of self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).intersects([0, 0])).to.be.true;
});
- it("returns false for a point outside self", function () {
+ it('returns false for a point outside self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).intersects([6, 6])).to.be.false;
});
- it("returns true for an extent contained by self", function () {
+ it('returns true for an extent contained by self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).intersects([[1, 1], [2, 2]])).to.be.true;
expect(iD.geo.Extent([1, 1], [2, 2]).intersects([[0, 0], [5, 5]])).to.be.true;
});
- it("returns true for an extent partially contained by self", function () {
+ it('returns true for an extent partially contained by self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).intersects([[1, 1], [6, 6]])).to.be.true;
expect(iD.geo.Extent([1, 1], [6, 6]).intersects([[0, 0], [5, 5]])).to.be.true;
});
- it("returns false for an extent not intersected by self", function () {
+ it('returns false for an extent not intersected by self', function () {
expect(iD.geo.Extent([0, 0], [5, 5]).intersects([[6, 6], [7, 7]])).to.be.false;
expect(iD.geo.Extent([[6, 6], [7, 7]]).intersects([[0, 0], [5, 5]])).to.be.false;
});
});
- describe("#intersection", function () {
- it("returns an empty extent if self does not intersect with other", function () {
+ describe('#intersection', function () {
+ it('returns an empty extent if self does not intersect with other', function () {
var a = iD.geo.Extent([0, 0], [5, 5]),
b = iD.geo.Extent([6, 6], [7, 7]);
expect(a.intersection(b)).to.eql(iD.geo.Extent());
});
- it("returns the intersection of self with other (1)", function () {
+ it('returns the intersection of self with other (1)', function () {
var a = iD.geo.Extent([0, 0], [5, 5]),
b = iD.geo.Extent([3, 4], [7, 7]);
expect(a.intersection(b)).to.eql(iD.geo.Extent([3, 4], [5, 5]));
expect(b.intersection(a)).to.eql(iD.geo.Extent([3, 4], [5, 5]));
});
- it("returns the intersection of self with other (2)", function () {
+ it('returns the intersection of self with other (2)', function () {
var a = iD.geo.Extent([0, 0], [5, 5]),
b = iD.geo.Extent([3, -4], [7, 2]);
expect(a.intersection(b)).to.eql(iD.geo.Extent([3, 0], [5, 2]));
expect(b.intersection(a)).to.eql(iD.geo.Extent([3, 0], [5, 2]));
});
- it("returns the intersection of self with other (3)", function () {
+ it('returns the intersection of self with other (3)', function () {
var a = iD.geo.Extent([0, 0], [5, 5]),
b = iD.geo.Extent([3, 3], [4, 7]);
expect(a.intersection(b)).to.eql(iD.geo.Extent([3, 3], [4, 5]));
expect(b.intersection(a)).to.eql(iD.geo.Extent([3, 3], [4, 5]));
});
- it("returns the intersection of self with other (4)", function () {
+ it('returns the intersection of self with other (4)', function () {
var a = iD.geo.Extent([0, 0], [5, 5]),
b = iD.geo.Extent([3, -2], [4, 2]);
expect(a.intersection(b)).to.eql(iD.geo.Extent([3, 0], [4, 2]));
expect(b.intersection(a)).to.eql(iD.geo.Extent([3, 0], [4, 2]));
});
- it("returns the intersection of self with other (5)", function () {
+ it('returns the intersection of self with other (5)', function () {
var a = iD.geo.Extent([0, 0], [5, 5]),
b = iD.geo.Extent([1, 1], [2, 2]);
expect(a.intersection(b)).to.eql(iD.geo.Extent([1, 1], [2, 2]));
@@ -223,22 +223,22 @@ describe("iD.geo.Extent", function () {
});
});
- describe("#percentContainedIn", function () {
- it("returns a 0 if self does not intersect other", function () {
+ describe('#percentContainedIn', function () {
+ it('returns a 0 if self does not intersect other', function () {
var a = iD.geo.Extent([0, 0], [1, 1]),
b = iD.geo.Extent([0, 3], [4, 1]);
expect(a.percentContainedIn(b)).to.eql(0);
expect(b.percentContainedIn(a)).to.eql(0);
});
- it("returns the percent contained of self with other (1)", function () {
+ it('returns the percent contained of self with other (1)', function () {
var a = iD.geo.Extent([0, 0], [2, 1]),
b = iD.geo.Extent([1, 0], [3, 1]);
expect(a.percentContainedIn(b)).to.eql(0.5);
expect(b.percentContainedIn(a)).to.eql(0.5);
});
- it("returns the percent contained of self with other (2)", function () {
+ it('returns the percent contained of self with other (2)', function () {
var a = iD.geo.Extent([0, 0], [4, 1]),
b = iD.geo.Extent([3, 0], [4, 2]);
expect(a.percentContainedIn(b)).to.eql(0.25);
diff --git a/test/spec/geo/intersection.js b/test/spec/geo/intersection.js
index 88e7b9e53..e1d4253fa 100644
--- a/test/spec/geo/intersection.js
+++ b/test/spec/geo/intersection.js
@@ -1,4 +1,4 @@
-describe("iD.geo.Intersection", function() {
+describe('iD.geo.Intersection', function() {
describe('highways', function() {
it('excludes non-highways', function() {
var graph = iD.Graph([
@@ -11,7 +11,7 @@ describe("iD.geo.Intersection", function() {
expect(iD.geo.Intersection(graph, '*').ways).to.eql([]);
});
- it("excludes degenerate highways", function() {
+ it('excludes degenerate highways', function() {
var graph = iD.Graph([
iD.Node({id: 'u'}),
iD.Node({id: '*'}),
@@ -21,7 +21,7 @@ describe("iD.geo.Intersection", function() {
expect(_.map(iD.geo.Intersection(graph, '*').ways, 'id')).to.eql(['=']);
});
- it("excludes coincident highways", function() {
+ it('excludes coincident highways', function() {
var graph = iD.Graph([
iD.Node({id: 'u'}),
iD.Node({id: '*'}),
@@ -64,7 +64,7 @@ describe("iD.geo.Intersection", function() {
});
describe('#turns', function() {
- it("permits turns onto a way forward", function() {
+ it('permits turns onto a way forward', function() {
// u====*--->w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -83,7 +83,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("permits turns onto a way backward", function() {
+ it('permits turns onto a way backward', function() {
// u====*<---w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -102,7 +102,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("permits turns from a way that must be split", function() {
+ it('permits turns from a way that must be split', function() {
// w
// |
// u===*
@@ -137,7 +137,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("permits turns to a way that must be split", function() {
+ it('permits turns to a way that must be split', function() {
// w
// |
// u===*
@@ -172,7 +172,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("permits turns from a oneway forward", function() {
+ it('permits turns from a oneway forward', function() {
// u===>v----w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -190,7 +190,7 @@ describe("iD.geo.Intersection", function() {
}]);
});
- it("permits turns from a reverse oneway backward", function() {
+ it('permits turns from a reverse oneway backward', function() {
// u<===*----w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -208,7 +208,7 @@ describe("iD.geo.Intersection", function() {
}]);
});
- it("omits turns from a oneway backward", function() {
+ it('omits turns from a oneway backward', function() {
// u<===*----w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -220,7 +220,7 @@ describe("iD.geo.Intersection", function() {
expect(iD.geo.Intersection(graph, '*').turns('u')).to.eql([]);
});
- it("omits turns from a reverse oneway forward", function() {
+ it('omits turns from a reverse oneway forward', function() {
// u===>*----w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -232,7 +232,7 @@ describe("iD.geo.Intersection", function() {
expect(iD.geo.Intersection(graph, '*').turns('u')).to.eql([]);
});
- it("permits turns onto a oneway forward", function() {
+ it('permits turns onto a oneway forward', function() {
// u====*--->w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -251,7 +251,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("permits turns onto a reverse oneway backward", function() {
+ it('permits turns onto a reverse oneway backward', function() {
// u====*<---w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -270,7 +270,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("omits turns onto a oneway backward", function() {
+ it('omits turns onto a oneway backward', function() {
// u====*<---w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -282,7 +282,7 @@ describe("iD.geo.Intersection", function() {
expect(iD.geo.Intersection(graph, '*').turns('u').length).to.eql(1);
});
- it("omits turns onto a reverse oneway forward", function() {
+ it('omits turns onto a reverse oneway forward', function() {
// u====*--->w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -294,7 +294,7 @@ describe("iD.geo.Intersection", function() {
expect(iD.geo.Intersection(graph, '*').turns('u').length).to.eql(1);
});
- it("includes U-turns", function() {
+ it('includes U-turns', function() {
// u====*--->w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -314,7 +314,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("restricts turns with a restriction relation", function() {
+ it('restricts turns with a restriction relation', function() {
// u====*--->w
var graph = iD.Graph([
iD.Node({id: 'u'}),
@@ -339,7 +339,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("restricts turns affected by an only_* restriction relation", function() {
+ it('restricts turns affected by an only_* restriction relation', function() {
// u====*~~~~v
// |
// w
@@ -383,7 +383,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("permits turns to a circular way", function() {
+ it('permits turns to a circular way', function() {
//
// b -- c
// | |
@@ -419,7 +419,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("permits turns from a circular way", function() {
+ it('permits turns from a circular way', function() {
//
// b -- c
// | |
@@ -455,7 +455,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("permits turns to a oneway circular way", function() {
+ it('permits turns to a oneway circular way', function() {
//
// b -- c
// | |
@@ -486,7 +486,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("permits turns to a reverse oneway circular way", function() {
+ it('permits turns to a reverse oneway circular way', function() {
//
// b -- c
// | |
@@ -517,7 +517,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("permits turns from a oneway circular way", function() {
+ it('permits turns from a oneway circular way', function() {
//
// b -- c
// | |
@@ -547,7 +547,7 @@ describe("iD.geo.Intersection", function() {
});
});
- it("permits turns from a reverse oneway circular way", function() {
+ it('permits turns from a reverse oneway circular way', function() {
//
// b -- c
// | |
diff --git a/test/spec/geo/multipolygon.js b/test/spec/geo/multipolygon.js
index 3bfefdfcd..7f7081be9 100644
--- a/test/spec/geo/multipolygon.js
+++ b/test/spec/geo/multipolygon.js
@@ -1,5 +1,5 @@
-describe("iD.geo.simpleMultipolygonOuterMember", function() {
- it("returns the outer member of a simple multipolygon", function() {
+describe('iD.geo.simpleMultipolygonOuterMember', function() {
+ it('returns the outer member of a simple multipolygon', function() {
var inner = iD.Way(),
outer = iD.Way(),
relation = iD.Relation({tags: {type: 'multipolygon'}, members: [
@@ -12,7 +12,7 @@ describe("iD.geo.simpleMultipolygonOuterMember", function() {
expect(iD.geo.simpleMultipolygonOuterMember(outer, graph)).to.equal(outer);
});
- it("returns falsy for a complex multipolygon", function() {
+ it('returns falsy for a complex multipolygon', function() {
var inner = iD.Way(),
outer1 = iD.Way(),
outer2 = iD.Way(),
@@ -28,7 +28,7 @@ describe("iD.geo.simpleMultipolygonOuterMember", function() {
expect(iD.geo.simpleMultipolygonOuterMember(outer2, graph)).not.to.be.ok;
});
- it("handles incomplete relations", function() {
+ it('handles incomplete relations', function() {
var way = iD.Way({id: 'w'}),
relation = iD.Relation({id: 'r', tags: {type: 'multipolygon'}, members: [
{id: 'o', role: 'outer'},
@@ -40,8 +40,8 @@ describe("iD.geo.simpleMultipolygonOuterMember", function() {
});
});
-describe("iD.geo.joinWays", function() {
- it("returns an array of members with nodes properties", function() {
+describe('iD.geo.joinWays', function() {
+ it('returns an array of members with nodes properties', function() {
var node = iD.Node({loc: [0, 0]}),
way = iD.Way({nodes: [node.id]}),
member = {id: way.id, type: 'way'},
@@ -55,7 +55,7 @@ describe("iD.geo.joinWays", function() {
expect(result[0][0]).to.equal(member);
});
- it("returns the members in the correct order", function() {
+ it('returns the members in the correct order', function() {
// a<===b--->c~~~>d
var graph = iD.Graph([
iD.Node({id: 'a', loc: [0, 0]}),
@@ -76,7 +76,7 @@ describe("iD.geo.joinWays", function() {
expect(_.map(result[0], 'id')).to.eql(['=', '-', '~']);
});
- it("reverses member tags of reversed segements", function() {
+ it('reverses member tags of reversed segements', function() {
// a --> b <== c
// Expected result:
// a --> b --> c
@@ -93,14 +93,14 @@ describe("iD.geo.joinWays", function() {
expect(result[0][1].tags).to.eql({'oneway': '-1', 'lanes:backward': 2});
});
- it("ignores non-way members", function() {
+ it('ignores non-way members', function() {
var node = iD.Node({loc: [0, 0]}),
member = {id: 'n', type: 'node'},
graph = iD.Graph([node]);
expect(iD.geo.joinWays([member], graph)).to.eql([]);
});
- it("ignores incomplete members", function() {
+ it('ignores incomplete members', function() {
var member = {id: 'w', type: 'way'},
graph = iD.Graph();
expect(iD.geo.joinWays([member], graph)).to.eql([]);
diff --git a/test/spec/lib/d3.combobox.js b/test/spec/lib/d3.combobox.js
index dbf139954..9b4011643 100644
--- a/test/spec/lib/d3.combobox.js
+++ b/test/spec/lib/d3.combobox.js
@@ -1,4 +1,4 @@
-describe("d3.combobox", function() {
+describe('d3.combobox', function() {
var body, content, input, combobox;
var data = [
@@ -69,19 +69,19 @@ describe("d3.combobox", function() {
body.selectAll('.combobox').remove();
});
- it("adds the combobox-input class", function() {
+ it('adds the combobox-input class', function() {
input.call(combobox);
expect(input).to.be.classed('combobox-input');
});
- it("shows a menu of entries on focus", function() {
+ it('shows a menu of entries on focus', function() {
input.call(combobox.data(data));
input.node().focus();
expect(body.selectAll('.combobox-option').size()).to.equal(3);
expect(body.selectAll('.combobox-option').text()).to.equal('foo');
});
- it("filters entries to those matching the value", function() {
+ it('filters entries to those matching the value', function() {
input.property('value', 'b').call(combobox.data(data));
input.node().focus();
expect(body.selectAll('.combobox-option').size()).to.equal(2);
@@ -89,33 +89,33 @@ describe("d3.combobox", function() {
expect(body.selectAll('.combobox-option')[0][1].text).to.equal('Baz');
});
- it("shows no menu on focus if it would contain only one item", function() {
+ it('shows no menu on focus if it would contain only one item', function() {
input.property('value', 'f').call(combobox.data(data));
input.node().focus();
expect(body.selectAll('.combobox-option').size()).to.equal(0);
});
- it("shows menu on focus if it would contain at least minItems items", function() {
+ it('shows menu on focus if it would contain at least minItems items', function() {
combobox.minItems(1);
input.property('value', 'f').call(combobox.data(data));
input.node().focus();
expect(body.selectAll('.combobox-option').size()).to.equal(1);
});
- it("shows all entries when clicking on the caret", function() {
+ it('shows all entries when clicking on the caret', function() {
input.property('value', 'foo').call(combobox.data(data));
happen.mousedown(body.selectAll('.combobox-caret').node());
expect(body.selectAll('.combobox-option').size()).to.equal(3);
expect(body.selectAll('.combobox-option').text()).to.equal('foo');
});
- it("is initially shown with no selection", function() {
+ it('is initially shown with no selection', function() {
input.call(combobox.data(data));
input.node().focus();
expect(body.selectAll('.combobox-option.selected').size()).to.equal(0);
});
- it("selects the first option matching the input", function() {
+ it('selects the first option matching the input', function() {
input.call(combobox.data(data));
input.node().focus();
simulateKeypress('b');
@@ -123,7 +123,7 @@ describe("d3.combobox", function() {
expect(body.selectAll('.combobox-option.selected').text()).to.equal('bar');
});
- it("selects the completed portion of the value", function() {
+ it('selects the completed portion of the value', function() {
input.call(combobox.data(data));
input.node().focus();
simulateKeypress('b');
@@ -132,7 +132,7 @@ describe("d3.combobox", function() {
expect(input.property('selectionEnd')).to.equal(3);
});
- it("does not preserve the case of the input portion of the value by default", function() {
+ it('does not preserve the case of the input portion of the value by default', function() {
input.call(combobox.data(data));
input.node().focus();
simulateKeypress('B');
@@ -141,7 +141,7 @@ describe("d3.combobox", function() {
expect(input.property('selectionEnd')).to.equal(3);
});
- it("does preserve the case of the input portion of the value with caseSensitive option", function() {
+ it('does preserve the case of the input portion of the value with caseSensitive option', function() {
combobox.caseSensitive(true);
input.call(combobox.data(data));
input.node().focus();
@@ -151,14 +151,14 @@ describe("d3.combobox", function() {
expect(input.property('selectionEnd')).to.equal(3);
});
- it("does not select when value is empty", function() {
+ it('does not select when value is empty', function() {
input.call(combobox.data(data));
input.node().focus();
happen.once(input.node(), {type: 'input'});
expect(body.selectAll('.combobox-option.selected').size()).to.equal(0);
});
- it("does not select when value is not a prefix of any suggestion", function() {
+ it('does not select when value is not a prefix of any suggestion', function() {
input.call(combobox.fetcher(function(_, cb) { cb(data); }));
input.node().focus();
simulateKeypress('b');
@@ -166,7 +166,7 @@ describe("d3.combobox", function() {
expect(body.selectAll('.combobox-option.selected').size()).to.equal(0);
});
- it("does not select or autocomplete after ⌫", function() {
+ it('does not select or autocomplete after ⌫', function() {
input.call(combobox.data(data));
input.node().focus();
simulateKeypress('b');
@@ -175,7 +175,7 @@ describe("d3.combobox", function() {
expect(input.property('value')).to.equal('b');
});
- it("does not select or autocomplete after ⌦", function() {
+ it('does not select or autocomplete after ⌦', function() {
input.call(combobox.data(data));
input.node().focus();
simulateKeypress('f');
@@ -187,7 +187,7 @@ describe("d3.combobox", function() {
expect(input.property('value')).to.equal('b');
});
- it("selects and autocompletes the next/prev suggestion on ↓/↑", function() {
+ it('selects and autocompletes the next/prev suggestion on ↓/↑', function() {
input.call(combobox.data(data));
input.node().focus();
@@ -207,7 +207,7 @@ describe("d3.combobox", function() {
expect(input.property('value')).to.equal('foo');
});
- it("emits accepted event with selected datum on ⇥", function(done) {
+ it('emits accepted event with selected datum on ⇥', function(done) {
combobox.on('accept', function(d) {
expect(d).to.eql({title: 'bar', value: 'bar'});
done();
@@ -218,7 +218,7 @@ describe("d3.combobox", function() {
simulateKeypress('⇥');
});
- it("emits accepted event with selected datum on ↩", function(done) {
+ it('emits accepted event with selected datum on ↩', function(done) {
combobox.on('accept', function(d) {
expect(d).to.eql({title: 'bar', value: 'bar'});
done();
@@ -229,7 +229,7 @@ describe("d3.combobox", function() {
simulateKeypress('↩');
});
- it("hides on ↩", function() {
+ it('hides on ↩', function() {
input.call(combobox.data(data));
input.node().focus();
simulateKeypress('↩');
diff --git a/test/spec/lib/d3.keybinding.js b/test/spec/lib/d3.keybinding.js
index 1639cb459..cb96b946c 100644
--- a/test/spec/lib/d3.keybinding.js
+++ b/test/spec/lib/d3.keybinding.js
@@ -1,4 +1,4 @@
-describe("d3.keybinding", function() {
+describe('d3.keybinding', function() {
var keybinding, spy, input;
beforeEach(function () {
@@ -13,12 +13,12 @@ describe("d3.keybinding", function() {
input.remove();
});
- describe("#on", function () {
- it("returns self", function () {
+ describe('#on', function () {
+ it('returns self', function () {
expect(keybinding.on('a', spy)).to.equal(keybinding);
});
- it("adds a binding for the specified bare key", function () {
+ it('adds a binding for the specified bare key', function () {
d3.select(document).call(keybinding.on('A', spy));
happen.keydown(document, {keyCode: 65, metaKey: true});
@@ -28,7 +28,7 @@ describe("d3.keybinding", function() {
expect(spy).to.have.been.calledOnce;
});
- it("adds a binding for the specified key combination", function () {
+ it('adds a binding for the specified key combination', function () {
d3.select(document).call(keybinding.on('⌘+A', spy));
happen.keydown(document, {keyCode: 65});
@@ -38,21 +38,21 @@ describe("d3.keybinding", function() {
expect(spy).to.have.been.calledOnce;
});
- it("does not dispatch when focus is in input elements by default", function () {
+ it('does not dispatch when focus is in input elements by default', function () {
d3.select(document).call(keybinding.on('A', spy));
happen.keydown(input.node(), {keyCode: 65});
expect(spy).not.to.have.been.called;
});
- it("dispatches when focus is in input elements when the capture flag was passed", function () {
+ it('dispatches when focus is in input elements when the capture flag was passed', function () {
d3.select(document).call(keybinding.on('A', spy, true));
happen.keydown(input.node(), {keyCode: 65});
expect(spy).to.have.been.calledOnce;
});
- it("resets bindings when keybinding.off is called", function () {
+ it('resets bindings when keybinding.off is called', function () {
d3.select(document).call(keybinding.on('A', spy));
happen.keydown(document, {keyCode: 65});
expect(spy).to.have.been.calledOnce;
diff --git a/test/spec/lib/diff3.js b/test/spec/lib/diff3.js
index 3cf741554..29c1db1cb 100644
--- a/test/spec/lib/diff3.js
+++ b/test/spec/lib/diff3.js
@@ -1,4 +1,4 @@
-describe("diff3", function() {
+describe('diff3', function() {
function split(s) {
return s ? s.split(/ /) : [];
}
diff --git a/test/spec/lib/locale.js b/test/spec/lib/locale.js
index 8b4c355fb..abf4b03c2 100644
--- a/test/spec/lib/locale.js
+++ b/test/spec/lib/locale.js
@@ -1,11 +1,13 @@
-describe("locale", function() {
+/* global locale: true */
+/* eslint no-console: 0 */
+describe('locale', function() {
var saved, error;
beforeEach(function() {
saved = locale;
error = console.error;
console.error = function () {};
- locale = { _current: 'en', en: {test: 'test', foo: 'bar'}, __: {}}
+ locale = { _current: 'en', en: {test: 'test', foo: 'bar'}, __: {}};
});
afterEach(function() {
@@ -13,16 +15,16 @@ describe("locale", function() {
console.error = error;
});
- describe("t", function() {
- it("defaults to locale._current", function() {
+ describe('t', function() {
+ it('defaults to locale._current', function() {
expect(t('test')).to.equal('test');
});
- it("supports a default option", function() {
+ it('supports a default option', function() {
expect(t('nonesuch', {default: 'default'})).to.equal('default');
});
- it("falls back to en", function() {
+ it('falls back to en', function() {
locale._current = '__';
expect(t('test')).to.equal('test');
});
diff --git a/test/spec/modes/add_point.js b/test/spec/modes/add_point.js
index 4f90feefd..516dc56f8 100644
--- a/test/spec/modes/add_point.js
+++ b/test/spec/modes/add_point.js
@@ -1,4 +1,4 @@
-describe("iD.modes.AddPoint", function() {
+describe('iD.modes.AddPoint', function() {
var context;
beforeEach(function() {
@@ -19,8 +19,8 @@ describe("iD.modes.AddPoint", function() {
context.enter(iD.modes.AddPoint(context));
});
- describe("clicking the map", function () {
- it("adds a node", function() {
+ describe('clicking the map', function () {
+ it('adds a node', function() {
happen.mousedown(context.surface().node(), {});
happen.mouseup(window, {});
expect(context.changes().created).to.have.length(1);
@@ -28,7 +28,7 @@ describe("iD.modes.AddPoint", function() {
d3.select('window').on('click.draw-block', null);
});
- it("selects the node", function() {
+ it('selects the node', function() {
happen.mousedown(context.surface().node(), {});
happen.mouseup(window, {});
expect(context.mode().id).to.equal('select');
@@ -37,8 +37,8 @@ describe("iD.modes.AddPoint", function() {
});
});
- describe("pressing ⎋", function() {
- it("exits to browse mode", function(done) {
+ describe('pressing ⎋', function() {
+ it('exits to browse mode', function(done) {
happen.keydown(document, {keyCode: 27});
window.setTimeout(function() {
expect(context.mode().id).to.equal('browse');
diff --git a/test/spec/presets.js b/test/spec/presets.js
index c77f6d377..8e8be586e 100644
--- a/test/spec/presets.js
+++ b/test/spec/presets.js
@@ -1,4 +1,4 @@
-describe("iD.presets.presets", function() {
+describe('iD.presets.presets', function() {
var p = {
point: {
tags: {},
@@ -24,14 +24,14 @@ describe("iD.presets.presets", function() {
var c = iD.presets.presets().load({presets: p});
- describe("#match", function() {
- it("returns a collection containing presets matching a geometry and tags", function() {
+ describe('#match', function() {
+ it('returns a collection containing presets matching a geometry and tags', function() {
var way = iD.Way({tags: { highway: 'residential'}}),
graph = iD.Graph([way]);
expect(c.match(way, graph).id).to.eql('residential');
});
- it("returns the appropriate fallback preset when no tags match", function() {
+ it('returns the appropriate fallback preset when no tags match', function() {
var point = iD.Node(),
line = iD.Way({tags: {foo: 'bar'}}),
graph = iD.Graph([point, line]);
@@ -40,7 +40,7 @@ describe("iD.presets.presets", function() {
});
});
- describe("#areaKeys", function() {
+ describe('#areaKeys', function() {
var presets = iD.presets.presets().load({
presets: {
'amenity/fuel/shell': {
@@ -75,57 +75,57 @@ describe("iD.presets.presets", function() {
}
});
- it("whitelists keys for presets with area geometry", function() {
+ it('whitelists keys for presets with area geometry', function() {
expect(presets.areaKeys()).to.include.keys('natural');
});
- it("blacklists key-values for presets with a line geometry", function() {
+ it('blacklists key-values for presets with a line geometry', function() {
expect(presets.areaKeys().natural).to.include.keys('tree_row');
expect(presets.areaKeys().natural.tree_row).to.be.true;
});
- it("does not blacklist key-values for presets with both area and line geometry", function() {
+ it('does not blacklist key-values for presets with both area and line geometry', function() {
expect(presets.areaKeys().golf).not.to.include.keys('water_hazard');
});
- it("does not blacklist key-values for presets with neither area nor line geometry", function() {
+ it('does not blacklist key-values for presets with neither area nor line geometry', function() {
expect(presets.areaKeys().natural).not.to.include.keys('peak');
});
- it("does not blacklist generic '*' key-values", function() {
+ it('does not blacklist generic \'*\' key-values', function() {
expect(presets.areaKeys().natural).not.to.include.keys('natural');
});
- it("ignores keys like 'highway' that are assumed to be lines", function() {
+ it('ignores keys like \'highway\' that are assumed to be lines', function() {
expect(presets.areaKeys()).not.to.include.keys('highway');
});
- it("ignores suggestion presets", function() {
+ it('ignores suggestion presets', function() {
expect(presets.areaKeys()).not.to.include.keys('amenity');
});
});
- describe("expected matches", function() {
+ describe('expected matches', function() {
var presets;
before(function() {
presets = iD.presets.presets().load(iD.data.presets);
});
- it("prefers building to multipolygon", function() {
+ it('prefers building to multipolygon', function() {
var relation = iD.Relation({tags: {type: 'multipolygon', building: 'yes'}}),
graph = iD.Graph([relation]);
expect(presets.match(relation, graph).id).to.eql('building');
});
- it("prefers building to address", function() {
+ it('prefers building to address', function() {
var way = iD.Way({tags: {area: 'yes', building: 'yes', 'addr:housenumber': '1234'}}),
graph = iD.Graph([way]);
expect(presets.match(way, graph).id).to.eql('building');
});
- it("prefers pedestrian to area", function() {
+ it('prefers pedestrian to area', function() {
var way = iD.Way({tags: {area: 'yes', highway: 'pedestrian'}}),
graph = iD.Graph([way]);
expect(presets.match(way, graph).id).to.eql('highway/pedestrian');
diff --git a/test/spec/presets/category.js b/test/spec/presets/category.js
index 94dd034f7..1cd7db4a9 100644
--- a/test/spec/presets/category.js
+++ b/test/spec/presets/category.js
@@ -1,13 +1,13 @@
-describe("iD.presets.Category", function() {
+describe('iD.presets.Category', function() {
var category, residential;
beforeEach(function() {
category = {
- "geometry": "line",
- "icon": "highway",
- "name": "roads",
- "members": [
- "highway/residential"
+ 'geometry': 'line',
+ 'icon': 'highway',
+ 'name': 'roads',
+ 'members': [
+ 'highway/residential'
]
};
residential = iD.presets.Preset('highway/residential', {
@@ -18,13 +18,13 @@ describe("iD.presets.Category", function() {
});
});
- it("maps members names to preset instances", function() {
+ it('maps members names to preset instances', function() {
var c = iD.presets.Category('road', category, iD.presets.Collection([residential]));
expect(c.members.collection[0]).to.eql(residential);
});
- describe("#matchGeometry", function() {
- it("matches the type of an entity", function() {
+ describe('#matchGeometry', function() {
+ it('matches the type of an entity', function() {
var c = iD.presets.Category('road', category, iD.presets.Collection([residential])),
w = iD.Way(),
n = iD.Node(),
diff --git a/test/spec/presets/collection.js b/test/spec/presets/collection.js
index 3307efc6c..815c10d39 100644
--- a/test/spec/presets/collection.js
+++ b/test/spec/presets/collection.js
@@ -1,4 +1,4 @@
-describe("iD.presets.Collection", function() {
+describe('iD.presets.Collection', function() {
var p = {
point: iD.presets.Preset('point', {
@@ -28,40 +28,40 @@ describe("iD.presets.Collection", function() {
w = iD.Way({ tags: { highway: 'residential' }}),
g = iD.Graph().replace(w);
- describe("#item", function() {
- it("fetches a preset by id", function() {
+ describe('#item', function() {
+ it('fetches a preset by id', function() {
expect(c.item('highway/residential')).to.equal(p.residential);
});
});
- describe("#matchGeometry", function() {
- it("returns a new collection only containing presets matching a geometry", function() {
+ describe('#matchGeometry', function() {
+ it('returns a new collection only containing presets matching a geometry', function() {
expect(c.matchGeometry('area').collection).to.eql([p.area, p.park]);
});
});
- describe("#search", function() {
- it("filters presets by name", function() {
- expect(c.search("resid", "line").collection.indexOf(p.residential) >= 0).to.eql(true);
+ describe('#search', function() {
+ it('filters presets by name', function() {
+ expect(c.search('resid', 'line').collection.indexOf(p.residential) >= 0).to.eql(true);
});
- it("is fuzzy", function() {
- expect(c.search("rusid", "line").collection.indexOf(p.residential) >= 0).to.eql(true);
+ it('is fuzzy', function() {
+ expect(c.search('rusid', 'line').collection.indexOf(p.residential) >= 0).to.eql(true);
});
- it("includes the appropriate fallback preset", function() {
- expect(c.search("blade of grass", "point").collection.indexOf(p.point) >= 0).to.eql(true);
- expect(c.search("blade of grass", "area").collection.indexOf(p.area) >= 0).to.eql(true);
+ it('includes the appropriate fallback preset', function() {
+ expect(c.search('blade of grass', 'point').collection.indexOf(p.point) >= 0).to.eql(true);
+ expect(c.search('blade of grass', 'area').collection.indexOf(p.area) >= 0).to.eql(true);
});
- it("excludes presets with searchable: false", function() {
+ it('excludes presets with searchable: false', function() {
var excluded = iD.presets.Preset('excluded', {
tags: {},
geometry: [],
searchable: false
}),
collection = iD.presets.Collection([excluded, p.point]);
- expect(collection.search("excluded", "point").collection).not.to.include(excluded);
+ expect(collection.search('excluded', 'point').collection).not.to.include(excluded);
});
});
});
diff --git a/test/spec/presets/preset.js b/test/spec/presets/preset.js
index f42d44f8f..99fb7f77f 100644
--- a/test/spec/presets/preset.js
+++ b/test/spec/presets/preset.js
@@ -1,116 +1,117 @@
+/* globals context: true */
describe('iD.presets.Preset', function() {
- it("has optional fields", function() {
+ it('has optional fields', function() {
var preset = iD.presets.Preset('test', {});
expect(preset.fields).to.eql([]);
});
describe('#matchGeometry', function() {
- it("returns false if it doesn't match", function() {
+ it('returns false if it doesn\'t match', function() {
var preset = iD.presets.Preset('test', {geometry: ['line']});
expect(preset.matchGeometry('point')).to.equal(false);
});
- it("returns true if it does match", function() {
+ it('returns true if it does match', function() {
var preset = iD.presets.Preset('test', {geometry: ['point', 'line']});
expect(preset.matchGeometry('point')).to.equal(true);
});
});
describe('#matchScore', function() {
- it("returns -1 if preset does not match tags", function() {
+ it('returns -1 if preset does not match tags', function() {
var preset = iD.presets.Preset('test', {tags: {foo: 'bar'}}),
entity = iD.Way({tags: {highway: 'motorway'}});
expect(preset.matchScore(entity)).to.equal(-1);
});
- it("returns the value of the matchScore property when matched", function() {
+ it('returns the value of the matchScore property when matched', function() {
var preset = iD.presets.Preset('test', {tags: {highway: 'motorway'}, matchScore: 0.2}),
entity = iD.Way({tags: {highway: 'motorway'}});
expect(preset.matchScore(entity)).to.equal(0.2);
});
- it("defaults to the number of matched tags", function() {
+ it('defaults to the number of matched tags', function() {
var preset = iD.presets.Preset('test', {tags: {highway: 'residential'}}),
entity = iD.Way({tags: {highway: 'residential'}});
expect(preset.matchScore(entity)).to.equal(1);
- var preset = iD.presets.Preset('test', {tags: {highway: 'service', service: 'alley'}}),
- entity = iD.Way({tags: {highway: 'service', service: 'alley'}});
+ preset = iD.presets.Preset('test', {tags: {highway: 'service', service: 'alley'}});
+ entity = iD.Way({tags: {highway: 'service', service: 'alley'}});
expect(preset.matchScore(entity)).to.equal(2);
});
- it("counts * as a match for any value with score 0.5", function() {
+ it('counts * as a match for any value with score 0.5', function() {
var preset = iD.presets.Preset('test', {tags: {building: '*'}}),
entity = iD.Way({tags: {building: 'yep'}});
expect(preset.matchScore(entity)).to.equal(0.5);
});
});
- describe("isFallback", function() {
- it("returns true if preset has no tags", function() {
- var preset = iD.presets.Preset("point", {tags: {}});
+ describe('isFallback', function() {
+ it('returns true if preset has no tags', function() {
+ var preset = iD.presets.Preset('point', {tags: {}});
expect(preset.isFallback()).to.equal(true);
});
- it("returns true if preset has a single 'area' tag", function() {
- var preset = iD.presets.Preset("area", {tags: {area: 'yes'}});
+ it('returns true if preset has a single \'area\' tag', function() {
+ var preset = iD.presets.Preset('area', {tags: {area: 'yes'}});
expect(preset.isFallback()).to.equal(true);
});
- it("returns false if preset has a single non-'area' tag", function() {
- var preset = iD.presets.Preset("building", {tags: {building: 'yes'}});
+ it('returns false if preset has a single non-\'area\' tag', function() {
+ var preset = iD.presets.Preset('building', {tags: {building: 'yes'}});
expect(preset.isFallback()).to.equal(false);
});
- it("returns false if preset has multiple tags", function() {
- var preset = iD.presets.Preset("building", {tags: {area: 'yes', building: 'yes'}});
+ it('returns false if preset has multiple tags', function() {
+ var preset = iD.presets.Preset('building', {tags: {area: 'yes', building: 'yes'}});
expect(preset.isFallback()).to.equal(false);
});
});
describe('#applyTags', function() {
- it("adds match tags", function() {
+ it('adds match tags', function() {
var preset = iD.presets.Preset('test', {tags: {highway: 'residential'}});
expect(preset.applyTags({}, 'line')).to.eql({highway: 'residential'});
});
- it("adds wildcard tags with value 'yes'", function() {
+ it('adds wildcard tags with value \'yes\'', function() {
var preset = iD.presets.Preset('test', {tags: {building: '*'}});
expect(preset.applyTags({}, 'area')).to.eql({building: 'yes'});
});
- it("prefers to add tags of addTags property", function() {
+ it('prefers to add tags of addTags property', function() {
var preset = iD.presets.Preset('test', {tags: {building: '*'}, addTags: {building: 'ok'}});
expect(preset.applyTags({}, 'area')).to.eql({building: 'ok'});
});
- it("adds default tags of fields with matching geometry", function() {
+ it('adds default tags of fields with matching geometry', function() {
var field = iD.presets.Field('field', {key: 'building', geometry: 'area', default: 'yes'}),
preset = iD.presets.Preset('test', {fields: ['field']}, {field: field});
expect(preset.applyTags({}, 'area')).to.eql({area: 'yes', building: 'yes'});
});
- it("adds no default tags of fields with non-matching geometry", function() {
+ it('adds no default tags of fields with non-matching geometry', function() {
var field = iD.presets.Field('field', {key: 'building', geometry: 'area', default: 'yes'}),
preset = iD.presets.Preset('test', {fields: ['field']}, {field: field});
expect(preset.applyTags({}, 'point')).to.eql({});
});
- context("for a preset with no tag in areaKeys", function() {
+ context('for a preset with no tag in areaKeys', function() {
var preset = iD.presets.Preset('test', {geometry: ['line', 'area'], tags: {name: 'testname', highway: 'pedestrian'}});
- it("doesn't add area=yes to non-areas", function() {
+ it('doesn\'t add area=yes to non-areas', function() {
expect(preset.applyTags({}, 'line')).to.eql({name: 'testname', highway: 'pedestrian'});
});
- it("adds area=yes to areas", function() {
+ it('adds area=yes to areas', function() {
expect(preset.applyTags({}, 'area')).to.eql({name: 'testname', highway: 'pedestrian', area: 'yes'});
});
});
- context("for a preset with a tag in areaKeys", function() {
+ context('for a preset with a tag in areaKeys', function() {
var preset = iD.presets.Preset('test', {geometry: ['area'], tags: {name: 'testname', natural: 'water'}});
- it("doesn't add area=yes", function() {
+ it('doesn\'t add area=yes', function() {
expect(preset.applyTags({}, 'area')).to.eql({name: 'testname', natural: 'water'});
});
});
diff --git a/test/spec/renderer/features.js b/test/spec/renderer/features.js
index 6bdc714e9..df16f52f2 100644
--- a/test/spec/renderer/features.js
+++ b/test/spec/renderer/features.js
@@ -83,7 +83,7 @@ describe('iD.Features', function() {
});
});
- describe("matching", function() {
+ describe('matching', function() {
var graph = iD.Graph([
// Points
iD.Node({id: 'point_bar', tags: {amenity: 'bar'}, version: 1}),
@@ -191,7 +191,7 @@ describe('iD.Features', function() {
{id: 'building_yes'}
],
version: 1
- }),
+ })
]),
all = _.values(graph.base().entities);
@@ -214,7 +214,7 @@ describe('iD.Features', function() {
}
- it("matches points", function () {
+ it('matches points', function () {
features.disable('points');
features.gatherStats(all, graph, dimensions);
@@ -231,7 +231,7 @@ describe('iD.Features', function() {
});
- it("matches traffic roads", function () {
+ it('matches traffic roads', function () {
features.disable('traffic_roads');
features.gatherStats(all, graph, dimensions);
@@ -250,7 +250,7 @@ describe('iD.Features', function() {
});
- it("matches service roads", function () {
+ it('matches service roads', function () {
features.disable('service_roads');
features.gatherStats(all, graph, dimensions);
@@ -266,7 +266,7 @@ describe('iD.Features', function() {
});
- it("matches paths", function () {
+ it('matches paths', function () {
features.disable('paths');
features.gatherStats(all, graph, dimensions);
@@ -283,7 +283,7 @@ describe('iD.Features', function() {
});
- it("matches buildings", function () {
+ it('matches buildings', function () {
features.disable('buildings');
features.gatherStats(all, graph, dimensions);
@@ -300,7 +300,7 @@ describe('iD.Features', function() {
});
- it("matches landuse", function () {
+ it('matches landuse', function () {
features.disable('landuse');
features.gatherStats(all, graph, dimensions);
@@ -319,7 +319,7 @@ describe('iD.Features', function() {
});
- it("matches boundaries", function () {
+ it('matches boundaries', function () {
features.disable('boundaries');
features.gatherStats(all, graph, dimensions);
@@ -335,7 +335,7 @@ describe('iD.Features', function() {
});
- it("matches water", function () {
+ it('matches water', function () {
features.disable('water');
features.gatherStats(all, graph, dimensions);
@@ -352,7 +352,7 @@ describe('iD.Features', function() {
});
- it("matches rail", function () {
+ it('matches rail', function () {
features.disable('rail');
features.gatherStats(all, graph, dimensions);
@@ -370,7 +370,7 @@ describe('iD.Features', function() {
});
- it("matches power", function () {
+ it('matches power', function () {
features.disable('power');
features.gatherStats(all, graph, dimensions);
@@ -386,7 +386,7 @@ describe('iD.Features', function() {
});
- it("matches past/future", function () {
+ it('matches past/future', function () {
features.disable('past_future');
features.gatherStats(all, graph, dimensions);
@@ -403,7 +403,7 @@ describe('iD.Features', function() {
});
- it("matches others", function () {
+ it('matches others', function () {
features.disable('others');
features.gatherStats(all, graph, dimensions);
diff --git a/test/spec/renderer/map.js b/test/spec/renderer/map.js
index f5576c6a7..9e57f24fe 100644
--- a/test/spec/renderer/map.js
+++ b/test/spec/renderer/map.js
@@ -129,9 +129,9 @@ describe('iD.Map', function() {
});
});
- describe("surface", function() {
- it("is an SVG element", function() {
- expect(map.surface.node().tagName).to.equal("svg");
+ describe('surface', function() {
+ it('is an SVG element', function() {
+ expect(map.surface.node().tagName).to.equal('svg');
});
});
diff --git a/test/spec/services/mapillary.js b/test/spec/services/mapillary.js
index 7294b26ee..087075a70 100644
--- a/test/spec/services/mapillary.js
+++ b/test/spec/services/mapillary.js
@@ -23,7 +23,7 @@ describe('iD.services.mapillary', function() {
expect(cache).to.have.property('images');
expect(cache).to.have.property('signs');
- var mapillary2 = iD.services.mapillary();
+ iD.services.mapillary();
var cache2 = iD.services.mapillary.cache;
expect(cache).to.equal(cache2);
});
@@ -98,7 +98,7 @@ describe('iD.services.mapillary', function() {
var match0 = /page=0/,
response0 = { type: 'FeatureCollection', features: features0 },
match1 = /page=1/,
- response1 = { type: 'FeatureCollection', features: features1 }
+ response1 = { type: 'FeatureCollection', features: features1 };
server.respondWith('GET', match0,
[200, { 'Content-Type': 'application/json' }, JSON.stringify(response0) ]);
@@ -231,7 +231,7 @@ describe('iD.services.mapillary', function() {
var match0 = /page=0/,
response0 = { type: 'FeatureCollection', features: features0 },
match1 = /page=1/,
- response1 = { type: 'FeatureCollection', features: features1 }
+ response1 = { type: 'FeatureCollection', features: features1 };
server.respondWith('GET', match0,
[200, { 'Content-Type': 'application/json' }, JSON.stringify(response0) ]);
@@ -356,7 +356,7 @@ describe('iD.services.mapillary', function() {
}]
};
- expect(mapillary.signHTML(signdata)).to.eql('65')
+ expect(mapillary.signHTML(signdata)).to.eql('65');
});
});
diff --git a/test/spec/services/nominatim.js b/test/spec/services/nominatim.js
index e77dbd725..af9dcd835 100644
--- a/test/spec/services/nominatim.js
+++ b/test/spec/services/nominatim.js
@@ -1,4 +1,4 @@
-describe("iD.services.nominatim", function() {
+describe('iD.services.nominatim', function() {
var server, nominatim;
beforeEach(function() {
@@ -15,84 +15,84 @@ describe("iD.services.nominatim", function() {
return iD.util.stringQs(url.substring(url.indexOf('?') + 1));
}
- describe("#countryCode", function() {
- it("calls the given callback with the results of the country code query", function() {
+ describe('#countryCode', function() {
+ it('calls the given callback with the results of the country code query', function() {
var callback = sinon.spy();
nominatim.countryCode([16, 48], callback);
- server.respondWith("GET", "https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=48&lon=16",
- [200, { "Content-Type": "application/json" },
+ server.respondWith('GET', 'https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=48&lon=16',
+ [200, { 'Content-Type': 'application/json' },
'{"address":{"country_code":"at"}}']);
server.respond();
expect(query(server.requests[0].url)).to.eql(
- {format: "json", addressdetails: "1", lat: "48", lon: "16"});
- expect(callback).to.have.been.calledWith(null, "at");
+ {format: 'json', addressdetails: '1', lat: '48', lon: '16'});
+ expect(callback).to.have.been.calledWith(null, 'at');
});
- it("should not cache the first country code result", function() {
+ it('should not cache the first country code result', function() {
var callback = sinon.spy();
nominatim.countryCode([16, 48], callback);
- server.respondWith("GET", "https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=48&lon=16",
- [200, { "Content-Type": "application/json" },
+ server.respondWith('GET', 'https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=48&lon=16',
+ [200, { 'Content-Type': 'application/json' },
'{"address":{"country_code":"at"}}']);
server.respond();
expect(query(server.requests[0].url)).to.eql(
- {format: "json", addressdetails: "1", lat: "48", lon: "16"});
- expect(callback).to.have.been.calledWith(null, "at");
+ {format: 'json', addressdetails: '1', lat: '48', lon: '16'});
+ expect(callback).to.have.been.calledWith(null, 'at');
server.restore();
server = sinon.fakeServer.create();
nominatim.countryCode([17, 49], callback);
- server.respondWith("GET", "https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=49&lon=17",
- [200, { "Content-Type": "application/json" },
+ server.respondWith('GET', 'https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=49&lon=17',
+ [200, { 'Content-Type': 'application/json' },
'{"address":{"country_code":"cz"}}']);
server.respond();
expect(query(server.requests[0].url)).to.eql(
- {format: "json", addressdetails: "1", lat: "49", lon: "17"});
- expect(callback).to.have.been.calledWith(null, "cz");
+ {format: 'json', addressdetails: '1', lat: '49', lon: '17'});
+ expect(callback).to.have.been.calledWith(null, 'cz');
});
- it("should cache the first country code result", function() {
+ it('should cache the first country code result', function() {
var callback = sinon.spy();
nominatim.countryCode([16, 48], callback);
- server.respondWith("GET", "https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=48&lon=16",
- [200, { "Content-Type": "application/json" },
+ server.respondWith('GET', 'https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=48&lon=16',
+ [200, { 'Content-Type': 'application/json' },
'{"address":{"country_code":"at"}}']);
server.respond();
expect(query(server.requests[0].url)).to.eql(
- {format: "json", addressdetails: "1", lat: "48", lon: "16"});
- expect(callback).to.have.been.calledWith(null, "at");
+ {format: 'json', addressdetails: '1', lat: '48', lon: '16'});
+ expect(callback).to.have.been.calledWith(null, 'at');
server.restore();
server = sinon.fakeServer.create();
nominatim.countryCode([16.01, 48.01], callback);
- server.respondWith("GET", "https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=48.01&lon=16.01",
- [200, { "Content-Type": "application/json" },
+ server.respondWith('GET', 'https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=48.01&lon=16.01',
+ [200, { 'Content-Type': 'application/json' },
'{"address":{"country_code":"cz"}}']);
server.respond();
- expect(callback).to.have.been.calledWith(null, "at");
+ expect(callback).to.have.been.calledWith(null, 'at');
});
- it("calls the given callback with an error", function() {
+ it('calls the given callback with an error', function() {
var callback = sinon.spy();
nominatim.countryCode([1000, 1000], callback);
- server.respondWith("GET", "https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=1000&lon=1000",
- [200, { "Content-Type": "application/json" },
+ server.respondWith('GET', 'https://nominatim.openstreetmap.org/reverse?addressdetails=1&format=json&lat=1000&lon=1000',
+ [200, { 'Content-Type': 'application/json' },
'{"error":"Unable to geocode"}']);
server.respond();
expect(query(server.requests[0].url)).to.eql(
- {format: "json", addressdetails: "1", lat: "1000", lon: "1000"});
- expect(callback).to.have.been.calledWith("Unable to geocode");
+ {format: 'json', addressdetails: '1', lat: '1000', lon: '1000'});
+ expect(callback).to.have.been.calledWith('Unable to geocode');
});
});
});
diff --git a/test/spec/services/taginfo.js b/test/spec/services/taginfo.js
index bc65db96e..e28bf76a2 100644
--- a/test/spec/services/taginfo.js
+++ b/test/spec/services/taginfo.js
@@ -1,4 +1,4 @@
-describe("iD.services.taginfo", function() {
+describe('iD.services.taginfo', function() {
var server, taginfo;
beforeEach(function() {
@@ -14,181 +14,180 @@ describe("iD.services.taginfo", function() {
return iD.util.stringQs(url.substring(url.indexOf('?') + 1));
}
- describe("#keys", function() {
- it("calls the given callback with the results of the keys query", function() {
+ describe('#keys', function() {
+ it('calls the given callback with the results of the keys query', function() {
var callback = sinon.spy();
- taginfo.keys({query: "amen"}, callback);
+ taginfo.keys({query: 'amen'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/keys/all"),
- [200, { "Content-Type": "application/json" },
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/keys/all'),
+ [200, { 'Content-Type': 'application/json' },
'{"data":[{"count_all":5190337,"key":"amenity","count_all_fraction":1.0}]}']);
server.respond();
expect(query(server.requests[0].url)).to.eql(
- {query: "amen", page: "1", rp: "10", sortname: "count_all", sortorder: "desc"});
- expect(callback).to.have.been.calledWith(null, [{"title":"amenity", "value":"amenity"}]);
+ {query: 'amen', page: '1', rp: '10', sortname: 'count_all', sortorder: 'desc'});
+ expect(callback).to.have.been.calledWith(null, [{'title':'amenity', 'value':'amenity'}]);
});
- it("includes popular keys", function() {
+ it('includes popular keys', function() {
var callback = sinon.spy();
- taginfo.keys({query: "amen"}, callback);
+ taginfo.keys({query: 'amen'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/keys/all"),
- [200, { "Content-Type": "application/json" },
- '{"data":[{"count_all":5190337,"key":"amenity","count_all_fraction":1.0, "count_nodes_fraction":1.0},\
- {"count_all":1,"key":"amenityother","count_all_fraction":0.0, "count_nodes_fraction":0.0}]}']);
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/keys/all'),
+ [200, { 'Content-Type': 'application/json' },
+ '{"data":[{"count_all":5190337,"key":"amenity","count_all_fraction":1.0, "count_nodes_fraction":1.0},'
+ + '{"count_all":1,"key":"amenityother","count_all_fraction":0.0, "count_nodes_fraction":0.0}]}']);
server.respond();
- expect(callback).to.have.been.calledWith(null, [{"title":"amenity", "value":"amenity"}]);
+ expect(callback).to.have.been.calledWith(null, [{'title':'amenity', 'value':'amenity'}]);
});
- it("includes popular keys with an entity type filter", function() {
+ it('includes popular keys with an entity type filter', function() {
var callback = sinon.spy();
- taginfo.keys({query: "amen", filter: "nodes"}, callback);
+ taginfo.keys({query: 'amen', filter: 'nodes'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/keys/all"),
- [200, { "Content-Type": "application/json" },
- '{"data":[{"count_all":5190337,"count_nodes":500000,"key":"amenity","count_all_fraction":1.0, "count_nodes_fraction":1.0},\
- {"count_all":1,"key":"amenityother","count_all_fraction":0.0, "count_nodes":100}]}']);
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/keys/all'),
+ [200, { 'Content-Type': 'application/json' },
+ '{"data":[{"count_all":5190337,"count_nodes":500000,"key":"amenity","count_all_fraction":1.0, "count_nodes_fraction":1.0},'
+ + '{"count_all":1,"key":"amenityother","count_all_fraction":0.0, "count_nodes":100}]}']);
server.respond();
- expect(callback).to.have.been.calledWith(null, [{"title":"amenity", "value":"amenity"}]);
+ expect(callback).to.have.been.calledWith(null, [{'title':'amenity', 'value':'amenity'}]);
});
- it("includes unpopular keys with a wiki page", function() {
+ it('includes unpopular keys with a wiki page', function() {
var callback = sinon.spy();
- taginfo.keys({query: "amen"}, callback);
+ taginfo.keys({query: 'amen'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/keys/all"),
- [200, { "Content-Type": "application/json" },
- '{"data":[{"count_all":5190337,"key":"amenity","count_all_fraction":1.0, "count_nodes_fraction":1.0},\
- {"count_all":1,"key":"amenityother","count_all_fraction":0.0, "count_nodes_fraction":0.0, "in_wiki": true}]}']);
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/keys/all'),
+ [200, { 'Content-Type': 'application/json' },
+ '{"data":[{"count_all":5190337,"key":"amenity","count_all_fraction":1.0, "count_nodes_fraction":1.0},'
+ + '{"count_all":1,"key":"amenityother","count_all_fraction":0.0, "count_nodes_fraction":0.0, "in_wiki": true}]}']);
server.respond();
expect(callback).to.have.been.calledWith(null, [
- {"title":"amenity", "value":"amenity"},
- {"title":"amenityother", "value":"amenityother"}
+ {'title':'amenity', 'value':'amenity'},
+ {'title':'amenityother', 'value':'amenityother'}
]);
});
- it("sorts keys with ':' below keys without ':'", function() {
+ it('sorts keys with \':\' below keys without \':\'', function() {
var callback = sinon.spy();
- taginfo.keys({query: "ref"}, callback);
+ taginfo.keys({query: 'ref'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/keys/all"),
- [200, { "Content-Type": "application/json" },
- '{"data":[{"key":"ref:bag","count_all":9790586,"count_all_fraction":0.0028},\
- {"key":"ref","count_all":7933528,"count_all_fraction":0.0023}]}']);
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/keys/all'),
+ [200, { 'Content-Type': 'application/json' },
+ '{"data":[{"key":"ref:bag","count_all":9790586,"count_all_fraction":0.0028},{"key":"ref","count_all":7933528,"count_all_fraction":0.0023}]}']);
server.respond();
- expect(callback).to.have.been.calledWith(null, [{"title":"ref", "value":"ref"},{"title":"ref:bag", "value":"ref:bag"}]);
+ expect(callback).to.have.been.calledWith(null, [{'title':'ref', 'value':'ref'},{'title':'ref:bag', 'value':'ref:bag'}]);
});
});
- describe("#multikeys", function() {
- it("calls the given callback with the results of the multikeys query", function() {
+ describe('#multikeys', function() {
+ it('calls the given callback with the results of the multikeys query', function() {
var callback = sinon.spy();
- taginfo.multikeys({query: "recycling:"}, callback);
+ taginfo.multikeys({query: 'recycling:'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/keys/all"),
- [200, { "Content-Type": "application/json" },
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/keys/all'),
+ [200, { 'Content-Type': 'application/json' },
'{"data":[{"count_all":69593,"key":"recycling:glass","count_all_fraction":0.0}]}']);
server.respond();
expect(query(server.requests[0].url)).to.eql(
- {query: "recycling:", page: "1", rp: "25", sortname: "count_all", sortorder: "desc"});
- expect(callback).to.have.been.calledWith(null, [{"title":"recycling:glass", "value":"recycling:glass"}]);
+ {query: 'recycling:', page: '1', rp: '25', sortname: 'count_all', sortorder: 'desc'});
+ expect(callback).to.have.been.calledWith(null, [{'title':'recycling:glass', 'value':'recycling:glass'}]);
});
- it("excludes multikeys with extra colons", function() {
+ it('excludes multikeys with extra colons', function() {
var callback = sinon.spy();
- taginfo.multikeys({query: "recycling:"}, callback);
+ taginfo.multikeys({query: 'recycling:'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/keys/all"),
- [200, { "Content-Type": "application/json" },
- '{"data":[{"count_all":69593,"key":"recycling:glass","count_all_fraction":0.0},\
- {"count_all":22,"key":"recycling:glass:color","count_all_fraction":0.0}]}']);
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/keys/all'),
+ [200, { 'Content-Type': 'application/json' },
+ '{"data":[{"count_all":69593,"key":"recycling:glass","count_all_fraction":0.0},'
+ + '{"count_all":22,"key":"recycling:glass:color","count_all_fraction":0.0}]}']);
server.respond();
- expect(callback).to.have.been.calledWith(null, [{"title":"recycling:glass", "value":"recycling:glass"}]);
+ expect(callback).to.have.been.calledWith(null, [{'title':'recycling:glass', 'value':'recycling:glass'}]);
});
});
- describe("#values", function() {
- it("calls the given callback with the results of the values query", function() {
+ describe('#values', function() {
+ it('calls the given callback with the results of the values query', function() {
var callback = sinon.spy();
- taginfo.values({key: "amenity", query: "par"}, callback);
+ taginfo.values({key: 'amenity', query: 'par'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/key/values"),
- [200, { "Content-Type": "application/json" },
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/key/values'),
+ [200, { 'Content-Type': 'application/json' },
'{"data":[{"value":"parking","description":"A place for parking cars", "fraction":0.1}]}']);
server.respond();
expect(query(server.requests[0].url)).to.eql(
- {key: "amenity", query: "par", page: "1", rp: "25", sortname: 'count_all', sortorder: 'desc'});
- expect(callback).to.have.been.calledWith(null, [{"value":"parking","title":"A place for parking cars"}]);
+ {key: 'amenity', query: 'par', page: '1', rp: '25', sortname: 'count_all', sortorder: 'desc'});
+ expect(callback).to.have.been.calledWith(null, [{'value':'parking','title':'A place for parking cars'}]);
});
- it("includes popular values", function() {
+ it('includes popular values', function() {
var callback = sinon.spy();
- taginfo.values({key: "amenity", query: "par"}, callback);
+ taginfo.values({key: 'amenity', query: 'par'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/key/values"),
- [200, { "Content-Type": "application/json" },
- '{"data":[{"value":"parking","description":"A place for parking cars", "fraction":1.0},\
- {"value":"party","description":"A place for partying", "fraction":0.0}]}']);
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/key/values'),
+ [200, { 'Content-Type': 'application/json' },
+ '{"data":[{"value":"parking","description":"A place for parking cars", "fraction":1.0},' +
+ '{"value":"party","description":"A place for partying", "fraction":0.0}]}']);
server.respond();
- expect(callback).to.have.been.calledWith(null, [{"value":"parking","title":"A place for parking cars"}]);
+ expect(callback).to.have.been.calledWith(null, [{'value':'parking','title':'A place for parking cars'}]);
});
- it("includes unpopular values with a wiki page", function() {
+ it('includes unpopular values with a wiki page', function() {
var callback = sinon.spy();
- taginfo.values({key: "amenity", query: "par"}, callback);
+ taginfo.values({key: 'amenity', query: 'par'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/key/values"),
- [200, { "Content-Type": "application/json" },
- '{"data":[{"value":"parking","description":"A place for parking cars", "fraction":1.0},\
- {"value":"party","description":"A place for partying", "fraction":0.0, "in_wiki": true}]}']);
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/key/values'),
+ [200, { 'Content-Type': 'application/json' },
+ '{"data":[{"value":"parking","description":"A place for parking cars", "fraction":1.0},'
+ + '{"value":"party","description":"A place for partying", "fraction":0.0, "in_wiki": true}]}']);
server.respond();
expect(callback).to.have.been.calledWith(null, [
- {"value":"parking","title":"A place for parking cars"},
- {"value":"party","title":"A place for partying"}
+ {'value':'parking','title':'A place for parking cars'},
+ {'value':'party','title':'A place for partying'}
]);
});
- it("excludes values with capital letters and some punctuation", function() {
+ it('excludes values with capital letters and some punctuation', function() {
var callback = sinon.spy();
- taginfo.values({key: "amenity", query: "par"}, callback);
+ taginfo.values({key: 'amenity', query: 'par'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/key/values"),
- [200, { "Content-Type": "application/json" },
- '{"data":[{"value":"parking","description":"A place for parking cars", "fraction":0.2},\
- {"value":"PArking","description":"A common mispelling", "fraction":0.2},\
- {"value":"parking;partying","description":"A place for parking cars *and* partying", "fraction":0.2},\
- {"value":"parking, partying","description":"A place for parking cars *and* partying", "fraction":0.2},\
- {"value":"*","description":"", "fraction":0.2}]}']);
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/key/values'),
+ [200, { 'Content-Type': 'application/json' },
+ '{"data":[{"value":"parking","description":"A place for parking cars", "fraction":0.2},'
+ + '{"value":"PArking","description":"A common mispelling", "fraction":0.2},'
+ + '{"value":"parking;partying","description":"A place for parking cars *and* partying", "fraction":0.2},'
+ + '{"value":"parking, partying","description":"A place for parking cars *and* partying", "fraction":0.2},'
+ + '{"value":"*","description":"", "fraction":0.2}]}']);
server.respond();
- expect(callback).to.have.been.calledWith(null, [{"value":"parking","title":"A place for parking cars"}]);
+ expect(callback).to.have.been.calledWith(null, [{'value':'parking','title':'A place for parking cars'}]);
});
});
- describe("#docs", function() {
- it("calls the given callback with the results of the docs query", function() {
+ describe('#docs', function() {
+ it('calls the given callback with the results of the docs query', function() {
var callback = sinon.spy();
- taginfo.docs({key: "amenity", value: "parking"}, callback);
+ taginfo.docs({key: 'amenity', value: 'parking'}, callback);
- server.respondWith("GET", new RegExp("https://taginfo.openstreetmap.org/api/4/tag/wiki_page"),
- [200, { "Content-Type": "application/json" },
+ server.respondWith('GET', new RegExp('https://taginfo.openstreetmap.org/api/4/tag/wiki_page'),
+ [200, { 'Content-Type': 'application/json' },
'{"data":[{"on_way":false,"lang":"en","on_area":true,"image":"File:Car park2.jpg"}]}']);
server.respond();
expect(query(server.requests[0].url)).to.eql(
- {key: "amenity", value: "parking"});
+ {key: 'amenity', value: 'parking'});
expect(callback).to.have.been.calledWith(null,
- [{"on_way":false,"lang":"en","on_area":true,"image":"File:Car park2.jpg"}]);
+ [{'on_way':false,'lang':'en','on_area':true,'image':'File:Car park2.jpg'}]);
});
});
diff --git a/test/spec/spec_helpers.js b/test/spec/spec_helpers.js
index 2c15b7567..dd0b8a8d9 100644
--- a/test/spec/spec_helpers.js
+++ b/test/spec/spec_helpers.js
@@ -1,3 +1,5 @@
+/* globals chai */
+
iD.debug = true;
mocha.setup({
@@ -13,7 +15,7 @@ mocha.setup({
]
});
-var expect = chai.expect;
+expect = chai.expect;
chai.use(function (chai, utils) {
var flag = utils.flag;
diff --git a/test/spec/svg.js b/test/spec/svg.js
index 56fbb2321..57b056434 100644
--- a/test/spec/svg.js
+++ b/test/spec/svg.js
@@ -1,18 +1,18 @@
-describe("iD.svg.RelationMemberTags", function() {
- it("includes tags from parent multipolygon relations", function() {
+describe('iD.svg.RelationMemberTags', function() {
+ it('includes tags from parent multipolygon relations', function() {
var graph = iD.Graph([
iD.Way({id: 'w'}),
- iD.Relation({id: 'r', members: [{id: 'w'}], tags: {type: 'multipolygon'}}),
+ iD.Relation({id: 'r', members: [{id: 'w'}], tags: {type: 'multipolygon'}})
]);
expect(iD.svg.RelationMemberTags(graph)(graph.entity('w')))
.to.eql({type: 'multipolygon'});
});
- it("includes tags from parent boundary relations", function() {
+ it('includes tags from parent boundary relations', function() {
var graph = iD.Graph([
iD.Way({id: 'w'}),
- iD.Relation({id: 'r', members: [{id: 'w'}], tags: {type: 'boundary'}}),
+ iD.Relation({id: 'r', members: [{id: 'w'}], tags: {type: 'boundary'}})
]);
expect(iD.svg.RelationMemberTags(graph)(graph.entity('w')))
diff --git a/test/spec/svg/areas.js b/test/spec/svg/areas.js
index 7a43534a6..ee0a289f0 100644
--- a/test/spec/svg/areas.js
+++ b/test/spec/svg/areas.js
@@ -1,4 +1,4 @@
-describe("iD.svg.Areas", function () {
+describe('iD.svg.Areas', function () {
var surface,
projection = d3.geo.projection(function(x, y) { return [x, y]; })
.clipExtent([[0, 0], [Infinity, Infinity]]),
@@ -10,7 +10,7 @@ describe("iD.svg.Areas", function () {
.call(iD.svg.Layers(projection, iD()));
});
- it("adds way and area classes", function () {
+ it('adds way and area classes', function () {
var graph = iD.Graph([
iD.Node({id: 'a', loc: [0, 0]}),
iD.Node({id: 'b', loc: [1, 0]}),
@@ -25,7 +25,7 @@ describe("iD.svg.Areas", function () {
expect(surface.select('path.area')).to.be.classed('area');
});
- it("adds tag classes", function () {
+ it('adds tag classes', function () {
var graph = iD.Graph([
iD.Node({id: 'a', loc: [0, 0]}),
iD.Node({id: 'b', loc: [1, 0]}),
@@ -40,7 +40,7 @@ describe("iD.svg.Areas", function () {
expect(surface.select('.area')).to.be.classed('tag-building-yes');
});
- it("handles deletion of a way and a member vertex (#1903)", function () {
+ it('handles deletion of a way and a member vertex (#1903)', function () {
var graph = iD.Graph([
iD.Node({id: 'a', loc: [0, 0]}),
iD.Node({id: 'b', loc: [1, 0]}),
@@ -57,7 +57,7 @@ describe("iD.svg.Areas", function () {
expect(surface.select('.area').size()).to.equal(1);
});
- describe("z-indexing", function() {
+ describe('z-indexing', function() {
var graph = iD.Graph([
iD.Node({id: 'a', loc: [-0.0002, 0.0001]}),
iD.Node({id: 'b', loc: [ 0.0002, 0.0001]}),
@@ -71,21 +71,21 @@ describe("iD.svg.Areas", function () {
iD.Way({id: 'l', tags: {landuse: 'park'}, nodes: ['e', 'f', 'g', 'h', 'e']})
]);
- it("stacks smaller areas above larger ones in a single render", function () {
+ it('stacks smaller areas above larger ones in a single render', function () {
surface.call(iD.svg.Areas(projection), graph, [graph.entity('s'), graph.entity('l')], none);
expect(surface.select('.area:nth-child(1)')).to.be.classed('tag-landuse-park');
expect(surface.select('.area:nth-child(2)')).to.be.classed('tag-building-yes');
});
- it("stacks smaller areas above larger ones in a single render (reverse)", function () {
+ it('stacks smaller areas above larger ones in a single render (reverse)', function () {
surface.call(iD.svg.Areas(projection), graph, [graph.entity('l'), graph.entity('s')], none);
expect(surface.select('.area:nth-child(1)')).to.be.classed('tag-landuse-park');
expect(surface.select('.area:nth-child(2)')).to.be.classed('tag-building-yes');
});
- it("stacks smaller areas above larger ones in separate renders", function () {
+ it('stacks smaller areas above larger ones in separate renders', function () {
surface.call(iD.svg.Areas(projection), graph, [graph.entity('s')], none);
surface.call(iD.svg.Areas(projection), graph, [graph.entity('l')], none);
@@ -93,7 +93,7 @@ describe("iD.svg.Areas", function () {
expect(surface.select('.area:nth-child(2)')).to.be.classed('tag-building-yes');
});
- it("stacks smaller areas above larger ones in separate renders (reverse)", function () {
+ it('stacks smaller areas above larger ones in separate renders (reverse)', function () {
surface.call(iD.svg.Areas(projection), graph, [graph.entity('l')], none);
surface.call(iD.svg.Areas(projection), graph, [graph.entity('s')], none);
@@ -102,7 +102,7 @@ describe("iD.svg.Areas", function () {
});
});
- it("renders fills for multipolygon areas", function () {
+ it('renders fills for multipolygon areas', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [2, 2]}),
c = iD.Node({loc: [3, 3]}),
@@ -116,7 +116,7 @@ describe("iD.svg.Areas", function () {
expect(surface.select('.fill')).to.be.classed('relation');
});
- it("renders no strokes for multipolygon areas", function () {
+ it('renders no strokes for multipolygon areas', function () {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [2, 2]}),
c = iD.Node({loc: [3, 3]}),
@@ -130,7 +130,7 @@ describe("iD.svg.Areas", function () {
expect(surface.selectAll('.stroke')[0].length).to.equal(0);
});
- it("renders fill for a multipolygon with tags on the outer way", function() {
+ it('renders fill for a multipolygon with tags on the outer way', function() {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [2, 2]}),
c = iD.Node({loc: [3, 3]}),
@@ -145,7 +145,7 @@ describe("iD.svg.Areas", function () {
expect(surface.select('.relation.fill')).to.be.classed('tag-natural-wood');
});
- it("renders no strokes for a multipolygon with tags on the outer way", function() {
+ it('renders no strokes for a multipolygon with tags on the outer way', function() {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [2, 2]}),
c = iD.Node({loc: [3, 3]}),
diff --git a/test/spec/svg/icon.js b/test/spec/svg/icon.js
index 7a839896a..e084cd10a 100644
--- a/test/spec/svg/icon.js
+++ b/test/spec/svg/icon.js
@@ -1,17 +1,17 @@
-describe("iD.svg.Icon", function () {
+describe('iD.svg.Icon', function () {
var selection;
beforeEach(function () {
selection = d3.select(document.createElement('div'));
});
- it("creates a generic SVG icon", function () {
+ it('creates a generic SVG icon', function () {
selection.call(iD.svg.Icon('#icon-bug'));
expect(selection.select('svg')).to.be.classed('icon');
expect(selection.select('use').attr('xlink:href')).to.eql('#icon-bug');
});
- it("classes the 'svg' and 'use' elements", function () {
+ it('classes the \'svg\' and \'use\' elements', function () {
selection.call(iD.svg.Icon('#icon-bug', 'svg-class', 'use-class'));
expect(selection.select('svg')).to.be.classed('icon svg-class');
expect(selection.select('use')).to.be.classed('use-class');
diff --git a/test/spec/svg/lines.js b/test/spec/svg/lines.js
index ab3942209..75cd97522 100644
--- a/test/spec/svg/lines.js
+++ b/test/spec/svg/lines.js
@@ -1,4 +1,4 @@
-describe("iD.svg.Lines", function () {
+describe('iD.svg.Lines', function () {
var surface,
projection = d3.geo.projection(function(x, y) { return [x, y]; })
.clipExtent([[0, 0], [Infinity, Infinity]]),
@@ -10,7 +10,7 @@ describe("iD.svg.Lines", function () {
.call(iD.svg.Layers(projection, iD()));
});
- it("adds way and line classes", function () {
+ it('adds way and line classes', function () {
var a = iD.Node({loc: [0, 0]}),
b = iD.Node({loc: [1, 1]}),
line = iD.Way({nodes: [a.id, b.id]}),
@@ -22,7 +22,7 @@ describe("iD.svg.Lines", function () {
expect(surface.select('path.line')).to.be.classed('line');
});
- it("adds tag classes", function () {
+ it('adds tag classes', function () {
var a = iD.Node({loc: [0, 0]}),
b = iD.Node({loc: [1, 1]}),
line = iD.Way({nodes: [a.id, b.id], tags: {highway: 'residential'}}),
@@ -34,7 +34,7 @@ describe("iD.svg.Lines", function () {
expect(surface.select('.line')).to.be.classed('tag-highway-residential');
});
- it("adds stroke classes for the tags of the parent relation of multipolygon members", function() {
+ it('adds stroke classes for the tags of the parent relation of multipolygon members', function() {
var a = iD.Node({loc: [0, 0]}),
b = iD.Node({loc: [1, 1]}),
line = iD.Way({nodes: [a.id, b.id]}),
@@ -46,7 +46,7 @@ describe("iD.svg.Lines", function () {
expect(surface.select('.stroke')).to.be.classed('tag-natural-wood');
});
- it("renders stroke for outer way of multipolygon with tags on the outer way", function() {
+ it('renders stroke for outer way of multipolygon with tags on the outer way', function() {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [2, 2]}),
c = iD.Node({loc: [3, 3]}),
@@ -59,7 +59,7 @@ describe("iD.svg.Lines", function () {
expect(surface.select('.stroke')).to.be.classed('tag-natural-wood');
});
- it("adds stroke classes for the tags of the outer way of multipolygon with tags on the outer way", function() {
+ it('adds stroke classes for the tags of the outer way of multipolygon with tags on the outer way', function() {
var a = iD.Node({loc: [1, 1]}),
b = iD.Node({loc: [2, 2]}),
c = iD.Node({loc: [3, 3]}),
@@ -73,7 +73,7 @@ describe("iD.svg.Lines", function () {
expect(surface.select('.stroke')).to.be.classed('tag-natural-wood');
});
- describe("z-indexing", function() {
+ describe('z-indexing', function() {
var graph = iD.Graph([
iD.Node({id: 'a', loc: [0, 0]}),
iD.Node({id: 'b', loc: [1, 1]}),
@@ -83,7 +83,7 @@ describe("iD.svg.Lines", function () {
iD.Way({id: 'hi', tags: {highway: 'residential', bridge: 'yes'}, nodes: ['c', 'd']})
]);
- it("stacks higher lines above lower ones in a single render", function () {
+ it('stacks higher lines above lower ones in a single render', function () {
surface.call(iD.svg.Lines(projection), graph, [graph.entity('lo'), graph.entity('hi')], none);
var selection = surface.selectAll('g.line-stroke > path.line');
@@ -91,7 +91,7 @@ describe("iD.svg.Lines", function () {
expect(selection[0][1].__data__.id).to.eql('hi');
});
- it("stacks higher lines above lower ones in a single render (reverse)", function () {
+ it('stacks higher lines above lower ones in a single render (reverse)', function () {
surface.call(iD.svg.Lines(projection), graph, [graph.entity('hi'), graph.entity('lo')], none);
var selection = surface.selectAll('g.line-stroke > path.line');
@@ -99,7 +99,7 @@ describe("iD.svg.Lines", function () {
expect(selection[0][1].__data__.id).to.eql('hi');
});
- it("stacks higher lines above lower ones in separate renders", function () {
+ it('stacks higher lines above lower ones in separate renders', function () {
surface.call(iD.svg.Lines(projection), graph, [graph.entity('lo')], none);
surface.call(iD.svg.Lines(projection), graph, [graph.entity('hi')], none);
@@ -108,7 +108,7 @@ describe("iD.svg.Lines", function () {
expect(selection[0][1].__data__.id).to.eql('hi');
});
- it("stacks higher lines above lower in separate renders (reverse)", function () {
+ it('stacks higher lines above lower in separate renders (reverse)', function () {
surface.call(iD.svg.Lines(projection), graph, [graph.entity('hi')], none);
surface.call(iD.svg.Lines(projection), graph, [graph.entity('lo')], none);
diff --git a/test/spec/svg/midpoints.js b/test/spec/svg/midpoints.js
index 6889521c2..12d52b67e 100644
--- a/test/spec/svg/midpoints.js
+++ b/test/spec/svg/midpoints.js
@@ -1,4 +1,4 @@
-describe("iD.svg.Midpoints", function () {
+describe('iD.svg.Midpoints', function () {
var surface,
projection = Object,
filter = d3.functor(true),
@@ -10,7 +10,7 @@ describe("iD.svg.Midpoints", function () {
.call(iD.svg.Layers(projection, context));
});
- it("creates midpoint on segment completely within the extent", function () {
+ it('creates midpoint on segment completely within the extent', function () {
var a = iD.Node({loc: [0, 0]}),
b = iD.Node({loc: [50, 0]}),
line = iD.Way({nodes: [a.id, b.id]}),
@@ -24,7 +24,7 @@ describe("iD.svg.Midpoints", function () {
expect(surface.select('.midpoint').datum().loc).to.eql([25, 0]);
});
- it("doesn't create midpoint on segment with pixel length less than 40", function () {
+ it('doesn\'t create midpoint on segment with pixel length less than 40', function () {
var a = iD.Node({loc: [0, 0]}),
b = iD.Node({loc: [39, 0]}),
line = iD.Way({nodes: [a.id, b.id]}),
@@ -37,7 +37,7 @@ describe("iD.svg.Midpoints", function () {
expect(surface.selectAll('.midpoint')[0]).to.have.length(0);
});
- it("doesn't create midpoint on segment completely outside of the extent", function () {
+ it('doesn\'t create midpoint on segment completely outside of the extent', function () {
var a = iD.Node({loc: [-100, 0]}),
b = iD.Node({loc: [-50, 0]}),
line = iD.Way({nodes: [a.id, b.id]}),
@@ -50,7 +50,7 @@ describe("iD.svg.Midpoints", function () {
expect(surface.selectAll('.midpoint')[0]).to.have.length(0);
});
- it("creates midpoint on extent edge for segment partially outside of the extent", function () {
+ it('creates midpoint on extent edge for segment partially outside of the extent', function () {
var a = iD.Node({loc: [50, 0]}),
b = iD.Node({loc: [500, 0]}),
line = iD.Way({nodes: [a.id, b.id]}),
@@ -64,7 +64,7 @@ describe("iD.svg.Midpoints", function () {
expect(surface.select('.midpoint').datum().loc).to.eql([100, 0]);
});
- it("doesn't create midpoint on extent edge for segment with pixel length less than 20", function () {
+ it('doesn\'t create midpoint on extent edge for segment with pixel length less than 20', function () {
var a = iD.Node({loc: [81, 0]}),
b = iD.Node({loc: [500, 0]}),
line = iD.Way({nodes: [a.id, b.id]}),
diff --git a/test/spec/svg/points.js b/test/spec/svg/points.js
index 669a1771b..10ceaccb3 100644
--- a/test/spec/svg/points.js
+++ b/test/spec/svg/points.js
@@ -1,4 +1,4 @@
-describe("iD.svg.Points", function () {
+describe('iD.svg.Points', function () {
var surface,
projection = Object,
context;
@@ -9,8 +9,8 @@ describe("iD.svg.Points", function () {
.call(iD.svg.Layers(projection, context));
});
- it("adds tag classes", function () {
- var point = iD.Node({tags: {amenity: "cafe"}, loc: [0, 0]}),
+ it('adds tag classes', function () {
+ var point = iD.Node({tags: {amenity: 'cafe'}, loc: [0, 0]}),
graph = iD.Graph([point]);
surface.call(iD.svg.Points(projection, context), graph, [point]);
diff --git a/test/spec/svg/tag_classes.js b/test/spec/svg/tag_classes.js
index 24e27d95a..1682b7844 100644
--- a/test/spec/svg/tag_classes.js
+++ b/test/spec/svg/tag_classes.js
@@ -1,4 +1,4 @@
-describe("iD.svg.TagClasses", function () {
+describe('iD.svg.TagClasses', function () {
var selection;
beforeEach(function () {
diff --git a/test/spec/svg/vertices.js b/test/spec/svg/vertices.js
index 3e13daf8b..8899fc6d0 100644
--- a/test/spec/svg/vertices.js
+++ b/test/spec/svg/vertices.js
@@ -1,4 +1,4 @@
-describe("iD.svg.Vertices", function () {
+describe('iD.svg.Vertices', function () {
var surface,
projection = Object,
context;
@@ -9,7 +9,7 @@ describe("iD.svg.Vertices", function () {
.call(iD.svg.Layers(projection, context));
});
- it("adds the .shared class to vertices that are members of two or more ways", function () {
+ it('adds the .shared class to vertices that are members of two or more ways', function () {
var node = iD.Node({loc: [0, 0]}),
way1 = iD.Way({nodes: [node.id], tags: {highway: 'residential'}}),
way2 = iD.Way({nodes: [node.id], tags: {highway: 'residential'}}),
diff --git a/test/spec/ui/confirm.js b/test/spec/ui/confirm.js
index c9dd54f27..c684a715b 100644
--- a/test/spec/ui/confirm.js
+++ b/test/spec/ui/confirm.js
@@ -1,5 +1,5 @@
-describe("iD.ui.confirm", function () {
-
+describe('iD.ui.confirm', function () {
+
var elem;
beforeEach(function() { elem = d3.select('body').append('div'); });
afterEach(function() { elem.remove(); });
diff --git a/test/spec/ui/flash.js b/test/spec/ui/flash.js
index 527e8f18b..8cb47be8e 100644
--- a/test/spec/ui/flash.js
+++ b/test/spec/ui/flash.js
@@ -1,4 +1,4 @@
-describe("iD.ui.flash", function () {
+describe('iD.ui.flash', function () {
var clock;
var elem;
diff --git a/test/spec/ui/inspector.js b/test/spec/ui/inspector.js
index a437209ba..36ebe966b 100644
--- a/test/spec/ui/inspector.js
+++ b/test/spec/ui/inspector.js
@@ -1,2 +1,2 @@
-describe("iD.ui.Inspector", function () {
+describe('iD.ui.Inspector', function () {
});
diff --git a/test/spec/ui/modal.js b/test/spec/ui/modal.js
index b91a05f99..da544ea19 100644
--- a/test/spec/ui/modal.js
+++ b/test/spec/ui/modal.js
@@ -1,4 +1,4 @@
-describe("iD.ui.modal", function () {
+describe('iD.ui.modal', function () {
var elem;
beforeEach(function() {
diff --git a/test/spec/ui/preset/localized.js b/test/spec/ui/preset/localized.js
index fb412548f..a2e027938 100644
--- a/test/spec/ui/preset/localized.js
+++ b/test/spec/ui/preset/localized.js
@@ -6,7 +6,7 @@ describe('iD.ui.preset.localized', function() {
field = iD.presets.Field('test', {key: 'name'});
});
- it("adds a blank set of fields when the + button is clicked", function() {
+ it('adds a blank set of fields when the + button is clicked', function() {
var localized = iD.ui.preset.localized(field, {});
selection.call(localized);
happen.click(selection.selectAll('.localized-add').node());
@@ -14,7 +14,7 @@ describe('iD.ui.preset.localized', function() {
expect(selection.selectAll('.localized-value').size()).to.equal(1);
});
- it("doesn't create a tag when the value is empty", function() {
+ it('doesn\'t create a tag when the value is empty', function() {
var localized = iD.ui.preset.localized(field, {});
selection.call(localized);
happen.click(selection.selectAll('.localized-add').node());
@@ -28,7 +28,7 @@ describe('iD.ui.preset.localized', function() {
happen.once(selection.selectAll('.localized-lang').node(), {type: 'blur'});
});
- it("doesn't create a tag when the name is empty", function() {
+ it('doesn\'t create a tag when the name is empty', function() {
var localized = iD.ui.preset.localized(field, {});
selection.call(localized);
happen.click(selection.selectAll('.localized-add').node());
@@ -42,7 +42,7 @@ describe('iD.ui.preset.localized', function() {
happen.once(selection.selectAll('.localized-value').node(), {type: 'blur'});
});
- it("creates a tag after setting language then value", function() {
+ it('creates a tag after setting language then value', function() {
var localized = iD.ui.preset.localized(field, {});
selection.call(localized);
happen.click(selection.selectAll('.localized-add').node());
@@ -58,7 +58,7 @@ describe('iD.ui.preset.localized', function() {
happen.once(selection.selectAll('.localized-value').node(), {type: 'change'});
});
- it("creates a tag after setting value then language", function() {
+ it('creates a tag after setting value then language', function() {
var localized = iD.ui.preset.localized(field, {});
selection.call(localized);
happen.click(selection.selectAll('.localized-add').node());
@@ -74,7 +74,7 @@ describe('iD.ui.preset.localized', function() {
happen.once(selection.selectAll('.localized-lang').node(), {type: 'change'});
});
- it("changes an existing language", function() {
+ it('changes an existing language', function() {
var localized = iD.ui.preset.localized(field, {});
selection.call(localized);
localized.tags({'name:de': 'Value'});
@@ -89,7 +89,7 @@ describe('iD.ui.preset.localized', function() {
happen.once(selection.selectAll('.localized-lang').node(), {type: 'change'});
});
- it("ignores similar keys like `old_name`", function() {
+ it('ignores similar keys like `old_name`', function() {
var localized = iD.ui.preset.localized(field, {});
selection.call(localized);
localized.tags({'old_name:de': 'Value'});
@@ -98,7 +98,7 @@ describe('iD.ui.preset.localized', function() {
expect(selection.selectAll('.localized-value').empty()).to.be.ok;
});
- it("removes the tag when the language is emptied", function() {
+ it('removes the tag when the language is emptied', function() {
var localized = iD.ui.preset.localized(field, {});
selection.call(localized);
localized.tags({'name:de': 'Value'});
@@ -111,7 +111,7 @@ describe('iD.ui.preset.localized', function() {
happen.once(selection.selectAll('.localized-lang').node(), {type: 'change'});
});
- it("removes the tag when the value is emptied", function() {
+ it('removes the tag when the value is emptied', function() {
var localized = iD.ui.preset.localized(field, {});
selection.call(localized);
localized.tags({'name:de': 'Value'});
diff --git a/test/spec/ui/preset/wikipedia.js b/test/spec/ui/preset/wikipedia.js
index b0d5764c6..96b11a4a9 100644
--- a/test/spec/ui/preset/wikipedia.js
+++ b/test/spec/ui/preset/wikipedia.js
@@ -10,7 +10,7 @@ describe('iD.ui.preset.wikipedia', function() {
else {
callback(title, data);
}
- }
+ };
return wikidataStub;
}
diff --git a/test/spec/ui/raw_tag_editor.js b/test/spec/ui/raw_tag_editor.js
index d97766c4d..da9b1f7e9 100644
--- a/test/spec/ui/raw_tag_editor.js
+++ b/test/spec/ui/raw_tag_editor.js
@@ -14,7 +14,7 @@ describe('iD.ui.RawTagEditor', function() {
}
beforeEach(function () {
- entity = iD.Node({id: "n12345"});
+ entity = iD.Node({id: 'n12345'});
context = iD();
context.history().merge([entity]);
render({highway: 'residential'});
@@ -24,54 +24,54 @@ describe('iD.ui.RawTagEditor', function() {
element.remove();
});
- it("creates input elements for each key-value pair", function () {
- expect(element.selectAll("input[value=highway]")).not.to.be.empty;
- expect(element.selectAll("input[value=residential]")).not.to.be.empty;
+ it('creates input elements for each key-value pair', function () {
+ expect(element.selectAll('input[value=highway]')).not.to.be.empty;
+ expect(element.selectAll('input[value=residential]')).not.to.be.empty;
});
- it("creates a pair of empty input elements if the entity has no tags", function () {
+ it('creates a pair of empty input elements if the entity has no tags', function () {
element.remove();
render({});
- expect(element.select('.tag-list').selectAll("input.value").property('value')).to.be.empty;
- expect(element.select('.tag-list').selectAll("input.key").property('value')).to.be.empty;
+ expect(element.select('.tag-list').selectAll('input.value').property('value')).to.be.empty;
+ expect(element.select('.tag-list').selectAll('input.key').property('value')).to.be.empty;
});
- it("adds tags when clicking the add button", function (done) {
- element.selectAll("button.add-tag").trigger('click');
+ it('adds tags when clicking the add button', function (done) {
+ element.selectAll('button.add-tag').trigger('click');
setTimeout(function() {
- expect(element.select('.tag-list').selectAll("input")[0][2].value).to.be.empty;
- expect(element.select('.tag-list').selectAll("input")[0][3].value).to.be.empty;
+ expect(element.select('.tag-list').selectAll('input')[0][2].value).to.be.empty;
+ expect(element.select('.tag-list').selectAll('input')[0][3].value).to.be.empty;
done();
}, 20);
});
- it("removes tags when clicking the remove button", function (done) {
+ it('removes tags when clicking the remove button', function (done) {
taglist.on('change', function(tags) {
expect(tags).to.eql({highway: undefined});
done();
});
- element.selectAll("button.remove").trigger('click');
+ element.selectAll('button.remove').trigger('click');
});
- it("adds tags when pressing the TAB key on last input.value", function (done) {
+ it('adds tags when pressing the TAB key on last input.value', function (done) {
expect(element.selectAll('.tag-list li')[0].length).to.eql(1);
var input = d3.select('.tag-list li:last-child input.value')[0][0];
happen.keydown(d3.select(input).node(), {keyCode: 9});
setTimeout(function() {
expect(element.selectAll('.tag-list li')[0].length).to.eql(2);
- expect(element.select('.tag-list').selectAll("input")[0][2].value).to.be.empty;
- expect(element.select('.tag-list').selectAll("input")[0][3].value).to.be.empty;
+ expect(element.select('.tag-list').selectAll('input')[0][2].value).to.be.empty;
+ expect(element.select('.tag-list').selectAll('input')[0][3].value).to.be.empty;
done();
}, 20);
});
- it("does not add a tag when pressing TAB while shift is pressed", function (done) {
+ it('does not add a tag when pressing TAB while shift is pressed', function (done) {
expect(element.selectAll('.tag-list li')[0].length).to.eql(1);
var input = d3.select('.tag-list li:last-child input.value')[0][0];
happen.keydown(d3.select(input).node(), {keyCode: 9, shiftKey: true});
setTimeout(function() {
expect(element.selectAll('.tag-list li')[0].length).to.eql(1);
done();
- }, 20)
+ }, 20);
});
});
diff --git a/test/spec/util/session_mutex.js b/test/spec/util/session_mutex.js
index ee9aa3bea..c1eb96980 100644
--- a/test/spec/util/session_mutex.js
+++ b/test/spec/util/session_mutex.js
@@ -1,4 +1,4 @@
-describe("iD.util.SessionMutex", function() {
+describe('iD.util.SessionMutex', function() {
var clock, a, b;
beforeEach(function () {
@@ -11,19 +11,19 @@ describe("iD.util.SessionMutex", function() {
if (b) b.unlock();
});
- describe("#lock", function() {
- it("returns true when it gets a lock", function() {
+ describe('#lock', function() {
+ it('returns true when it gets a lock', function() {
a = iD.util.SessionMutex('name');
expect(a.lock()).to.equal(true);
});
- it("returns true when already locked", function() {
+ it('returns true when already locked', function() {
a = iD.util.SessionMutex('name');
a.lock();
expect(a.lock()).to.equal(true);
});
- it("returns false when the lock is held by another session", function() {
+ it('returns false when the lock is held by another session', function() {
a = iD.util.SessionMutex('name');
a.lock();
@@ -32,19 +32,19 @@ describe("iD.util.SessionMutex", function() {
});
});
- describe("#locked", function() {
- it("returns false by default", function() {
+ describe('#locked', function() {
+ it('returns false by default', function() {
a = iD.util.SessionMutex('name');
expect(a.locked()).to.equal(false);
});
- it("returns true when locked", function() {
+ it('returns true when locked', function() {
a = iD.util.SessionMutex('name');
a.lock();
expect(a.locked()).to.equal(true);
});
- it("returns false when unlocked", function() {
+ it('returns false when unlocked', function() {
a = iD.util.SessionMutex('name');
a.lock();
a.unlock();
@@ -52,8 +52,8 @@ describe("iD.util.SessionMutex", function() {
});
});
- describe("#unlock", function() {
- it("unlocks the mutex", function() {
+ describe('#unlock', function() {
+ it('unlocks the mutex', function() {
a = iD.util.SessionMutex('name');
a.lock();
a.unlock();
@@ -62,7 +62,7 @@ describe("iD.util.SessionMutex", function() {
expect(b.lock()).to.equal(true);
});
- it("does nothing when the lock is held by another session", function() {
+ it('does nothing when the lock is held by another session', function() {
a = iD.util.SessionMutex('name');
a.lock();
@@ -72,14 +72,14 @@ describe("iD.util.SessionMutex", function() {
expect(a.locked()).to.equal(true);
});
- it("does nothing when not locked", function() {
+ it('does nothing when not locked', function() {
a = iD.util.SessionMutex('name');
a.unlock();
expect(a.locked()).to.equal(false);
});
});
- it("namespaces locks", function() {
+ it('namespaces locks', function() {
a = iD.util.SessionMutex('a');
a.lock();
@@ -88,7 +88,7 @@ describe("iD.util.SessionMutex", function() {
expect(b.lock()).to.equal(true);
});
- it("automatically unlocks when a session crashes", function() {
+ it('automatically unlocks when a session crashes', function() {
// Tested manually.
});
});
diff --git a/test/spec/util/suggest_names.js b/test/spec/util/suggest_names.js
index a26934c51..9443e3bf6 100644
--- a/test/spec/util/suggest_names.js
+++ b/test/spec/util/suggest_names.js
@@ -1,4 +1,4 @@
-describe("iD.util.SuggestNames", function() {
+describe('iD.util.SuggestNames', function() {
var suggestions = {
'key': {
'value': {