mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-04 07:09:14 +00:00
Shipping method: disabled form element to not submit them
As they're not handled by the backend
This commit is contained in:
@@ -7,11 +7,11 @@ $(function() {
|
||||
if (calculator_select.val() === original_calc_type) {
|
||||
$('div.calculator-settings').show();
|
||||
$('.calculator-settings-warning').hide();
|
||||
$('.calculator-settings').find('input,textarea').prop("disabled", false);
|
||||
$('.calculator-settings').find('input,textarea,select').prop("disabled", false);
|
||||
} else {
|
||||
$('div.calculator-settings').hide();
|
||||
$('.calculator-settings-warning').show();
|
||||
$('.calculator-settings').find('input,textarea').prop("disabled", true);
|
||||
$('.calculator-settings').find('input,textarea,select').prop("disabled", true);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
@@ -71,6 +71,18 @@ describe 'shipping methods' do
|
||||
expect(page).to have_field "shipping_method_distributor_ids_#{distributor2.id}",
|
||||
checked: false
|
||||
end
|
||||
|
||||
it "handle when updating calculator type for Weight to Flat Rate" do
|
||||
visit spree.edit_admin_shipping_method_path(@shipping_method)
|
||||
|
||||
select2_select 'Weight (per kg or lb)', from: 'calc_type'
|
||||
click_button 'Update'
|
||||
|
||||
select2_select 'Flat Rate (per item)', from: 'calc_type'
|
||||
click_button 'Update'
|
||||
|
||||
expect(@shipping_method.reload.calculator_type).to eq("Calculator::PerItem")
|
||||
end
|
||||
end
|
||||
|
||||
context "as an enterprise user", js: true do
|
||||
|
||||
Reference in New Issue
Block a user