mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-02 02:11:33 +00:00
Add display_name and display_as to admin edit variant page
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
/ insert_top "[data-hook='variants']"
|
||||
|
||||
.field
|
||||
= f.label :display_name, t(:display_name)
|
||||
= f.text_field :display_name, class: "fullwidth"
|
||||
.field
|
||||
= f.label :display_as, t(:display_as)
|
||||
= f.text_field :display_as, class: "fullwidth"
|
||||
@@ -118,4 +118,29 @@ feature %q{
|
||||
v.reload
|
||||
v.deleted_at.should_not be_nil
|
||||
end
|
||||
|
||||
scenario "editing display name for a variant", js:true do
|
||||
p = create(:simple_product)
|
||||
v = p.variants.first
|
||||
|
||||
# When I view the variant
|
||||
login_to_admin_section
|
||||
visit spree.admin_product_variants_path p
|
||||
page.find('table.index .icon-edit').click
|
||||
|
||||
# It should allow the display name to be changed
|
||||
page.should have_field "variant_display_name"
|
||||
page.should have_field "variant_display_as"
|
||||
|
||||
# When I update the fields and save the variant
|
||||
fill_in "variant_display_name", with: "Display Name"
|
||||
fill_in "variant_display_as", with: "Display As This"
|
||||
click_button 'Update'
|
||||
page.should have_content %Q(Variant "#{p.name}" has been successfully updated!)
|
||||
|
||||
# Then the displayed values should have been saved
|
||||
v.reload
|
||||
v.display_name.should == "Display Name"
|
||||
v.display_as.should == "Display As This"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user