From b0f5d0170c51b5dc359c1876cc11994d96b609cc Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 18 Dec 2014 13:32:28 +1100 Subject: [PATCH] Spec that overridden price with fees appears in quick cart --- app/views/shared/menu/_cart.html.haml | 8 ++++---- .../features/consumer/shopping/variant_overrides_spec.rb | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/views/shared/menu/_cart.html.haml b/app/views/shared/menu/_cart.html.haml index 345365735b..74f9ee2b29 100644 --- a/app/views/shared/menu/_cart.html.haml +++ b/app/views/shared/menu/_cart.html.haml @@ -12,7 +12,7 @@ %h5 Your shopping cart %ul %li.product-cart{"ng-repeat" => "line_item in Cart.line_items_present()", - "ng-controller" => "LineItemCtrl"} + "ng-controller" => "LineItemCtrl", "id" => "cart-variant-{{ line_item.variant.id }}"} .row .columns.small-7 %small @@ -20,15 +20,15 @@ %em {{ line_item.variant.unit_to_display }} .columns.small-3.text-right %small - {{line_item.quantity}} + %span.quantity {{ line_item.quantity }} %i.ofn-i_009-close - {{ line_item.variant.price_with_fees | localizeCurrency }} + %span.price {{ line_item.variant.price_with_fees | localizeCurrency }} .columns.small-2 %small \= %strong - .right {{ line_item.variant.totalPrice() | localizeCurrency }} + .total-price.right {{ line_item.variant.totalPrice() | localizeCurrency }} %li.total-cart{"ng-show" => "Cart.line_items_present().length > 0"} .row diff --git a/spec/features/consumer/shopping/variant_overrides_spec.rb b/spec/features/consumer/shopping/variant_overrides_spec.rb index cda3b0f8ea..727bc5700e 100644 --- a/spec/features/consumer/shopping/variant_overrides_spec.rb +++ b/spec/features/consumer/shopping/variant_overrides_spec.rb @@ -54,7 +54,14 @@ feature "shopping with variant overrides defined", js: true do page.should have_selector 'li.total div', text: '= $61.11' end - it "shows the overridden price with fees in the quick cart" + it "shows the overridden price with fees in the quick cart" do + fill_in "variants[#{v1.id}]", with: "2" + show_cart + page.should have_selector "#cart-variant-#{v1.id} .quantity", text: '2' + page.should have_selector "#cart-variant-#{v1.id} .price", text: '61.11' + page.should have_selector "#cart-variant-#{v1.id} .total-price", text: '122.22' + end + it "shows the correct prices in the shopping cart" it "shows the correct prices in the checkout" it "creates the order with the correct prices"