Publisher.bindAspectToggles() is called in Publisher.initialize(). only bind the events once

jQuery objects containing the same elements don't evaluate as true. test that the elements within the jQuery objects are the same
This commit is contained in:
Dan Hansen 2011-10-23 21:30:35 -05:00
parent 81fc5b28da
commit b92cb921c1
2 changed files with 4 additions and 5 deletions

View file

@ -271,7 +271,7 @@ var Publisher = {
},
determineSubmitAvailability: function(){
var onlyWhitespaces = (Publisher.input().val().trim() === ''),
var onlyWhitespaces = ($.trim(Publisher.input().val()) === ''),
isSubmitDisabled = Publisher.submit().attr('disabled'),
isPhotoAttached = ($("#photodropzone").children().length > 0);

View file

@ -55,9 +55,8 @@ describe("Publisher", function() {
});
});
it('toggles removed only on the clicked icon', function(){
it('toggles selected only on the clicked icon', function(){
Publisher.initialize();
Publisher.bindAspectToggles();
$("#publisher .dropdown .dropdown_list li.aspect_selector").last().click();
@ -69,12 +68,12 @@ describe("Publisher", function() {
expect($("#publisher .dropdown .dropdown_list li.aspect_selector").last().hasClass("selected")).toBeTruthy();
});
it('is called with the correct element', function(){
it('calls toggleAspectIds with the clicked element', function(){
spyOn(Publisher, 'toggleAspectIds');
Publisher.bindAspectToggles();
var aspectBadge = $("#publisher .dropdown .dropdown_list li").last();
aspectBadge.click();
expect(Publisher.toggleAspectIds).toHaveBeenCalledWith(aspectBadge);
expect(Publisher.toggleAspectIds.mostRecentCall.args[0].get(0)).toEqual(aspectBadge.get(0));
});
});