diff --git a/spec/javascripts/aspect-edit-spec.js b/spec/javascripts/aspect-edit-spec.js index 94e3460fc..90df6813a 100644 --- a/spec/javascripts/aspect-edit-spec.js +++ b/spec/javascripts/aspect-edit-spec.js @@ -170,6 +170,29 @@ describe("AspectEdit", function() { }); }); }); + + describe("onDeleteRequestSuccess", function() { + beforeEach(function() { + $('#jasmine_content').html( +'
  • ' + +' Alexander Hamiltom' + +'
  • ' + +'' + +'
    Requests (1)
    ' + ); + }); + it("decrements the request counter", function() { + spyOn(AspectEdit, "decrementRequestsCounter"); + AspectEdit.onDeleteRequestSuccess($('li.person')); + expect(AspectEdit.decrementRequestsCounter).toHaveBeenCalled(); + }); + it("takes the request class off the person li", function() { + expect($('li.person')).toHaveClass('request'); + AspectEdit.onDeleteRequestSuccess($('li.person')); + expect($('li.person')).not.toHaveClass('request'); + }); + }); describe("decrementRequestsCounter", function() { describe("when there is one request", function() {