Moved area-keys to data, and process it during runtime

This commit is contained in:
Sajjad Anwar
2014-10-22 18:24:09 -04:00
committed by John Firebaugh
parent 90b0f1c5bf
commit dffeedffc9
8 changed files with 59 additions and 113 deletions
-1
View File
@@ -190,7 +190,6 @@
<script src='../js/id/core/relation.js'></script>
<script src='../js/id/core/way.js'></script>
<script src='../js/id/core/tree.js'></script>
<script src='../js/id/core/area_keys.js'></script>
<script src='../js/id/core/oneway_tags.js'></script>
<script src='../js/id/presets.js'></script>
+5
View File
@@ -1,4 +1,9 @@
describe("iD.actions.Split", function () {
beforeEach(function () {
iD.areaKeys = iD().presets(iD.data.presets).presets().areaKeys();
});
describe("#disabled", function () {
it("returns falsy for a non-end node of a single way", function () {
var graph = iD.Graph([
+27
View File
@@ -40,6 +40,33 @@ describe("iD.presets", function() {
});
});
describe("#areaKeys", function() {
var presets = iD.presets().load({
presets: {
a: {
tags: {
a: '*'
},
geometry: ['point', 'line', 'area']
},
ab: {
tags: {
a: 'b'
},
geometry: ['line']
}
}
});
it("whitelists keys from presets with area geometry", function() {
expect(presets.areaKeys()).to.have.key('a');
});
it("blacklists key-values from presets without an area geometry", function() {
expect(presets.areaKeys().a.b).to.eq(true);
});
});
describe("expected matches", function() {
var presets;