type -> geometry

This commit is contained in:
John Firebaugh
2013-03-12 12:32:08 -07:00
parent 7133d316cd
commit 107f6cfeba
127 changed files with 148 additions and 148 deletions
+5 -5
View File
@@ -4,7 +4,7 @@ describe("iD.presets.Category", function() {
beforeEach(function() {
category = {
"match": {
"type": "line"
"geometry": "line"
},
"icon": "highway",
"name": "roads",
@@ -18,7 +18,7 @@ describe("iD.presets.Category", function() {
tags: {
highway: 'residential'
},
type: ['line']
geometry: ['line']
}
});
});
@@ -28,14 +28,14 @@ describe("iD.presets.Category", function() {
expect(c.members.collection[0]).to.eql(residential);
});
describe("#matchType", function() {
describe("#matchGeometry", function() {
it("matches the type of an entity", function() {
var c = iD.presets.Category(category, iD.presets.Collection([residential])),
w = iD.Way(),
n = iD.Node(),
g = iD.Graph().replace(w);
expect(c.matchType(w, g)).to.eql(true);
expect(c.matchType(n, g)).to.eql(false);
expect(c.matchGeometry(w, g)).to.eql(true);
expect(c.matchGeometry(n, g)).to.eql(false);
});
});
});
+6 -6
View File
@@ -1,11 +1,11 @@
describe("iD.prests.Collection", function() {
describe("iD.presets.Collection", function() {
var p = {
other: iD.presets.Preset({
name: 'other',
match: {
tags: {},
type: ['point', 'vertex', 'line', 'area']
geometry: ['point', 'vertex', 'line', 'area']
}
}),
residential: iD.presets.Preset({
@@ -14,7 +14,7 @@ describe("iD.prests.Collection", function() {
tags: {
highway: 'residential'
},
type: ['line']
geometry: ['line']
}
}),
park: iD.presets.Preset({
@@ -23,7 +23,7 @@ describe("iD.prests.Collection", function() {
tags: {
leisure: 'park'
},
type: ['point', 'area']
geometry: ['point', 'area']
}
})
};
@@ -39,9 +39,9 @@ describe("iD.prests.Collection", function() {
});
});
describe("#matchType", function() {
describe("#matchGeometry", function() {
it("returns a new collection only containing presets matching an entity's type", function() {
expect(c.matchType(w, g).collection).to.eql([p.other, p.residential]);
expect(c.matchGeometry(w, g).collection).to.eql([p.other, p.residential]);
});
});
+8 -8
View File
@@ -13,7 +13,7 @@ describe('iD.presets.Preset', function() {
name: 'other',
match: {
tags: {},
type: ['point', 'vertex', 'line', 'area']
geometry: ['point', 'vertex', 'line', 'area']
}
}),
residential: iD.presets.Preset({
@@ -22,7 +22,7 @@ describe('iD.presets.Preset', function() {
tags: {
highway: 'residential'
},
type: ['line']
geometry: ['line']
}
}),
tennis: iD.presets.Preset({
@@ -32,7 +32,7 @@ describe('iD.presets.Preset', function() {
leisure: 'pitch',
sport: 'tennis'
},
type: ['area']
geometry: ['area']
}
}),
building: iD.presets.Preset({
@@ -41,7 +41,7 @@ describe('iD.presets.Preset', function() {
tags: {
building: '*'
},
type: ['area']
geometry: ['area']
}
}),
cafe: iD.presets.Preset({
@@ -50,7 +50,7 @@ describe('iD.presets.Preset', function() {
tags: {
amenity: 'cafe'
},
type: ['point', 'area']
geometry: ['point', 'area']
},
form: ['building_area']
}, forms)
@@ -76,15 +76,15 @@ describe('iD.presets.Preset', function() {
expect(p.other.form).to.eql([]);
});
describe('#matchType', function() {
describe('#matchGeometry', function() {
var n = iD.Node();
var g = iD.Graph().replace(p);
it("returns false if it doesn't match the entity type", function() {
expect(p.residential.matchType(n, g)).to.equal(false);
expect(p.residential.matchGeometry(n, g)).to.equal(false);
});
it("returns true if it does match the entity type", function() {
expect(p.other.matchType(n, g)).to.equal(true);
expect(p.other.matchGeometry(n, g)).to.equal(true);
});
});