mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Discarding changes reloads from DB
But it also clears any search filters. To confirm exactly what behaviour is desired before fixing...
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
.error
|
||||
= error_msg
|
||||
.form-buttons.six.columns
|
||||
= form.submit t('.reset'), type: :reset, class: "medium"
|
||||
= form.submit t('.reset'), type: :reset, class: "medium", 'data-reflex': 'click->products#fetch'
|
||||
= form.submit t('.save'), class: "medium"
|
||||
%table.products
|
||||
%col{ width:"15%" }
|
||||
|
||||
@@ -205,6 +205,25 @@ describe 'As an admin, I can see the new product page' do
|
||||
pending
|
||||
expect(page).to have_content "Changes saved"
|
||||
end
|
||||
|
||||
it "can discard changes and reload latest data" do
|
||||
within row_containing_name("Apples") do
|
||||
fill_in "Name", with: "Pommes"
|
||||
end
|
||||
|
||||
# Meanwhile, the SKU was updated
|
||||
product_a.update! sku: "APL-10"
|
||||
|
||||
expect {
|
||||
click_button "Discard changes"
|
||||
product_a.reload
|
||||
}.to_not change { product_a.name }
|
||||
|
||||
within row_containing_name("Apples") do
|
||||
expect(page).to have_field "Name", with: "Apples" # Changed value wasn't saved
|
||||
expect(page).to have_field "SKU", with: "APL-10" # Updated value shown
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def expect_page_to_be(page_number)
|
||||
|
||||
Reference in New Issue
Block a user