Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi committed Aug 18, 2022
1 parent a411dc2 commit 27d7a41
Show file tree
Hide file tree
Showing 11 changed files with 26,505 additions and 1,931 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ $(() => {

let progressPosition = progressRef.getBoundingClientRect().bottom;
if (progressPosition > 0) {
progressFix.classList.remove(progressVisibleClass);
progressFix?.classList?.remove(progressVisibleClass);
} else {
progressFix.classList.add(progressVisibleClass);
progressFix?.classList?.add(progressVisibleClass);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

.mini-title{
display: block;

&__strong{
line-height: 1rem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="card extra">
<div class="card__content">
<h3><%= t(".date") %></h3>
<%= cell("decidim/date", { start: start_date, end: end_date, extra_classes: "extra__date-container--horizontal" }) %>
<%= cell("decidim/date_range", { start: start_date, end: end_date, extra_classes: "extra__date-container--horizontal" }) %>
</div>
</div>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,76 +1,97 @@
<div class="row column voting-rules">
<div class="callout warning">
<div class="row">
<div class="columns medium-8 large-9">
<h2 class="heading3">
<%= t(".rules.title") %>
</h2>
<ul>
<%= raw current_rule_explanation %>
</ul>
</div>
</div>
</div>
</div>
<div class="card budget-summary" data-progress-reference data-safe-url="<%= budget_url(budget) %>">
<div class="card__content">
<% if include_heading %>
<%= focus_mode(
title: translated_attribute(current_component.participatory_space.title),
url: Decidim::EngineRouter.main_proxy(current_component).root_path,
opener_button: false
) do %>

<% unless current_workflow.single? %>
<% project_detail = action_name == "show" %>
<% back_path = project_detail ? budget_path(budget) : Decidim::EngineRouter.main_proxy(current_component).root_path %>
<% back_title = project_detail ? t(".back_to_projects", budget_name: translated_attribute(budget.title)) : t(".back_to_budgets", component_name: translated_attribute(current_component.name)) %>

<p>
<%= link_to back_path, class: "muted-link" do %>
<%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
<%= back_title %>
<% end %>
</p>
<% end %>

<div class="card budget-summary" data-progress-reference data-safe-url="<%= budget_url(budget) %>">
<div class="card__content">
<% if current_order_checked_out? %>
<h2 class="heading3">
<h3 class="heading3">
<%= t(".checked_out.title") %>
<% unless current_workflow.single? %>
<small><%= translated_attribute(budget.title) %></small>
<% end %>
</h2>
</h3>
<p>
<%= raw t(".checked_out.description", cancel_link: link_to(t(".cancel_order"), budget_order_path(return_to: "budget"), method: :delete, class: "cancel-order", data: { confirm: t(".are_you_sure") })) %>
</p>
<% else %>
<h2 class="heading3">
<h3 class="heading3">
<% if current_workflow.single? %>
<%= t(".title") %>
<% else %>
<%= translated_attribute(budget.title) %>
<% end %>
</h2>
<p>
<%= raw current_rule_description %>
</p>
</h3>
<% end %>
<% end %>

<% if current_order.projects_rule? %>
<div class="budget-summary__total" data-total-allocation="<%= current_order.available_allocation %>">
<span class="mini-title"><%= t(".total_projects") %>
<strong class="mini-title__strong mini-title__strong--highlight">
<%= current_order.maximum_projects %>
</strong>
</span>
<div class="row column voting-rules">
<div class="callout warning">
<div class="row">
<div class="columns medium-8 large-9">
<h3 class="heading3">
<%= t(".rules.title") %>
</h3>
<ul>
<%= raw current_rule_explanation %>
</ul>
</div>
</div>
</div>
</div>
<% else %>
<div class="budget-summary__total" data-total-allocation="<%= current_order.available_allocation %>" data-total-budget="<%= budget.total_budget %>">
<span class="mini-title"><%= t(".total_budget") %>
<strong class="mini-title__strong mini-title__strong--highlight">
<%= budget_to_currency(budget.total_budget) %>
</strong>

<%= cell("decidim/budgets/budget_information_modal", budget) %>

<% if current_order.projects_rule? %>
<div class="budget-summary__total" data-total-allocation="<%= current_order.available_allocation %>">
<span class="mini-title"><%= t(".total_projects") %>
<strong class="mini-title__strong mini-title__strong--highlight">
<%= current_order.maximum_projects %>
</strong>
</span>
</div>
<% else %>
<div class="budget-summary__total" data-total-allocation="<%= current_order.available_allocation %>" data-total-budget="<%= budget.total_budget %>">
<span class="mini-title"><%= t(".total_budget") %>
<strong class="mini-title__strong mini-title__strong--highlight">
<%= budget_to_currency(budget.total_budget) %>
</strong>
</span>
</div>
<% end %>

<div>
<span class="mini-title mr-s">
<%= t(".assigned") %>
<%= render partial: "order_total_budget" %>
</span>
</div>
<% end %>

<%= render partial: "order_progress" %>
<span class="mini-title">
<%= t(".remaining") %>
<%= render partial: "order_remaining_budget" %>
</span>
</div>

<div>
<span class="mini-title">
<%= t(".assigned") %>
<%= render partial: "order_total_budget" %>
</span>
<%= render partial: "order_progress" %>
</div>

<%= cell("decidim/budgets/budget_information_modal", budget) %>
<%= render partial: "order_selected_projects" %>
</div>

<%= render partial: "order_selected_projects" %>
</div>

<%= render partial: "budget_excess" %>
<%= render partial: "budget_confirm" %>
<%= render partial: "budget_excess" %>
<%= render partial: "budget_confirm" %>
<% end %>
1 change: 1 addition & 0 deletions decidim-budgets/config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ ca:
projects_rule_maximum_only:
description: A quins projectes creus que hem de destinar el pressupost? Selecciona fins a %{maximum_number} projectes i vota segons les teves preferències per a definir el pressupost.
instruction: "<li>Selecciona fins a %{maximum_number} projectes i vota segons les teves preferències per a definir el pressupost.</li>"
remaining: 'Restant:'
rules:
title: Regles de votació
title: Tu decideixes el pressupost
Expand Down
1 change: 1 addition & 0 deletions decidim-budgets/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ en:
projects_rule_maximum_only:
description: What projects do you think we should allocate budget for? Select up to %{maximum_number} projects you want and vote according to your preferences to define the budget.
instruction: "<li>Select up to %{maximum_number} projects you want and vote according to your preferences to define the budget.</li>"
remaining: 'Remaining:'
rules:
title: Budget rules
title: You decide the budget
Expand Down
1 change: 1 addition & 0 deletions decidim-budgets/config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ es:
projects_rule_maximum_only:
description: '¿A qué proyectos crees que deberíamos destinar el presupuesto? Selecciona hasta %{maximum_number} y vota según tus preferencias para definir el presupuesto.'
instruction: "<li>Selecciona hasta %{maximum_number} proyectos que quieras y vota de acuerdo a tus preferencias para definir el presupuesto.</li>"
remaining: 'Restante:'
rules:
title: Reglas de presupuesto
title: Tú decides el presupuesto
Expand Down
25 changes: 13 additions & 12 deletions decidim-budgets/spec/system/orders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
context "when voting by percentage threshold" do
it "displays description messages" do
within ".budget-summary" do
expect(page).to have_content("You decide the budget\nWhat projects do you think we should allocate budget for? Assign at least €70,000,000 to the projects you want and vote according to your preferences to define the budget.")
expect(page).to have_content("You decide the budget\nBudget rules\nAssign at least €70,000,000 to the projects you want and vote according to your preferences to define the budget.")
end
end

Expand All @@ -74,7 +74,7 @@

it "displays description messages" do
within ".budget-summary" do
expect(page).to have_content("What projects do you think we should allocate budget for? Select at least 3 projects you want and vote according to your preferences to define the budget.")
expect(page).to have_content("You decide the budget\nBudget rules\nSelect at least 3 projects you want and vote according to your preferences to define the budget.")
end
end

Expand All @@ -96,7 +96,7 @@

it "displays description messages" do
within ".budget-summary" do
expect(page).to have_content("What projects do you think we should allocate budget for? Select up to 6 projects you want and vote according to your preferences to define the budget.")
expect(page).to have_content("You decide the budget\nBudget rules\nSelect up to 6 projects you want and vote according to your preferences to define the budget.")
end
end

Expand All @@ -117,7 +117,7 @@

it "displays description messages" do
within ".budget-summary" do
expect(page).to have_content("What projects do you think we should allocate budget for? Select at least 3 and up to 6 projects you want and vote according to your preferences to define the budget.")
expect(page).to have_content("You decide the budget\nBudget rules\nSelect at least 3 and up to 6 projects you want and vote according to your preferences to define the budget.")
end
end

Expand Down Expand Up @@ -187,7 +187,7 @@
end

within "#order-progress .budget-summary__progressbox" do
expect(page).to have_content "25%"
expect(page.find(".budget-progress__meter")[:style]).to match(/width: 25%/)
expect(page).to have_selector("button.small:disabled")
end
end
Expand Down Expand Up @@ -328,13 +328,14 @@
expect(page).to have_content "ASSIGNED: €25,000,000"
expect(page).to have_content "REMAINING: €75,000,000"

# Note that this is not a default alert box, this is the default browser
# prompt for verifying the page unload. Therefore, `dismiss_prompt` is
# used instead of `dismiss_confirm`.
dismiss_prompt do
page.find(".focus-mode__close").click
page.find(".logo-wrapper a").click
end
page.find(".focus-mode__close").click
page.find(".logo-wrapper a").click

expect(page).to have_content "You have not yet voted"

click_button "Return to voting"

expect(page).not_to have_content("You have not yet voted")

expect(page).to have_current_path budget_projects_path
end
Expand Down
2 changes: 1 addition & 1 deletion decidim-core/app/cells/decidim/focus_mode/show.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<div class="focus-mode__flash-messages mb-s"></div>
<% if opener_button %>
<button class="button small" data-focus-open>
<%= t(".focus_mode") %>
<%= t("decidim.focus_mode.focus_mode") %>
</button>
<% end %>
</div>
2 changes: 1 addition & 1 deletion decidim_app-design/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
"react-test-renderer": "^16.0.0",
"yaml-jest": "^1.0.5"
}
}
}
Loading

0 comments on commit 27d7a41

Please sign in to comment.