From 737c812e0808e2ed8a74a3f8ac8d863ae5b6c29b Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Fri, 12 Nov 2010 16:38:02 -0600 Subject: [PATCH] Specs for AspectEdit.onDeleteRequestSuccess --- spec/javascripts/aspect-edit-spec.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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() {