selection -> selectedIDs

Overloading "selection" is a bad idea.
This commit is contained in:
John Firebaugh
2013-06-03 15:47:13 -07:00
parent eebd9aa030
commit a84a3364cc
23 changed files with 82 additions and 82 deletions
+1 -1
View File
@@ -103,7 +103,7 @@
return 'img/' + _;
};
context.selection = function() {
context.selectedIDs = function() {
return [];
};
+4 -4
View File
@@ -34,7 +34,7 @@ describe("iD.behavior.Select", function() {
specify("click on entity selects the entity", function() {
happen.click(context.surface().select('.' + a.id).node());
expect(context.selection()).to.eql([a.id]);
expect(context.selectedIDs()).to.eql([a.id]);
});
specify("click on empty space clears the selection", function() {
@@ -46,13 +46,13 @@ describe("iD.behavior.Select", 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().select('.' + b.id).node(), {shiftKey: true});
expect(context.selection()).to.eql([a.id, b.id]);
expect(context.selectedIDs()).to.eql([a.id, b.id]);
});
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().select('.' + b.id).node(), {shiftKey: true});
expect(context.selection()).to.eql([a.id]);
expect(context.selectedIDs()).to.eql([a.id]);
});
specify("shift-click on last selected entity clears the selection", function() {
@@ -64,6 +64,6 @@ describe("iD.behavior.Select", 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.selection()).to.eql([a.id]);
expect(context.selectedIDs()).to.eql([a.id]);
});
});
+1 -1
View File
@@ -27,7 +27,7 @@ describe("iD.modes.AddPoint", function() {
happen.mousedown(context.surface().node(), {});
happen.mouseup(window, {});
expect(context.mode().id).to.equal('select');
expect(context.mode().selection()).to.eql([context.changes().created[0].id]);
expect(context.mode().selectedIDs()).to.eql([context.changes().created[0].id]);
context.mode().exit();
});
});
+2 -2
View File
@@ -17,7 +17,7 @@ describe("iD.svg.Midpoints", function () {
graph = iD.Graph([a, b, line]),
extent = iD.geo.Extent([0, 0], [100, 100]);
context.selection = function() { return [line.id]; };
context.selectedIDs = function() { return [line.id]; };
surface.call(iD.svg.Midpoints(projection, context), graph, [line], filter, extent);
expect(surface.select('.midpoint').datum().loc).to.eql([25, 0]);
@@ -30,7 +30,7 @@ describe("iD.svg.Midpoints", function () {
graph = iD.Graph([a, b, line]),
extent = iD.geo.Extent([0, 0], [100, 100]);
context.selection = function() { return [line.id]; };
context.selectedIDs = function() { return [line.id]; };
surface.call(iD.svg.Midpoints(projection, context), graph, [line], filter, extent);
expect(surface.selectAll('.midpoint')[0]).to.have.length(0);