From 500cf925ad57f790fe661c60da4e8db7d43e5828 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Tue, 2 Apr 2019 16:50:44 +1100 Subject: [PATCH] Fix HTML validity and element finding in spec The fixed partial was used twice on the same page. So the used element id appeared twice on the page which is invalid HTML. It also confused the spec. Now we look at the actually displayed text to select the correct element. --- app/views/spree/admin/orders/_form/_adjustments.html.haml | 2 +- spec/features/admin/orders_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/spree/admin/orders/_form/_adjustments.html.haml b/app/views/spree/admin/orders/_form/_adjustments.html.haml index e88819b1ac..8dfb0c37c5 100644 --- a/app/views/spree/admin/orders/_form/_adjustments.html.haml +++ b/app/views/spree/admin/orders/_form/_adjustments.html.haml @@ -6,7 +6,7 @@ %tr %th= Spree.t('name') %th= Spree.t('amount') - %tbody#order-charges.with-border + %tbody.with-border - adjustments.each do |adjustment| - if (adjustment.originator_type != 'Spree::ShippingMethod') && !(adjustment.originator_type == 'Spree::TaxRate' && adjustment.amount == 0) %tr.total diff --git a/spec/features/admin/orders_spec.rb b/spec/features/admin/orders_spec.rb index dc8b654be8..8d387b2678 100644 --- a/spec/features/admin/orders_spec.rb +++ b/spec/features/admin/orders_spec.rb @@ -267,7 +267,7 @@ feature %q{ end scenario "shows the order tax adjustments" do - within('tbody#order-charges') do + within('fieldset', text: 'LINE ITEM ADJUSTMENTS') do expect(page).to have_selector "td", match: :first, text: "Tax 1" expect(page).to have_selector "td.total", text: Spree::Money.new(10) end