mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Remove item from dropdown cart after deletion
This commit is contained in:
committed by
Rob Harrington
parent
936df71d0d
commit
811671661e
@@ -4,6 +4,7 @@ Darkswarm.controller "EditOrderCtrl", ($scope, $resource, Cart) ->
|
||||
params = {id: id}
|
||||
success = (response) ->
|
||||
$(".line-item-" + id).remove()
|
||||
Cart.removeFinalisedLineItem(id)
|
||||
fail = (error) ->
|
||||
console.log error
|
||||
|
||||
|
||||
@@ -120,6 +120,10 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $roo
|
||||
@line_items = []
|
||||
localStorageService.clearAll() # One day this will have to be moar GRANULAR
|
||||
|
||||
removeFinalisedLineItem: (id) =>
|
||||
@line_items_finalised = @line_items_finalised.filter (item) ->
|
||||
item.id != id
|
||||
|
||||
reloadFinalisedLineItems: =>
|
||||
@line_items_finalised = []
|
||||
$resource("/line_items").query (items) =>
|
||||
|
||||
@@ -110,6 +110,11 @@ feature "full-page cart", js: true do
|
||||
expect(page).to have_no_content item1.variant.name
|
||||
expect(page).to have_content item2.variant.name
|
||||
|
||||
# open the dropdown cart and check there as well
|
||||
find('#cart').click
|
||||
expect(page).to have_no_content item1.variant.name
|
||||
expect(page).to have_content item2.variant.name
|
||||
|
||||
visit spree.cart_path
|
||||
expect(page).to have_no_content item1.variant.name
|
||||
expect(page).to have_content item2.variant.name
|
||||
|
||||
Reference in New Issue
Block a user