Files
iD/test/spec/modes/add_point.js
John Firebaugh 402a9424c0 Make selection an array of entity IDs
Should have no visible effect yet.
2013-01-31 13:51:12 -05:00

42 lines
1.2 KiB
JavaScript

describe("iD.modes.AddPoint", function () {
var container, map, history, controller, mode;
beforeEach(function () {
container = d3.select('body').append('div');
history = iD.History();
map = iD.Map().history(history);
controller = iD.Controller(map, history);
container.call(map);
container.append('div')
.attr('class', 'inspector-wrap');
mode = iD.modes.AddPoint();
controller.enter(mode);
});
afterEach(function() {
container.remove();
});
describe("clicking the map", function () {
it("adds a node", function () {
happen.click(map.surface.node(), {});
expect(history.changes().created).to.have.length(1);
});
it("selects the node", function () {
happen.click(map.surface.node(), {});
expect(controller.mode.id).to.equal('select');
expect(controller.mode.selection()).to.eql([history.changes().created[0].id]);
});
});
describe("pressing ⎋", function () {
it("exits to browse mode", function () {
happen.keydown(document, {keyCode: 27});
expect(controller.mode.id).to.equal('browse');
});
});
});