From 4b76b136fab3a2bc0beb2aba6f21c23d7287b2c4 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 5 Feb 2013 15:58:54 -0500 Subject: [PATCH] Fix tests for faux click --- js/id/behavior/draw.js | 2 +- test/spec/modes/add_point.js | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/js/id/behavior/draw.js b/js/id/behavior/draw.js index e68625d05..a4fb53a1a 100644 --- a/js/id/behavior/draw.js +++ b/js/id/behavior/draw.js @@ -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() { diff --git a/test/spec/modes/add_point.js b/test/spec/modes/add_point.js index 38a614198..62291f8ee 100644 --- a/test/spec/modes/add_point.js +++ b/test/spec/modes/add_point.js @@ -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'); });