Merge pull request #5892 from consuldemocracy/html_indentation

Add a linter to check indentation in ERB+HTML files
This commit is contained in:
Javi Martín
2025-03-07 17:17:30 +01:00
committed by GitHub
97 changed files with 897 additions and 983 deletions

View File

@@ -21,6 +21,8 @@ jobs:
run: npx stylelint app/assets/stylesheets
- name: Markdownlint
run: bundle exec mdl *.md docs/
- name: HTML Beautifier
run: find app/ -name "*.html.erb" -exec bundle exec htmlbeautifier --lint-only --keep-blank-lines 1 -e {} +
name: ${{ matrix.name }}
steps:
- name: Checkout code

View File

@@ -95,6 +95,7 @@ group :development do
gem "capistrano3-puma", "~> 5.2.0"
gem "erb_lint", "~> 0.9.0", require: false
gem "faraday-retry", "~> 2.2.1", require: false
gem "htmlbeautifier", "~> 1.4.3", require: false
gem "mdl", "~> 0.13.0", require: false
gem "pronto", "~> 0.11.2", require: false
gem "pronto-erb_lint", "~> 0.1.6", require: false

View File

@@ -272,6 +272,7 @@ GEM
hashery (2.1.2)
hashie (5.0.0)
highline (2.0.3)
htmlbeautifier (1.4.3)
htmlentities (4.3.4)
httparty (0.22.0)
csv
@@ -755,6 +756,7 @@ DEPENDENCIES
graphiql-rails (~> 1.8.0)
graphql (~> 2.3.18)
groupdate (~> 6.5.1)
htmlbeautifier (~> 1.4.3)
i18n-tasks (~> 0.9.37)
image_processing (~> 1.13.0)
invisible_captcha (~> 2.3.0)

View File

@@ -812,7 +812,6 @@
.proposal h3 {
font-size: rem-calc(20);
margin-top: 0;
}
}

View File

@@ -88,15 +88,6 @@
}
}
.supports-container {
border-top: 1px solid $border;
@include breakpoint(medium) {
border-left: 1px solid $border;
border-top: 0;
}
}
.participation-not-allowed {
background: $warning-bg;
color: $color-warning;
@@ -394,41 +385,53 @@
@include breakpoint(medium) {
min-height: $line-height * 15;
.with-image > .row {
display: flex;
}
}
}
.budget-investments-list .budget-investment,
.proposals-list .proposal,
.legislation-proposals .proposal {
@include breakpoint(medium) {
.debates-list,
.proposals-list,
.budget-investments-list,
.legislation-proposals {
.panel {
column-gap: calc(rem-calc(map-get($grid-column-gutter, medium)) * 3 / 4);
display: flex;
flex-wrap: wrap;
> * {
flex-grow: 1;
}
&.with-image {
padding: 0 calc($line-height / 2) 0 0;
}
}
padding-bottom: 0;
padding-top: 0;
.column:first-child {
overflow: hidden;
}
.panel-image {
margin-#{$global-left}: rem-calc(-12);
text-align: center;
.column:nth-child(2) {
float: left;
}
.column:last-child:not(:first-child) {
~ * {
padding-top: calc($line-height / 2);
}
}
img {
height: 100%;
max-width: 12rem;
}
}
.debate-content,
.budget-investment-content,
.proposal-content {
flex-basis: calc((35rem - 100%) * 999);
flex-grow: 1000;
max-width: 50rem;
+ * {
flex-basis: 22.5%;
flex-shrink: 0;
text-align: center;
}
}
}
}
@@ -592,27 +595,19 @@
.legislation-proposals {
.votes {
border-top: 1px solid $border;
margin-top: $line-height;
padding: calc($line-height / 2) 0;
position: relative;
@include breakpoint(medium) {
border-left: 1px solid $border;
border-top: 0;
margin-top: 0;
text-align: center;
}
.total-votes {
float: right;
display: block;
font-weight: bold;
line-height: $line-height * 2;
@include breakpoint(medium) {
display: block;
float: none;
}
}
}
}
@@ -624,12 +619,6 @@
}
}
.proposal-show .votes,
.debate-show .votes {
border: 0;
padding: calc($line-height / 2) 0;
}
.proposal,
.budget-investment {

View File

@@ -1,9 +1,5 @@
.in-favor-against {
@include flex-with-gap($line-height * 0.25);
@include breakpoint(medium) {
@include flex-with-gap($line-height * 0.75);
}
&,
.in-favor,
@@ -77,16 +73,8 @@
}
.percentage {
display: inline-block;
font-size: $small-font-size;
line-height: $line-height * 2;
padding-right: calc($line-height / 2);
vertical-align: top;
@include breakpoint(medium) {
display: block;
font-size: $small-font-size;
line-height: $line-height;
padding-right: 0;
}
}
}

