Skip to content

Commit

Permalink
Fix issue where cancelling a line item delete didn't actually cancel it
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed Oct 14, 2013
1 parent fdb7968 commit 67f5491
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
13 changes: 7 additions & 6 deletions backend/app/assets/javascripts/admin/variant_autocomplete.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ $(document).ready(function() {

//handle delete click
$('a.delete-item').click(function(){
var del = $(this);
var shipment_number = del.data('shipment-number');
var variant_id = del.data('variant-id');
if (confirm(Spree.translations.are_you_sure_delete)) {
var del = $(this);
var shipment_number = del.data('shipment-number');
var variant_id = del.data('variant-id');

toggleItemEdit();

adjustItems(shipment_number, variant_id, 0);
toggleItemEdit();

adjustItems(shipment_number, variant_id, 0);
}
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<%= link_to '', '#', :class => 'cancel-item icon_link icon-cancel no-text with-tip', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel'), :style => 'display: none' %>
<%= link_to '', '#', :class => 'edit-item icon_link icon-edit no-text with-tip', :data => {:action => 'edit'}, :title => Spree.t('edit') %>
<%= link_to '', '#', :class => 'split-item icon_link icon-resize-horizontal no-text with-tip', :data => {:action => 'split', 'variant-id' => item.variant.id}, :title => Spree.t('split') %>
<%= link_to '', '#', :class => 'delete-item icon-trash no-text with-tip', :data => { :confirm => Spree.t(:are_you_sure), 'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'remove'}, :title => Spree.t('delete') %>
<%= link_to '', '#', :class => 'delete-item icon-trash no-text with-tip', :data => { 'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'remove'}, :title => Spree.t('delete') %>
<% end %>
</td>
<% end %>
Expand Down
13 changes: 13 additions & 0 deletions backend/spec/features/admin/orders/order_details_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@
page.should_not have_content("spree t-shirt")
end

# Regression test for #3862
it "can remove an item from a shipment" do
page.should have_content("spree t-shirt")

within_row(1) do
click_icon :trash
end

# Click "cancel" on confirmation dialog
page.driver.browser.switch_to.alert.dismiss
page.should have_content("spree t-shirt")
end

it "can add tracking information" do
within("table.index tr:nth-child(5)") do
click_icon :edit
Expand Down

0 comments on commit 67f5491

Please sign in to comment.