diff --git a/spec/javascripts/aspect-edit-spec.js b/spec/javascripts/aspect-edit-spec.js index 395ac859a..cc5b6e25e 100644 --- a/spec/javascripts/aspect-edit-spec.js +++ b/spec/javascripts/aspect-edit-spec.js @@ -1,5 +1,13 @@ describe("AspectEdit", function() { + beforeEach(function() { + $('#jasmine_content').html( +'
  • ' + +' Alexander Hamiltom' + +'
  • ' + ); + }); + describe("initialize", function() { it("calls draggable on ul .person", function() { spyOn($.fn, "draggable"); @@ -30,13 +38,6 @@ describe("AspectEdit", function() { }); describe("startDrag", function() { - beforeEach(function() { - $('#jasmine_content').html( -'
  • ' + -' Alexander Hamiltom' + -'
  • ' - ); - }); it("animates the image", function() { spyOn(AspectEdit, "animateImage"); $.proxy(AspectEdit.startDrag, $('.person.ui-draggable'))(); @@ -52,13 +53,6 @@ describe("AspectEdit", function() { }); describe("animateImage", function() { - beforeEach(function() { - $('#jasmine_content').html( -'
  • ' + -' Alexander Hamiltom' + -'
  • ' - ); - }); it("hides the tipsy ... thingy, whatever that is", function() { spyOn($.fn, "tipsy"); AspectEdit.animateImage($('.avatar')); @@ -71,6 +65,30 @@ describe("AspectEdit", function() { }); }); + describe("duringDrag", function() { + it("rehides the tipsy thingy", function() { + spyOn($.fn, "tipsy"); + $.proxy(AspectEdit.duringDrag, $('.person.ui-draggable'))(); + expect($.fn.tipsy).toHaveBeenCalledWith("hide"); + expect($.fn.tipsy.mostRecentCall.object).toHaveClass("avatar"); + }); + }); + + describe("stopDrag", function() { + xit("animates the image back to smaller size and full opacity", function() { + spyOn($.fn, "animate"); + $.proxy(AspectEdit.stopDrag, $('.person.ui-draggable'))(); + expect($.fn.animate).toHaveBeenCalledWith({'height':70, 'width':70, 'opacity':1}, 200); + expect($.fn.animate.mostRecentCall.object).toHaveClass("avatar"); + }); + it("fades out the drag and drop text", function() { + spyOn($.fn, "fadeOut"); + $.proxy(AspectEdit.stopDrag, $('.person.ui-draggable'))(); + expect($.fn.fadeOut).toHaveBeenCalledWith(100); + expect($.fn.fadeOut.mostRecentCall.object.selector).toEqual(".draggable_info"); + }); + }); + describe("decrementRequestsCounter", function() { describe("when there is one request", function() { it("removes the counter from the new requests div", function() {