Skip to content

Commit

Permalink
Fix spec
Browse files Browse the repository at this point in the history
  • Loading branch information
pacodelaluna committed Dec 22, 2024
1 parent d90ca53 commit b40e8a1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 0 additions & 2 deletions app/views/admin/enterprises/form/_permalink.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
%span.unavailable.hidden{data: { "permalink-target": "unavailable" }}
= t('js.unavailable')
%i.icon-remove-sign
- unless @enterprise.sells == 'none'
.row
.three.columns.alpha
%label= t('.link_to_front')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
= f.radio_button :visible, "hidden", 'ng-model' => 'Enterprise.visible'
= f.label :visible, t('.hidden'), value: 'hidden'

= render partial: 'admin/enterprises/form/permalink'
= render partial: 'admin/enterprises/form/permalink'
20 changes: 11 additions & 9 deletions spec/system/admin/enterprises_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@

fill_in 'enterprise_name', with: 'Eaterprises'

accept_alert do
click_link "Admin Only"
end
accept_alert { click_link "Admin Only" }
choose 'Own'

accept_alert { click_link "Primary Details" }
fill_in 'enterprise_permalink', with: 'eaterprises-permalink'
expect(page).to have_selector '.available'
choose 'Own'

# Require login to view shopfront or for checkout
accept_alert do
Expand All @@ -119,34 +119,36 @@
fill_in_trix_editor 'enterprise_long_description',
with: 'This is an interesting long description'

# Check StimulusJs switching of sidebar elements
accept_alert do
click_link "Primary Details"
end

# Unchecking hides the Properties tab
accept_alert { click_link "Primary Details" }
uncheck 'enterprise_is_primary_producer'
accept_alert { click_link "Admin Only" }
choose 'None'
expect(page).not_to have_selector "[data-test=link_for_enterprise_fees]"
expect(page).not_to have_selector "[data-test=link_for_payment_methods]"
expect(page).not_to have_selector "[data-test=link_for_shipping_methods]"
expect(page).not_to have_selector "[data-test=link_for_properties]"
# Checking displays the Properties tab
accept_alert { click_link "Primary Details" }
check 'enterprise_is_primary_producer'
expect(page).to have_selector "[data-test=link_for_enterprise_fees]"
expect(page).not_to have_selector "[data-test=link_for_payment_methods]"
expect(page).not_to have_selector "[data-test=link_for_shipping_methods]"
expect(page).to have_selector "[data-test=link_for_properties]"
accept_alert { click_link "Primary Details" }
uncheck 'enterprise_is_primary_producer'
accept_alert { click_link "Admin Only" }
choose 'Own'
expect(page).to have_selector "[data-test=link_for_enterprise_fees]"
expect(page).to have_selector "[data-test=link_for_payment_methods]"
expect(page).to have_selector "[data-test=link_for_shipping_methods]"
accept_alert { click_link "Admin Only" }
choose 'Any'
expect(page).to have_selector "[data-test=link_for_enterprise_fees]"
expect(page).to have_selector "[data-test=link_for_payment_methods]"
expect(page).to have_selector "[data-test=link_for_shipping_methods]"

accept_alert { click_link "Primary Details" }
page.find("#enterprise_group_ids-ts-control").set(eg1.name)
page.find("#enterprise_group_ids-ts-dropdown .option.active").click

Expand Down

0 comments on commit b40e8a1

Please sign in to comment.