ballonizer 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19b38f4df9955b6a60224ef50b2fcd87cb70c5d7
4
- data.tar.gz: acb21a62902e381169bbb9564f2934e2fd17123b
3
+ metadata.gz: d0c952e482196754c61560f3f13560bc86fb5d27
4
+ data.tar.gz: 34b1558bde993de958a822318184761283c88539
5
5
  SHA512:
6
- metadata.gz: 7c3cb6f8ef31e75eaaace031833f997fae0723dbff0b6fe5cbcf2ec613434831e7221cc72aaad39bbdb64eb0ee22c65a8df22576cafa8d7656510ebabef0a02d
7
- data.tar.gz: c5f62a31a34a9a2f9b9dbdcad0b477144964f91fceea78a14aebff05cb9e1464250751f940bf94217c01f4114f4e7dd818b844e82a81dda5fd89bed790548ead
6
+ metadata.gz: a572d9a10cb4a5bf4a572fad6af8aa56f04b5130431d40a5987c0fb07db3193faf9a199bdc34ea6e599e7aa3ee6c67cafbe2abede9f6c69804bd938e8c7b32ba
7
+ data.tar.gz: 5256a91b0b6e03c7d3ea34901df125dd1795d73f4894ba22eab39dfe9b9883246b2f45f05fe5dd9ed73eb2acc5e05b947a7e4b0da8d1cd4e87c07fee76772f79
@@ -339,6 +339,9 @@
339
339
  this.editionNode = editionBallon;
340
340
  imageForm.prepend(this.editionNode);
341
341
 
342
+ this.node.click($.proxy(function (event) {
343
+ this.click(event);
344
+ }, this));
342
345
  this.editionNode.blur($.proxy(function (event) {
343
346
  this.blur(event);
344
347
  }, this));
@@ -457,6 +460,11 @@
457
460
  this.editionNode.focus();
458
461
  };
459
462
 
463
+ // avoid following anchor when click over a ballon
464
+ InterfaceBallon.prototype.click = function (event) {
465
+ event.preventDefault();
466
+ };
467
+
460
468
  InterfaceBallon.prototype.serialize = function () {
461
469
  var containerWidth = this.imgContainer.getContainerNode().width();
462
470
  var containerHeight = this.imgContainer.getContainerNode().height();
@@ -263,6 +263,21 @@ describe("Ballonizer", function () {
263
263
  ballons[0].getNormalNode().attr("style")
264
264
  );
265
265
  });
266
+ describe("when the container is inside a <a/> element", function () {
267
+ it("prevent the default action of changing the page", function () {
268
+ // first create a ballon
269
+ loadFixtures("ballonized-xkcd-with-anchor-in-image.html");
270
+ instance = Ballonizer(actionFormURL, imageToBallonizeCSSSelector, $("#jasmine-fixtures"));
271
+ var ballonizedImg = $(".ballonizer_image_container img");
272
+ realWorldEvent("dblclick", ballonizedImg)
273
+ var ballon = $(".ballonizer_ballon")
274
+
275
+ // and then we simulate a dblclick over the ballon
276
+ var spyAnchor = spyOnEvent("#comic a", "click");
277
+ realWorldEvent("dblclick", ballon);
278
+ expect(spyAnchor).toHaveBeenPrevented();
279
+ });
280
+ });
266
281
  });
267
282
  describe("when the focus is lost in edit mode", function () {
268
283
  it("the ballon return to the initial mode with the new text", function () {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ballonizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique Becker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-05 00:00:00.000000000 Z
11
+ date: 2013-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri