Show only defined columns on inserted rows
When we were inserting a row or replacing an existing one (just like we do when we click the link to select an investment), we were entering a row containing all columns, and all of them were displayed even if they had been excluded using the column selector. This caused the table to move in a strange way, which sometimes made the investment selection tests fail.
This commit is contained in:
@@ -82,6 +82,9 @@
|
||||
App.ColumnsSelector.toggleColumn(event);
|
||||
}
|
||||
});
|
||||
$(".column-selecteable").on("inserted", function() {
|
||||
App.ColumnsSelector.initColumns();
|
||||
});
|
||||
}
|
||||
};
|
||||
}).call(this);
|
||||
|
||||
@@ -1 +1 @@
|
||||
$("#<%= dom_id(@investment) %>").html("<%= j render("select_investment", investment: @investment) %>");
|
||||
$("#<%= dom_id(@investment) %>").html("<%= j render("select_investment", investment: @investment) %>").trigger("inserted");
|
||||
|
||||
@@ -1892,6 +1892,21 @@ describe "Admin budget investments" do
|
||||
"visible_to_valuators,selected,incompatible,author")
|
||||
|
||||
end
|
||||
|
||||
scenario "Select an investment when some columns are not displayed", :js do
|
||||
investment.update_attribute(:title, "Don't display me, please!")
|
||||
|
||||
visit admin_budget_budget_investments_path(budget)
|
||||
within("#js-columns-selector") { find("strong", text: "Columns").click }
|
||||
within("#js-columns-selector-wrapper") { uncheck "Title" }
|
||||
|
||||
within("#budget_investment_#{investment.id}") do
|
||||
click_link "Selected"
|
||||
|
||||
expect(page).to have_link "Select"
|
||||
expect(page).not_to have_content "Don't display me, please!"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user