View File

@@ -8,7 +8,8 @@
<div class="small-12 medium-3 column highlight padding">
<strong><%= t("admin.poll_shifts.new.officer") %></strong>
<br><%= officer.name %>
<br>
<%= officer.name %>
<%= f.hidden_field :officer_id, value: officer.id %>
</div>

View File

@@ -30,7 +30,9 @@
<table class="investment-projects-summary">
<thead>
<tr><th colspan="2"><%= t("admin.stats.budget_balloting.votes_per_heading") %></th></tr>
<tr>
<th colspan="2"><%= t("admin.stats.budget_balloting.votes_per_heading") %></th>
</tr>
</thead>
<tbody>
@@ -49,7 +51,9 @@
<table class="investment-projects-summary user-count-by-heading">
<thead>
<tr><th colspan="2"><%= t("admin.stats.budget_balloting.participants_per_district") %></th></tr>
<tr>
<th colspan="2"><%= t("admin.stats.budget_balloting.participants_per_district") %></th>
</tr>
</thead>
<tbody>

View File

@@ -1,5 +1,6 @@
<div class="small-12 medium-4 column">
<%= tag.p(**options) do %>
<%= text %> <br><span class="number"><%= amount %></span>
<%= text %> <br>
<span class="number"><%= amount %></span>
<% end %>
</div>

View File

@@ -24,7 +24,9 @@
</div>
<div class="small-12 column">
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
<div class="progress-bar-placeholder">
<div class="loading-bar"></div>
</div>
</div>
<hr>

View File

@@ -9,7 +9,7 @@
</h2>
<p class="confirmed">
<%= t("budgets.ballots.show.voted_info") %>
<p>
</p>
<p><%= t("budgets.ballots.show.voted_info_2") %></p>
</div>
</header>

View File

@@ -1,9 +1,4 @@
<% if budget.image.present? %>
<div class="budget-header with-background-image"
style="<%= attached_background_css polymorphic_path(budget.image.variant(:large)) %>">
<% else %>
<div class="budget-header">
<% end %>
<div <%= tag.attributes(html_attributes) %>>
<div class="row">
<div class="small-12 column text-center">
<span class="budget-title"><%= t("budgets.index.title") %></span>

View File

@@ -5,4 +5,17 @@ class Budgets::BudgetComponent < ApplicationComponent
def initialize(budget)
@budget = budget
end
private
def html_attributes
if budget.image.present?
{
class: "budget-header with-background-image",
style: attached_background_css(polymorphic_path(budget.image.variant(:large)))
}
else
{ class: "budget-header" }
end
end
end

View File

@@ -13,7 +13,8 @@
<h1>
<%= link_to namespace_path do %>
<%= setting["org_name"] %>
<br><small><%= namespaced_header_title %></small>
<br>
<small><%= namespaced_header_title %></small>
<% end %>
</h1>

View File

@@ -9,7 +9,7 @@
<span aria-hidden="true">&times;</span>
</button>
</header>
<p><%= t("cookies_management.description") %><p>
<p><%= t("cookies_management.description") %></p>
<% if more_info_link.present? %>
<p><%= link_to t("cookies_consent.more_info_link"), more_info_link, target: "_blank" %></p>
<% end %>

View File

@@ -47,9 +47,7 @@
</p>
<% option.videos.each do |video| %>
<%= link_to video.title,
video.url,
rel: "nofollow" %><br>
<%= link_to video.title, video.url, rel: "nofollow" %><br>
<% end %>
</div>
<% end %>

View File

@@ -17,8 +17,8 @@
<% else %>
<dl>
<% targets.sort.each do |target| %>
<dt><%= target.code %><dt>
<dd><%= target.long_title %><dd>
<dt><%= target.code %></dt>
<dd><%= target.long_title %></dd>
<% end %>
</dl>
<% end %>

View File

@@ -18,13 +18,13 @@ module LegislationHelper
}
end
def banner_color?
@process.background_color.present? && @process.font_color.present?
def banner_color?(process)
process.background_color.present? && process.font_color.present?
end
def css_for_process_header
if banner_color?
"background: #{@process.background_color};color: #{@process.font_color};"
def css_for_process_header(process)
if banner_color?(process)
"background: #{process.background_color};color: #{process.font_color};"
end
end
end

