From 9ce5b0aa181048babc3a752c3c383204d2079658 Mon Sep 17 00:00:00 2001 From: Jeremy Press Date: Mon, 16 Apr 2018 13:59:54 -0700 Subject: [PATCH] Fix: Allow textarea to be interactable in certain scenarios (#174) --- src/controllers/PointModeController.js | 2 +- .../__tests__/PointModeController-test.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/controllers/PointModeController.js b/src/controllers/PointModeController.js index 6579eb694..809869db3 100644 --- a/src/controllers/PointModeController.js +++ b/src/controllers/PointModeController.js @@ -115,7 +115,7 @@ class PointModeController extends AnnotationModeController { this.pointClickHandler = this.pointClickHandler.bind(this); // Get handlers - this.pushElementHandler(this.annotatedElement, ['mousedown', 'touchstart'], this.pointClickHandler); + this.pushElementHandler(this.annotatedElement, ['click', 'touchstart'], this.pointClickHandler); this.pushElementHandler(this.exitButtonEl, 'click', this.toggleMode); } diff --git a/src/controllers/__tests__/PointModeController-test.js b/src/controllers/__tests__/PointModeController-test.js index 5d7140e6a..0b5b18e05 100644 --- a/src/controllers/__tests__/PointModeController-test.js +++ b/src/controllers/__tests__/PointModeController-test.js @@ -129,10 +129,20 @@ describe('controllers/PointModeController', () => { describe('setupHandlers()', () => { it('should successfully contain mode handlers', () => { + sandbox.stub(controller, 'pushElementHandler'); controller.exitButtonEl = 'also definitely not undefined'; controller.setupHandlers(); - expect(controller.handlers.length).to.equal(2); + expect(controller.pushElementHandler).to.be.calledWith( + controller.annotatedElement, + ['click', 'touchstart'], + controller.pointClickHandler + ); + expect(controller.pushElementHandler).to.be.calledWith( + controller.exitButtonEl, + 'click', + controller.toggleMode + ); }); });