spec/javascripts/ballonizer_spec.js in ballonizer-0.2.3 vs spec/javascripts/ballonizer_spec.js in ballonizer-0.2.4

- old
+ new

@@ -261,9 +261,24 @@ expect(ballons[0].getEditionNode().attr("style")).toEqual( ballons[0].getNormalNode().attr("style") ); }); + describe("when the container is inside a <a/> element", function () { + it("prevent the default action of changing the page", function () { + // first create a ballon + loadFixtures("ballonized-xkcd-with-anchor-in-image.html"); + instance = Ballonizer(actionFormURL, imageToBallonizeCSSSelector, $("#jasmine-fixtures")); + var ballonizedImg = $(".ballonizer_image_container img"); + realWorldEvent("dblclick", ballonizedImg) + var ballon = $(".ballonizer_ballon") + + // and then we simulate a dblclick over the ballon + var spyAnchor = spyOnEvent("#comic a", "click"); + realWorldEvent("dblclick", ballon); + expect(spyAnchor).toHaveBeenPrevented(); + }); + }); }); describe("when the focus is lost in edit mode", function () { it("the ballon return to the initial mode with the new text", function () { ballons = getBallons(); // Edit the text of the first ballon