Adapt .dropEmbedded() test for .cickAt()

Also fix .clickAt() and .ignoreNextMousedown() to allow chaining
diff --git a/src/publicapi.js b/src/publicapi.js
index 139b934..162e438 100644
--- a/src/publicapi.js
+++ b/src/publicapi.js
@@ -145,9 +145,11 @@
     var ctrlr = this.__controller, root = ctrlr.root;
     if (!jQuery.contains(root.jQ[0], target)) target = root.jQ[0];
     ctrlr.seek($(target), clientX + pageXOffset, clientY + pageYOffset);
+    return this;
   };
   _.ignoreNextMousedown = function(fn) {
     this.__controller.cursor.options.ignoreNextMousedown = fn;
+    return this;
   };
   });
   MQ.prototype = AbstractMathQuill.prototype;
diff --git a/test/unit/publicapi.test.js b/test/unit/publicapi.test.js
index a2c62c3..4a81f74 100644
--- a/test/unit/publicapi.test.js
+++ b/test/unit/publicapi.test.js
@@ -762,6 +762,54 @@
     });
   });
 
+  suite('clickAt', function() {
+    test('inserts at coordinates', function() {
+      // Insert filler so that the page is taller than the window so this test is deterministic
+      // Test that we use clientY instead of pageY
+      var windowHeight = $(window).height();
+      var filler = $('<div>').height(windowHeight);
+      filler.insertBefore('#mock');
+
+      var mq = MQ.MathField($('<span>').appendTo('#mock')[0]);
+      mq.typedText("mmmm/mmmm");
+      mq.el().scrollIntoView();
+
+      var box = mq.el().getBoundingClientRect();
+      var clientX = box.left + 30;
+      var clientY = box.top + 40;
+      var target = document.elementFromPoint(clientX, clientY);
+
+      mq.clickAt(clientX, clientY, target).write('x');
+
+      assert.equal(mq.latex(), "\\frac{mmmm}{mmxmm}");
+
+      filler.remove();
+      $(mq.el()).remove();
+    });
+    test('target is optional', function() {
+      // Insert filler so that the page is taller than the window so this test is deterministic
+      // Test that we use clientY instead of pageY
+      var windowHeight = $(window).height();
+      var filler = $('<div>').height(windowHeight);
+      filler.insertBefore('#mock');
+
+      var mq = MQ.MathField($('<span>').appendTo('#mock')[0]);
+      mq.typedText("mmmm/mmmm");
+      mq.el().scrollIntoView();
+
+      var box = mq.el().getBoundingClientRect();
+      var clientX = box.left + 30;
+      var clientY = box.top + 40;
+
+      mq.clickAt(clientX, clientY).write('x');
+
+      assert.equal(mq.latex(), "\\frac{mmmm}{mmxmm}");
+
+      filler.remove();
+      $(mq.el()).remove();
+    });
+  });
+
   suite('dropEmbedded', function() {
     test('inserts into empty', function() {
       var mq = MQ.MathField($('<span>').appendTo('#mock')[0]);