Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid triggering unpermitted params on JS link #1507

Merged
merged 1 commit into from Dec 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/javascripts/administrate/components/table.js
Expand Up @@ -13,7 +13,7 @@ $(function() {
var dataUrl = $(event.target).closest("tr").data("url");
var selection = window.getSelection().toString();
if (selection.length === 0 && dataUrl) {
window.location.pathname = dataUrl;
window.location = window.location.protocol + '//' + window.location.host + dataUrl;
}
}
};
Expand Down
10 changes: 10 additions & 0 deletions spec/features/index_page_spec.rb
Expand Up @@ -95,6 +95,16 @@ def expect_to_appear_in_order(*elements)
expect_to_appear_in_order("unique name one", "unique name two")
end

it "allows clicking through after sorting", :js do
customer = create(:customer)
create(:order, customer: customer)

visit admin_customers_path
click_on "Name"
find("[data-url]").click
expect(page).to have_header("Show #{customer.name}")
end

it "allows reverse sorting" do
create(:customer, name: "unique name one")
create(:customer, name: "unique name two")
Expand Down