Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/donations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<% if @donation_info.donations.any? %>
<%= download_button_to(donations_path(format: :csv,
filters: filter_params.merge(date_range: date_range_params)),
{text: "Export Donations", size: "md"}) %>
{text: "Export Donations", size: "md", remote: true}) %>
<% end %>
<%= new_button_to new_donation_path, {text: "New Donation"} %>
</span>
Expand Down
9 changes: 9 additions & 0 deletions spec/requests/donations_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
expect(pdf.text).to include("Print")
end

it "fetches the export in the background so the button re-enables (#5744)" do
create(:donation, organization: organization)
page = Nokogiri::HTML(subject.body)
export = page.at_css("a[href*='donations.csv']")
expect(export.text).to include("Export Donations")
expect(export["data-controller"]).to eq("download")
expect(export["data-action"]).to eq("download#download")
end

context "when given a product drive" do
let(:product_drive) { create(:product_drive, name: "Drive Name") }
let(:donation) { create(:donation, source: "Product Drive", product_drive: product_drive) }
Expand Down