File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
app/javascript/backend/solidus_promotions/web_components
spec/system/solidus_promotions/backend Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,12 @@ $.fn.optionValueAutocomplete = function (options) {
4545
4646class OptionValuePicker extends HTMLInputElement {
4747 connectedCallback ( ) {
48- $ ( this ) . optionValueAutocomplete ( ) ;
48+ const container = this . closest ( ".promo-condition-option-value" ) ;
49+ const productPicker = container . querySelector ( 'input[is="product-picker"]' ) ;
50+
51+ $ ( this ) . optionValueAutocomplete ( {
52+ productSelect : productPicker ,
53+ } ) ;
4954 }
5055}
5156
Original file line number Diff line number Diff line change 161161 expect ( page ) . to have_content ( "Benefit has been successfully removed!" )
162162 end
163163 end
164+
165+ describe "Adding a benefit condition" do
166+ let! ( :promotion_with_benefit ) { create ( :solidus_promotion , :with_adjustable_benefit ) }
167+ let! ( :product ) { create ( :product ) }
168+ let! ( :option_value ) { create ( :option_value ) }
169+ let! ( :variant ) { create ( :variant , product : product , option_values : [ option_value ] ) }
170+
171+ it "allows adding a line_item_with_options condition" , :js do
172+ visit solidus_promotions . edit_admin_promotion_path ( promotion_with_benefit )
173+ click_link "Add Condition"
174+ select ( "Line Item Option Value(s)" , from : "Condition Type" )
175+ click_button "Add"
176+ expect ( page ) . to have_content ( "Line Item Option Value(s)" )
177+ click_link "Add product"
178+ within ( ".promo-condition-option-value" ) do
179+ # find('.select2-focusser').set(product.name)
180+ # find('.select2-input').set(option_value.name)
181+ end
182+ within ( "#benefits_adjust_line_item_#{ promotion_with_benefit . benefits . first . id } _conditions" ) do
183+ find ( 'input[type="submit"]' , wait : 5 ) . click
184+ end
185+ end
186+ end
164187end
You can’t perform that action at this time.
0 commit comments