mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 15:56:56 +02:00
selection -> selectedIDs
Overloading "selection" is a bad idea.
This commit is contained in:
+1
-1
@@ -103,7 +103,7 @@
|
||||
return 'img/' + _;
|
||||
};
|
||||
|
||||
context.selection = function() {
|
||||
context.selectedIDs = function() {
|
||||
return [];
|
||||
};
|
||||
|
||||
|
||||
@@ -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]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user