mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-06 02:51:34 +00:00
WIP Add hub and order cycle display stub with failing tests
This commit is contained in:
@@ -65,8 +65,15 @@ nav#filters {
|
||||
}
|
||||
|
||||
|
||||
/* Distributor / order cycle selection */
|
||||
/* Distributor and order cycle selection and display */
|
||||
#distribution-choice {
|
||||
margin-bottom: 2em;
|
||||
padding: 5px;
|
||||
border: 2px solid #ccc;
|
||||
@include border-radius(10px);
|
||||
}
|
||||
|
||||
#distribution-selection {
|
||||
overflow: auto;
|
||||
margin-bottom: 2em;
|
||||
padding: 5px;
|
||||
|
||||
1
app/views/order_cycles/_choice.html.haml
Normal file
1
app/views/order_cycles/_choice.html.haml
Normal file
@@ -0,0 +1 @@
|
||||
#distribution-choice You have not yet picked where you will get your order from.
|
||||
@@ -1,7 +1,7 @@
|
||||
<%# When written in HAML, dynamic attributes (ie. (class="order-cycle-#{foo}")) were failing to parse.
|
||||
Regrettably rewritten in ERB. Fix me! %>
|
||||
|
||||
<div id="distribution-choice">
|
||||
<div id="distribution-selection">
|
||||
<%= form_for current_order(true) do |f| %>
|
||||
<div class="distributors">
|
||||
<h2>Active Hubs</h2>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
= render :partial => 'order_cycles/choice'
|
||||
= render :partial => 'spree/shared/taxonomies'
|
||||
= render :partial => 'spree/shared/filters'
|
||||
= render :partial => 'spree/products/source_sidebar'
|
||||
|
||||
@@ -26,8 +26,8 @@ feature %q{
|
||||
visit spree.products_path
|
||||
|
||||
# Then I should see a choice of hubs
|
||||
page.should have_selector "#distribution-choice option[value='#{@d1.id}']", text: @d1.name
|
||||
page.should have_selector "#distribution-choice option[value='#{@d2.id}']", text: @d2.name
|
||||
page.should have_selector "#distribution-selection option[value='#{@d1.id}']", text: @d1.name
|
||||
page.should have_selector "#distribution-selection option[value='#{@d2.id}']", text: @d2.name
|
||||
|
||||
# And I should see a choice of order cycles with closing times
|
||||
[{oc: @oc1, closing: '7 days'}, {oc: @oc2, closing: '2 days'}].each do |data|
|
||||
@@ -36,6 +36,9 @@ feature %q{
|
||||
page.should have_content data[:closing]
|
||||
end
|
||||
end
|
||||
|
||||
# And I should see an indication of my current choices
|
||||
page.should have_selector "#distribution-choice", text: 'You have not yet picked where you will get your order from.'
|
||||
end
|
||||
|
||||
context "without javascript" do
|
||||
@@ -49,7 +52,8 @@ feature %q{
|
||||
|
||||
# Then associated order cycles should be highlighted
|
||||
page.should have_content "Your hub has been selected."
|
||||
within '#distribution-choice' do
|
||||
page.should have_selector '#distribution-choice', text: "Hub: #{@d1.name}"
|
||||
within "#distribution-selection" do
|
||||
page.should have_selector "tr.order-cycle-#{@oc1.id}.local"
|
||||
page.should have_selector "tr.order-cycle-#{@oc2.id}.remote"
|
||||
end
|
||||
@@ -59,7 +63,9 @@ feature %q{
|
||||
click_button 'Choose Hub'
|
||||
|
||||
# Then associated order cycles should be highlighted
|
||||
within '#distribution-choice' do
|
||||
page.should have_content "Your hub has been selected."
|
||||
page.should have_selector '#distribution-choice', text: "Hub: #{@d2.name}"
|
||||
within '#distribution-selection' do
|
||||
page.should have_selector "tr.order-cycle-#{@oc1.id}.remote"
|
||||
page.should have_selector "tr.order-cycle-#{@oc2.id}.local"
|
||||
end
|
||||
@@ -75,7 +81,8 @@ feature %q{
|
||||
|
||||
# Then the associated distributor should be highlighted
|
||||
page.should have_content "Your order cycle has been selected."
|
||||
within '#distribution-choice' do
|
||||
page.should have_selector '#distribution-choice', text: "Order Cycle: #{@oc1.name}"
|
||||
within '#distribution-selection' do
|
||||
page.should have_selector "option.local[value='#{@d1.id}']"
|
||||
page.should have_selector "option.remote[value='#{@d2.id}']"
|
||||
end
|
||||
@@ -86,7 +93,8 @@ feature %q{
|
||||
|
||||
# Then the associated distributor should be highlighted
|
||||
page.should have_content "Your order cycle has been selected."
|
||||
within '#distribution-choice' do
|
||||
page.should have_selector '#distribution-choice', text: "Order Cycle: #{@oc2.name}"
|
||||
within '#distribution-selection' do
|
||||
page.should have_selector "option.remote[value='#{@d1.id}']"
|
||||
page.should have_selector "option.local[value='#{@d2.id}']"
|
||||
end
|
||||
@@ -137,6 +145,11 @@ feature %q{
|
||||
click_button 'Choose Hub'
|
||||
|
||||
# Then my order cycle and distributor should be set
|
||||
within '#distribution-choice' do
|
||||
page.should have_content "Hub: #{@d1.name}"
|
||||
page.should have_content "Order Cycle: #{@oc1.name}"
|
||||
end
|
||||
|
||||
page.should have_selector "input[value='#{@oc1.id}'][checked='checked']"
|
||||
page.should have_selector "option[value='#{@d1.id}'][selected='selected']"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user