Shipping method: disabled form element to not submit them

As they're not handled by the backend
This commit is contained in:
Jean-Baptiste Bellet
2022-04-19 15:16:07 +02:00
parent 4b629eae11
commit e607d5c161
2 changed files with 14 additions and 2 deletions

View File

@@ -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);
}
});
})

View File

@@ -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