View File

@@ -64,22 +64,6 @@ module ProposalsHelper
proposals_current_view == "default" ? "minimal" : "default"
end
def css_for_proposal_info_row(proposal)
if proposal.image.present?
if params[:selected].present?
"small-12 medium-9 column"
else
"small-12 medium-6 large-7 column"
end
else
if params[:selected].present?
"small-12 column"
else
"small-12 medium-9 column"
end
end
end
def show_proposal_votes?
params[:selected].blank?
end

View File

@@ -44,6 +44,7 @@
<br>
<%= sanitize(activity.actionable.description) %>
<% end %>
</td>
<td class="align-top">
<%= activity.user.name %> (<%= activity.user.email %>)
</td>

View File

@@ -22,6 +22,7 @@
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="callout alert margin">

View File

@@ -37,7 +37,7 @@
</tr>
<% end %>
</tbody>
<table>
</table>
<% else %>
<div class="callout primary">
<%= t("admin.documents.index.no_documents") %>

View File

@@ -56,7 +56,9 @@
<div class="small-12 medium-3 column">
<p class="featured">
<%= t "admin.stats.show.summary.proposal_votes" %> <br>
<span class="number"><%= number_with_delimiter(@proposal_votes) %> <br></span>
<span class="number">
<%= number_with_delimiter(@proposal_votes) %> <br>
</span>
</p>
<p>
<%= t "admin.stats.show.summary.debate_votes" %> <br>

View File

@@ -2,19 +2,12 @@
<div class="panel <%= ("with-image" if feature?(:allow_images) && investment.image.present?) %>">
<% if feature?(:allow_images) && investment.image.present? %>
<div class="row">
<div class="small-12 medium-3 large-2 column text-center">
<div class="panel-image">
<%= image_tag investment.image.variant(:thumb), alt: investment.image.title.unicode_normalize %>
</div>
<div class="small-12 medium-6 large-7 column">
<% else %>
<div class="row">
<div class="small-12 medium-9 column">
<% end %>
<div class="budget-investment-content">
<div class="budget-investment-content">
<% cache [locale_and_user_status(investment), "index", investment, investment.author] do %>
<h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3>
@@ -27,18 +20,14 @@
<%= render "shared/tags", taggable: investment, limit: 5 %>
<% end %>
</div>
</div>
<% unless investment.unfeasible? %>
<% if investment.should_show_votes? %>
<div id="<%= dom_id(investment) %>_votes"
class="small-12 medium-3 column text-center">
<div id="<%= dom_id(investment) %>_votes">
<%= render Budgets::Investments::VotesComponent.new(investment) %>
</div>
<% elsif investment.should_show_vote_count? %>
<div id="<%= dom_id(investment) %>_votes"
class="small-12 medium-3 column text-center">
<div id="<%= dom_id(investment) %>_votes">
<div class="supports">
<span class="total-supports no-button">
<%= t("budgets.investments.investment.supports",
@@ -47,16 +36,14 @@
</div>
</div>
<% elsif investment.should_show_ballots? && !management_controller? %>
<div id="<%= dom_id(investment) %>_ballot"
class="small-12 medium-3 column text-center">
<div id="<%= dom_id(investment) %>_ballot">
<%= render "/budgets/investments/ballot",
investment: investment,
investment_ids: investment_ids,
ballot: ballot %>
</div>
<% elsif investment.should_show_price? %>
<div id="<%= dom_id(investment) %>_price"
class="supports small-12 medium-3 column text-center">
<div id="<%= dom_id(investment) %>_price" class="supports">
<div class="supports">
<span class="total-supports no-button">
<%= investment.formatted_price %>
@@ -67,4 +54,3 @@
<% end %>
</div>
</div>
</div>

View File

@@ -1,7 +1,5 @@
<div id="<%= dom_id(investment) %>" class="budget-investment minimal clear">
<div class="panel">
<div class="row">
<div class="small-12 column">
<div class="budget-investment-content">
<% cache [locale_and_user_status(investment), "index_minimal", investment, investment.author] do %>
<h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3>
@@ -9,5 +7,3 @@
</div>
</div>
</div>
</div>
</div>

View File

@@ -1,9 +1,6 @@
<% cache [locale_and_user_status, debate, current_user&.voted_as_when_voted_for(debate)] do %>
<div id="<%= dom_id(debate) %>" class="debate clear" data-type="debate">
<div class="panel">
<div class="row">
<div class="small-12 medium-9 column">
<div class="debate-content">
<h3><%= link_to debate.title, debate %></h3>
<p class="debate-info">
@@ -46,13 +43,10 @@
</div>
<%= render "shared/tags", taggable: debate, limit: 5 %>
</div>
</div>
<div id="<%= dom_id(debate) %>_votes" class="small-12 medium-3 column">
<div id="<%= dom_id(debate) %>_votes">
<%= render Debates::VotesComponent.new(debate) %>
</div>
</div>
</div>
</div>
<% end %>

View File

@@ -1,7 +1,5 @@
<div id="<%= dom_id(debate) %>" class="debate minimal clear" data-type="debate">
<div class="panel">
<div class="row">
<div class="small-12 column">
<div class="debate-content">
<% cache [locale_and_user_status,
"index_minimal", debate, current_user&.voted_as_when_voted_for(debate)] do %>
@@ -10,5 +8,3 @@
</div>
</div>
</div>
</div>
</div>

View File

@@ -69,7 +69,6 @@
<p><%= t("debates.index.section_footer.help_text_1") %></p>
<p><%= sanitize(t("debates.index.section_footer.help_text_2",
org: link_to(setting["org_name"], new_user_registration_path))) %></p>
</p>
</div>
<% end %>
</div>

View File

@@ -2,9 +2,9 @@
<%= form_for(resource, as: resource_name, url: [resource_name, :password_expired], html: { method: :put }) do |f| %>
<%= f.password_field :current_password %></p>
<%= f.password_field :password, label: t("devise.password_expired.new_password") %></p>
<%= f.password_field :password_confirmation %></p>
<%= f.password_field :current_password %>
<%= f.password_field :password, label: t("devise.password_expired.new_password") %>
<%= f.password_field :password_confirmation %>
<p><%= f.submit t("devise.password_expired.change_password") %></p>
<% end %>

View File

@@ -3,20 +3,6 @@
<%= link_to t("devise_views.shared.links.login"), new_session_path(resource_name) %><br>
<% end -%>
<%#- if devise_mapping.registerable? &&
controller_name != "registrations" ||
controller_path != "users/registrations" %>
<%#= link_to t("devise_views.shared.links.signup"), new_user_registration_path %><!-- <br> -->
<%# end -%>
<%#- if devise_mapping.registerable? && controller_name == "registrations" && controller_path != "organizations/registrations" %>
<%#= link_to t("devise_views.shared.links.organization_signup"), new_organization_registration_path %>
<%# end -%>
<%#- if devise_mapping.recoverable? && controller_name != "passwords" && controller_name != "registrations" %>
<%#= link_to t("devise_views.shared.links.new_password"), new_password_path(resource_name) %><!-- <br> -->
<%# end -%>
<%- if devise_mapping.confirmable? && controller_name != "confirmations" %>
<%= link_to t("devise_views.shared.links.new_confirmation"), new_confirmation_path(resource_name) %><br>
<% end -%>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html <%= common_html_attributes %>>
<html <%= common_html_attributes %> id="mailer_layout">
<head>
<title><%= t("mailers.title") %></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

View File

@@ -2,4 +2,4 @@
<span id="annotation-link" data-sub-annotation-ids="8">
<%= render "annotation_link", annotation: annotation %>
<span>
</span>

View File

@@ -58,14 +58,14 @@
<div><span class="panel-title"><%= t("legislation.draft_versions.show.text_body") %></span></div>
</div>
<div id="sticky-panel" class="draft-text">
<% if @draft_version.final_version? %>
<section>
<% else %>
<section class="legislation-annotatable"
data-legislation-draft-version-id="<%= @draft_version.id %>"
data-legislation-annotatable-base-url="<%= legislation_process_draft_version_path(@process, @draft_version) %>"
data-legislation-open-phase="<%= @process.allegations_phase.open? %>">
<% end %>
<section <%= tag.attributes(
class: "legislation-annotatable",
data: {
"legislation-draft-version-id": @draft_version.id,
"legislation-annotatable-base-url": legislation_process_draft_version_path(@process, @draft_version),
"legislation-open-phase": @process.allegations_phase.open?
}
) unless @draft_version.final_version? %>>
<%= AdminLegislationSanitizer.new.sanitize(@draft_version.body_html) %>
</section>
</div>

View File

@@ -1,8 +1,8 @@
<div class="legislation-hero jumbo" style="<%= css_for_process_header %>">
<div class="legislation-hero jumbo" style="<%= css_for_process_header(@process) %>">
<div class="row">
<div class="small-12 medium-9 column">
<% if banner_color? %>
<% if banner_color?(@process) %>
<%= link_to t("shared.back"),
legislation_processes_path,
class: "icon-angle-left",

View File

@@ -12,10 +12,7 @@
<%= markdown @process.additional_info if @process.additional_info %>
</div>
<button type="button" class="button" data-toggle="additional_info"
<% if banner_color? %>
style="background:<%= process.font_color %>; color:<%= process.background_color %>;"
<% end %>>
<button type="button" class="button" data-toggle="additional_info" style="<%= css_for_process_header(process) %>">
<%= t("legislation.processes.header.additional_info") %>
</button>
<% end %>

View File

@@ -2,19 +2,17 @@
class="proposal clear <%= ("successful" if proposal.total_votes > Proposal.votes_needed_for_success) %>"
data-type="proposal">
<div class="panel <%= ("with-image" if proposal.image.present?) %>">
<% if proposal.total_votes > Proposal.votes_needed_for_success %>
<div class="icon-successful"></div>
<% end %>
<% if proposal.image.present? %>
<div class="row">
<div class="small-12 medium-3 large-2 column text-center">
<div class="panel-image">
<%= image_tag proposal.image.variant(:thumb),
alt: proposal.image.title.unicode_normalize %>
</div>
<div class="small-12 medium-6 large-7 column margin-top">
<% else %>
<div class="row">
<div class="small-12 medium-9 column">
<% end %>
<div class="proposal-content">
<% cache [locale_and_user_status(proposal), "index", proposal, proposal.author] do %>
<h3><%= link_to proposal.title, legislation_process_proposal_path(proposal.legislation_process_id, proposal) %></h3>
@@ -69,11 +67,9 @@
<%= render "shared/tags", taggable: proposal, limit: 5 %>
<% end %>
</div>
</div>
<div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column">
<div id="<%= dom_id(proposal) %>_votes">
<%= render Legislation::Proposals::VotesComponent.new(proposal) %>
</div>
</div>
</div>
</div>

View File

@@ -13,14 +13,14 @@
<%= link_to legislation_process_question_path(@process, @question.next_question_id), class: "quiz-next-link" do %>
<div class="quiz-next">
<%= t("legislation.questions.show.next_question") %>
<span class="icon-angle-right" aria-hidden="true">
<span class="icon-angle-right" aria-hidden="true"></span>
</div>
<% end %>
<% elsif @question.first_question_id %>
<%= link_to legislation_process_question_path(@process, @question.first_question_id), class: "quiz-next-link" do %>
<div class="quiz-next">
<%= t("legislation.questions.show.first_question") %>
<span class="icon-angle-right" aria-hidden="true">
<span class="icon-angle-right" aria-hidden="true"></span>
</div>
<% end %>
<% end %>

View File

@@ -1,22 +1,18 @@
<div id="<%= dom_id(proposal) %>"
class="proposal clear
<%= ("successful" if proposal.total_votes > Proposal.votes_needed_for_success) %>"
class="proposal clear <%= ("successful" if proposal.successful?) %>"
data-type="proposal">
<div class="panel <%= "with-image" if proposal.image.present? %>">
<% if proposal.successful? %>
<div class="icon-successful"></div>
<% end %>
<% if proposal.image.present? %>
<div class="row">
<div class="small-12 medium-3 large-2 column text-center">
<div class="panel-image">
<%= image_tag proposal.image.variant(:thumb),
alt: proposal.image.title.unicode_normalize %>
</div>
<div class="<%= css_for_proposal_info_row(proposal) %>">
<% else %>
<div class="row">
<div class="<%= css_for_proposal_info_row(proposal) %>">
<% end %>
<div class="proposal-content">
<% cache [locale_and_user_status(proposal), "index", proposal, proposal.author] do %>
<h3><%= link_to proposal.title, namespaced_proposal_path(proposal) %></h3>
@@ -67,19 +63,17 @@
<%= render "shared/tags", taggable: proposal, limit: 5 %>
<% end %>
</div>
</div>
<% if show_proposal_votes? %>
<div id="<%= dom_id(proposal) %>_votes"
class="small-12 medium-3 column supports-container">
<div id="<%= dom_id(proposal) %>_votes" class="supports-container">
<% if proposal.successful? %>
<div class="padding">
<div class="supports text-center">
<div class="supports">
<%= render "proposals/supports", proposal: proposal %>
</div>
</div>
<% elsif proposal.archived? %>
<div class="padding text-center">
<div class="padding">
<strong><%= t("proposals.proposal.supports", count: proposal.total_votes) %></strong>
<p><%= t("proposals.proposal.archived") %></p>
</div>
@@ -88,7 +82,5 @@
<% end %>
</div>
<% end %>
</div>
</div>
</div>

View File

@@ -1,7 +1,5 @@
<div id="<%= dom_id(proposal) %>" class="proposal minimal clear" data-type="proposal">
<div class="panel">
<div class="row">
<div class="small-12 column">
<div class="proposal-content">
<% cache [locale_and_user_status(proposal),
"index_minimal", proposal, proposal.author] do %>
@@ -10,5 +8,3 @@
</div>
</div>
</div>
</div>
</div>

View File

@@ -8,12 +8,7 @@
<%= render "shared/canonical", href: proposals_url %>
<% end %>
<% if [
@search_terms,
@advanced_search_terms,
params[:retired].present?,
params[:selected].present?
].any? %>
<% if [@search_terms, @advanced_search_terms, params[:retired].present?, params[:selected].present?].any? %>
<%= render Shared::SearchResultsSummaryComponent.new(
results: @proposals,
search_terms: @search_terms,

View File

@@ -3,7 +3,9 @@
<% valid_filters.each do |filter| %>
<% if current_filter == filter %>
<li class="is-active"><h2><%= t("#{i18n_namespace}.filters.#{filter}") %></h2></li>
<li class="is-active">
<h2><%= t("#{i18n_namespace}.filters.#{filter}") %></h2>
</li>
<% else %>
<li><%= link_to t("#{i18n_namespace}.filters.#{filter}"),
current_path_with_query_params(filter: filter, page: 1) %></li>

View File

@@ -17,11 +17,6 @@
<hr>
<%= render "/budgets/investments/investment_detail", investment: @investment, preview: true %>
</hr>
<% if @investment.external_url.present? %>
<p><%= sanitize_and_auto_link @investment.external_url %></p>
<% end %>
<hr>

View File

@@ -15,15 +15,15 @@ describe Admin::Stats::SDG::GoalComponent do
render_inline component
expect(page).to have_text "Proposals 3"
expect(page).to have_text "Polls 2"
expect(page).to have_text "Debates 1"
expect(page).to have_text "Proposals 3", normalize_ws: true
expect(page).to have_text "Polls 2", normalize_ws: true
expect(page).to have_text "Debates 1", normalize_ws: true
expect("Current budget").to appear_before("Past year budget")
expect(page).to have_text "Investment projects sent 2"
expect(page).to have_text "Winner investment projects 0"
expect(page).to have_text "Approved amount $0"
expect(page).to have_text "Investment projects sent 1"
expect(page).to have_text "Winner investment projects 1"
expect(page).to have_text "Approved amount $1,000"
expect(page).to have_text "Investment projects sent 2", normalize_ws: true
expect(page).to have_text "Winner investment projects 0", normalize_ws: true
expect(page).to have_text "Approved amount $0", normalize_ws: true
expect(page).to have_text "Investment projects sent 1", normalize_ws: true
expect(page).to have_text "Winner investment projects 1", normalize_ws: true
expect(page).to have_text "Approved amount $1,000", normalize_ws: true
end
end

View File

@@ -9,23 +9,23 @@ describe LegislationHelper do
describe "banner colors presence" do
it "background and font color exist" do
@process = build(:legislation_process, background_color: "#944949", font_color: "#ffffff")
expect(banner_color?).to be true
process = build(:legislation_process, background_color: "#944949", font_color: "#ffffff")
expect(banner_color?(process)).to be true
end
it "background color exist and font color not exist" do
@process = build(:legislation_process, background_color: "#944949", font_color: "")
expect(banner_color?).to be false
process = build(:legislation_process, background_color: "#944949", font_color: "")
expect(banner_color?(process)).to be false
end
it "background color not exist and font color exist" do
@process = build(:legislation_process, background_color: "", font_color: "#944949")
expect(banner_color?).to be false
process = build(:legislation_process, background_color: "", font_color: "#944949")
expect(banner_color?(process)).to be false
end
it "background and font color not exist" do
@process = build(:legislation_process, background_color: "", font_color: "")
expect(banner_color?).to be false
process = build(:legislation_process, background_color: "", font_color: "")
expect(banner_color?(process)).to be false
end
end
end