Fix select & deselect all aspects check image

This commit is contained in:
Juan Manuel Azambuja 2013-04-21 21:38:03 -03:00
parent 3cb6f1cc3f
commit de7044c602
3 changed files with 18 additions and 3 deletions

View file

@ -28,12 +28,19 @@ app.views.AspectsList = app.views.Base.extend({
toggleAll: function(evt){
if (evt) { evt.preventDefault(); };
var aspects = this.$('li:not(:last)')
if (this.collection.allSelected()) {
this.collection.deselectAll();
this.$('li:not(:last)').removeClass("active");
aspects.removeClass("active");
aspects.each(function(i){
$(this).find('.icons-check_yes_ok').addClass('invisible');
});
} else {
this.collection.selectAll();
this.$('li:not(:last)').addClass("active");
aspects.addClass("active");
aspects.each(function(i){
$(this).find('.icons-check_yes_ok').removeClass('invisible');
});
}
this.toggleSelector();

View file

@ -31,3 +31,10 @@ Feature: Aspect navigation on the left menu
Then I should see "Besties" aspect selected
Then I should see "Unicorns" aspect selected
Then I should see "Others" aspect unselected
Scenario: Deselect all aspects
When I go to the aspects page
And I follow "Deselect all"
Then I should see "Besties" aspect unselected
Then I should see "Unicorns" aspect unselected
Then I should see "Others" aspect unselected

View file

@ -38,12 +38,13 @@ When /^I should see "([^"]*)" aspect selected$/ do |aspect_name|
aspect = @me.aspects.where(:name => aspect_name).first
within("#aspect_nav") do
page.has_css?("li.active[data-aspect_id='#{aspect.id}']").should be_true
page.has_no_css?("li.active[data-aspect_id='#{aspect.id}'] .invisible").should be_true
end
end
When /^I should see "([^"]*)" aspect unselected$/ do |aspect_name|
aspect = @me.aspects.where(:name => aspect_name).first
within("#aspect_nav") do
page.has_css?("li[data-aspect_id='#{aspect.id}']:not(.active)").should be_true
page.has_css?("li[data-aspect_id='#{aspect.id}']:not(.active) .invisible").should be_true
end
end