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:
parent
81fc5b28da
commit
b92cb921c1
2 changed files with 4 additions and 5 deletions
|
|
@ -271,7 +271,7 @@ var Publisher = {
|
||||||
},
|
},
|
||||||
|
|
||||||
determineSubmitAvailability: function(){
|
determineSubmitAvailability: function(){
|
||||||
var onlyWhitespaces = (Publisher.input().val().trim() === ''),
|
var onlyWhitespaces = ($.trim(Publisher.input().val()) === ''),
|
||||||
isSubmitDisabled = Publisher.submit().attr('disabled'),
|
isSubmitDisabled = Publisher.submit().attr('disabled'),
|
||||||
isPhotoAttached = ($("#photodropzone").children().length > 0);
|
isPhotoAttached = ($("#photodropzone").children().length > 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.initialize();
|
||||||
Publisher.bindAspectToggles();
|
|
||||||
|
|
||||||
$("#publisher .dropdown .dropdown_list li.aspect_selector").last().click();
|
$("#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();
|
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');
|
spyOn(Publisher, 'toggleAspectIds');
|
||||||
Publisher.bindAspectToggles();
|
Publisher.bindAspectToggles();
|
||||||
var aspectBadge = $("#publisher .dropdown .dropdown_list li").last();
|
var aspectBadge = $("#publisher .dropdown .dropdown_list li").last();
|
||||||
aspectBadge.click();
|
aspectBadge.click();
|
||||||
expect(Publisher.toggleAspectIds).toHaveBeenCalledWith(aspectBadge);
|
expect(Publisher.toggleAspectIds.mostRecentCall.args[0].get(0)).toEqual(aspectBadge.get(0));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue