Fix tests for faux click

This commit is contained in:
Tom MacWright
2013-02-05 15:58:54 -05:00
parent 4a024651b4
commit 4b76b136fa
2 changed files with 11 additions and 9 deletions

View File

@@ -3,7 +3,7 @@ iD.behavior.Draw = function(context) {
'clickNode', 'undo', 'cancel', 'finish'),
keybinding = d3.keybinding('draw'),
hover = iD.behavior.Hover(),
closeTolerance = 4;
closeTolerance = 4,
tolerance = 12;
function datum() {

View File

@@ -1,7 +1,7 @@
describe("iD.modes.AddPoint", function () {
describe("iD.modes.AddPoint", function() {
var context;
beforeEach(function () {
beforeEach(function() {
var container = d3.select(document.createElement('div'));
context = iD()
@@ -15,20 +15,22 @@ describe("iD.modes.AddPoint", function () {
});
describe("clicking the map", function () {
it("adds a node", function () {
happen.click(context.surface().node(), {});
it("adds a node", function() {
happen.mousedown(context.surface().node(), {});
happen.mouseup(window, {});
expect(context.changes().created).to.have.length(1);
});
it("selects the node", function () {
happen.click(context.surface().node(), {});
it("selects the node", 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]);
});
});
describe("pressing ⎋", function () {
it("exits to browse mode", function () {
describe("pressing ⎋", function() {
it("exits to browse mode", function() {
happen.keydown(document, {keyCode: 27});
expect(context.mode().id).to.equal('browse');
});