Use a <main> tag on every page

Many pages had this tag, but many other didn't, which made navigation
inconsistent for people using screen readers.

Note that there are slight changes in two pages:

* The homepage now includes the banner and the content of the
  `shared/header` element inside the <main> tag
* The budgets index now includes the banner inside the <main> tag

I see both potential advantages and disadvantages of this approach,
since banners aren't necessarily related to the main content of a page
but on the other hand they aren't the same across pages and people using
screen readers might accidentally skip them if they jump to the <main>
tag.

So I'm choosing the option that is easier to implement.

Note we're adding a `public-content` class to the <main> element in the
application layout. This might be redundat because the element could
already be accessed through the `.public main` selector, but this is
consistent with the `admin-content` class used in the admin section, and
without it the <main> element would sometimes have an empty class
attribute and we'd have to use `if content_for?(:main_class)` or
`tag.main` which IMHO makes the code less consistent.

The Capybara::DSL monkey-patch is only done on the `visit` method
because it's the only reliable one. Other methods like `click_link`
generate AJAX requests, so `expect(page).to have_css "main", count: 1`
might be executed before the AJAX request is finished, meaning it
wouldn't properly test anything.
This commit is contained in:
Javi Martín
2023-09-29 22:11:48 +02:00
parent 9c037a484e
commit 2b962f2789
30 changed files with 572 additions and 571 deletions

View File

@@ -1,24 +1,24 @@
<main class="admin-budgets-show"> <% provide :main_class, "admin-budgets-show" %>
<%= back_link_to admin_budgets_path %>
<%= header %> <%= back_link_to admin_budgets_path %>
<%= render Admin::Budgets::DraftingComponent.new(budget) %> <%= header %>
<%= render Admin::Budgets::LinksComponent.new(budget) %>
<section class="groups-and-headings" aria-labelledby="groups_and_headings_header"> <%= render Admin::Budgets::DraftingComponent.new(budget) %>
<%= render Admin::Budgets::LinksComponent.new(budget) %>
<section class="groups-and-headings" aria-labelledby="groups_and_headings_header">
<h3 id="groups_and_headings_header"><%= t("admin.budgets.show.groups_and_headings") %></h3> <h3 id="groups_and_headings_header"><%= t("admin.budgets.show.groups_and_headings") %></h3>
<%= render Admin::Budgets::GroupsAndHeadingsComponent.new(budget) %> <%= render Admin::Budgets::GroupsAndHeadingsComponent.new(budget) %>
</section> </section>
<section class="phases" aria-labelledby="phases_header"> <section class="phases" aria-labelledby="phases_header">
<h3 id="phases_header"><%= t("admin.budgets.edit.phases_caption") %></h3> <h3 id="phases_header"><%= t("admin.budgets.edit.phases_caption") %></h3>
<span class="help-text"><%= t("admin.budgets.edit.phases_table_help_text") %></span> <span class="help-text"><%= t("admin.budgets.edit.phases_table_help_text") %></span>
<%= render Admin::BudgetPhases::PhasesComponent.new(budget) %> <%= render Admin::BudgetPhases::PhasesComponent.new(budget) %>
</section> </section>
<section aria-labelledby="actions_header"> <section aria-labelledby="actions_header">
<h3 id="actions_header"><%= t("admin.budgets.edit.actions") %></h3> <h3 id="actions_header"><%= t("admin.budgets.edit.actions") %></h3>
<%= render Admin::Budgets::ActionsComponent.new(budget) %> <%= render Admin::Budgets::ActionsComponent.new(budget) %>
</section> </section>
</main>

View File

@@ -1,14 +1,14 @@
<main class="admin-budgets-wizard-headings-index"> <% provide :main_class, "admin-budgets-wizard-headings-index" %>
<%= back_link_to admin_budgets_wizard_budget_groups_path(budget, url_params), back_link_text %>
<%= header %> <%= back_link_to admin_budgets_wizard_budget_groups_path(budget, url_params), back_link_text %>
<%= render Admin::Budgets::HelpComponent.new("headings") %> <%= header %>
<%= render Admin::BudgetsWizard::CreationTimelineComponent.new("headings") %>
<% unless single_heading? %> <%= render Admin::Budgets::HelpComponent.new("headings") %>
<%= render Admin::BudgetsWizard::CreationTimelineComponent.new("headings") %>
<% unless single_heading? %>
<%= render Admin::BudgetsWizard::Headings::GroupSwitcherComponent.new(group) %> <%= render Admin::BudgetsWizard::Headings::GroupSwitcherComponent.new(group) %>
<%= render Admin::BudgetHeadings::HeadingsComponent.new(headings) %> <%= render Admin::BudgetHeadings::HeadingsComponent.new(headings) %>
<% end %> <% end %>
<%= render Admin::BudgetsWizard::Headings::CreationStepComponent.new(new_heading) %> <%= render Admin::BudgetsWizard::Headings::CreationStepComponent.new(new_heading) %>
</main>

View File

@@ -1,8 +1,8 @@
<% provide :main_class, "budget-groups-index" %>
<% content_for :canonical do %> <% content_for :canonical do %>
<%= render "shared/canonical", href: budget_groups_url %> <%= render "shared/canonical", href: budget_groups_url %>
<% end %> <% end %>
<main class="budget-groups-index"> <%= header(before: back_link_to(budget_path(budget))) %>
<%= header(before: back_link_to(budget_path(budget))) %> <%= render Budgets::GroupsAndHeadingsComponent.new(budget) %>
<%= render Budgets::GroupsAndHeadingsComponent.new(budget) %>
</main>

View File

@@ -1,7 +1,7 @@
<main class="budget-investment-new"> <% provide :main_class, "budget-investment-new" %>
<%= back_link_to budgets_path %>
<%= header %> <%= back_link_to budgets_path %>
<%= render "/budgets/investments/form", form_url: budget_investments_path(budget) %> <%= header %>
</main>
<%= render "/budgets/investments/form", form_url: budget_investments_path(budget) %>

View File

@@ -1,11 +1,12 @@
<main class="debate-new"> <% provide :main_class, "debate-new" %>
<%= back_link_to debates_path, t("debates.index.section_header.title") %>
<%= header do %> <%= back_link_to debates_path, t("debates.index.section_header.title") %>
<%= header do %>
<%= new_window_link_to t("debates.new.more_info"), help_path(anchor: "debates") %> <%= new_window_link_to t("debates.new.more_info"), help_path(anchor: "debates") %>
<% end %> <% end %>
<aside> <aside>
<h2><%= t("debates.new.recommendations_title") %></h2> <h2><%= t("debates.new.recommendations_title") %></h2>
<ul class="recommendations"> <ul class="recommendations">
@@ -14,7 +15,6 @@
<li><%= t("debates.new.recommendation_three") %></li> <li><%= t("debates.new.recommendation_three") %></li>
<li><%= t("debates.new.recommendation_four") %></li> <li><%= t("debates.new.recommendation_four") %></li>
</ul> </ul>
</aside> </aside>
<%= render Debates::FormComponent.new(debate) %> <%= render Debates::FormComponent.new(debate) %>
</main>

View File

@@ -1,9 +1,10 @@
<main class="moderation-users-index"> <% provide :main_class, "moderation-users-index" %>
<h2><%= t("moderation.users.index.title") %></h2>
<%= render Admin::SearchComponent.new(label: t("moderation.users.index.search_placeholder")) %> <h2><%= t("moderation.users.index.title") %></h2>
<% if users.present? %> <%= render Admin::SearchComponent.new(label: t("moderation.users.index.search_placeholder")) %>
<% if users.present? %>
<h3><%= page_entries_info users %></h3> <h3><%= page_entries_info users %></h3>
<table id="moderation_users" class="moderation-users"> <table id="moderation_users" class="moderation-users">
@@ -43,5 +44,4 @@
</table> </table>
<%= paginate users %> <%= paginate users %>
<% end %> <% end %>
</main>

View File

@@ -1,11 +1,12 @@
<main class="proposal-new"> <% provide :main_class, "proposal-new" %>
<%= back_link_to proposals_path, t("proposals.index.section_header.title") %>
<%= header do %> <%= back_link_to proposals_path, t("proposals.index.section_header.title") %>
<%= header do %>
<%= new_window_link_to t("proposals.new.more_info"), help_path(anchor: "proposals") %> <%= new_window_link_to t("proposals.new.more_info"), help_path(anchor: "proposals") %>
<% end %> <% end %>
<aside> <aside>
<h2><%= t("proposals.new.recommendations_title") %></h2> <h2><%= t("proposals.new.recommendations_title") %></h2>
<ul class="recommendations"> <ul class="recommendations">
@@ -13,7 +14,6 @@
<li><%= t("proposals.new.recommendation_two") %></li> <li><%= t("proposals.new.recommendation_two") %></li>
<li><%= t("proposals.new.recommendation_three") %></li> <li><%= t("proposals.new.recommendation_three") %></li>
</ul> </ul>
</aside> </aside>
<%= render Proposals::FormComponent.new(proposal, url: proposals_path) %> <%= render Proposals::FormComponent.new(proposal, url: proposals_path) %>
</main>

View File

@@ -1,19 +1,19 @@
<% provide(:title) { title } %> <% provide(:title) { title } %>
<% provide :main_class, "sdg-goals-index" %>
<main class="sdg-goals-index"> <% if header.present? %>
<% if header.present? %>
<%= render "shared/header", header: header %> <%= render "shared/header", header: header %>
<% else %> <% else %>
<header class="section-header"> <header class="section-header">
<h1><%= title %></h1> <h1><%= title %></h1>
</header> </header>
<% end %> <% end %>
<%= render Shared::BannerComponent.new("sdg") %> <%= render Shared::BannerComponent.new("sdg") %>
<%= link_list(*goal_links, class: "sdg-goal-list") %> <%= link_list(*goal_links, class: "sdg-goal-list") %>
<% phases.each do |phase| %> <% phases.each do |phase| %>
<section class="sdg-phase" id="sdg_phase_<%= phase.kind %>"> <section class="sdg-phase" id="sdg_phase_<%= phase.kind %>">
<header> <header>
<h2 class="title"><%= phase.title %></h2> <h2 class="title"><%= phase.title %></h2>
@@ -21,5 +21,4 @@
<%= render "shared/cards", cards: phase.cards.sort_by_order %> <%= render "shared/cards", cards: phase.cards.sort_by_order %>
</section> </section>
<% end %> <% end %>
</main>

View File

@@ -1,9 +1,9 @@
<% provide(:title) { goal.title } %> <% provide(:title) { goal.title } %>
<% provide :main_class, "sdg-goal-show" %>
<main class="sdg-goal-show"> <%= back_link_to sdg_goals_path %>
<%= back_link_to sdg_goals_path %>
<article class="sdg-goal sdg-goal-<%= code %>"> <article class="sdg-goal sdg-goal-<%= code %>">
<header> <header>
<h1><%= heading %></h1> <h1><%= heading %></h1>
</header> </header>
@@ -25,15 +25,14 @@
</button> </button>
</div> </div>
</div> </div>
</article> </article>
<%= render ::Widget::Feeds::ParticipationComponent.new(feeds) %> <%= render ::Widget::Feeds::ParticipationComponent.new(feeds) %>
<% if processes_feed %> <% if processes_feed %>
<div class="feeds-list"> <div class="feeds-list">
<%= render ::Widget::Feeds::FeedComponent.new(processes_feed) %> <%= render ::Widget::Feeds::FeedComponent.new(processes_feed) %>
</div> </div>
<% end %> <% end %>
<%= render SDG::Goals::TargetsComponent.new(goal) %> <%= render SDG::Goals::TargetsComponent.new(goal) %>
</main>

View File

@@ -1,5 +1,6 @@
<main class="subscriptions-edit"> <% provide :main_class, "subscriptions-edit" %>
<%= form_for user, url: subscriptions_path(token: user.subscriptions_token) do |f| %>
<%= form_for user, url: subscriptions_path(token: user.subscriptions_token) do |f| %>
<h2><%= t("account.show.notifications") %></h2> <h2><%= t("account.show.notifications") %></h2>
<div><%= f.check_box :email_on_comment %></div> <div><%= f.check_box :email_on_comment %></div>
@@ -9,5 +10,4 @@
<div><%= f.check_box :email_on_direct_message %></div> <div><%= f.check_box :email_on_direct_message %></div>
<%= f.submit t("account.show.save_changes_submit"), class: "button margin-top" %> <%= f.submit t("account.show.save_changes_submit"), class: "button margin-top" %>
<% end %> <% end %>
</main>

View File

@@ -1,3 +1,5 @@
<main id="ballot" class="budget-ballot-show"> <% provide :main_class, "budget-ballot-show" %>
<div id="ballot">
<%= render "budgets/ballot/ballot" %> <%= render "budgets/ballot/ballot" %>
</main> </div>

View File

@@ -1,10 +1,11 @@
<main class="budget-group-show"> <% provide :main_class, "budget-group-show" %>
<header>
<header>
<%= back_link_to budget_path(@budget) %> <%= back_link_to budget_path(@budget) %>
<h1><%= t("budgets.groups.show.title") %></h1> <h1><%= t("budgets.groups.show.title") %></h1>
</header> </header>
<div class="row margin"> <div class="row margin">
<div id="headings" class="small-12 medium-7 column select-district"> <div id="headings" class="small-12 medium-7 column select-district">
<div class="row"> <div class="row">
<% @group.headings.sort_by_name.each_slice(7) do |slice| %> <% @group.headings.sort_by_name.each_slice(7) do |slice| %>
@@ -24,5 +25,4 @@
<div class="medium-5 column show-for-medium text-center"> <div class="medium-5 column show-for-medium text-center">
<%= image_tag(image_path_for("map.jpg")) %> <%= image_tag(image_path_for("map.jpg")) %>
</div> </div>
</div> </div>
</main>

View File

@@ -1,19 +1,19 @@
<%= render Shared::BannerComponent.new("budgets") %> <%= render Shared::BannerComponent.new("budgets") %>
<% provide :title do %><%= t("budgets.index.title") %><% end %> <% provide :title do %><%= t("budgets.index.title") %><% end %>
<% provide :main_class, "budgets-index" %>
<% content_for :canonical do %> <% content_for :canonical do %>
<%= render "shared/canonical", href: budgets_url %> <%= render "shared/canonical", href: budgets_url %>
<% end %> <% end %>
<main class="budgets-index"> <% if @budget.present? %>
<% if @budget.present? %>
<%= render Budgets::BudgetComponent.new(@budget) %> <%= render Budgets::BudgetComponent.new(@budget) %>
<% if @finished_budgets.present? %> <% if @finished_budgets.present? %>
<%= render "finished", budgets: @finished_budgets %> <%= render "finished", budgets: @finished_budgets %>
<% end %> <% end %>
<% else %> <% else %>
<header> <header>
<h1><%= t("budgets.index.title") %></h1> <h1><%= t("budgets.index.title") %></h1>
</header> </header>
@@ -25,7 +25,6 @@
</div> </div>
</div> </div>
</div> </div>
<% end %> <% end %>
<%= render Budgets::FooterComponent.new %> <%= render Budgets::FooterComponent.new %>
</main>

View File

@@ -15,18 +15,17 @@
<% end %> <% end %>
<% end %> <% end %>
<main id="budget-investments-main"> <% if @search_terms || @advanced_search_terms %>
<% if @search_terms || @advanced_search_terms %>
<%= render Shared::SearchResultsSummaryComponent.new( <%= render Shared::SearchResultsSummaryComponent.new(
results: @investments, results: @investments,
search_terms: @search_terms, search_terms: @search_terms,
advanced_search_terms: @advanced_search_terms advanced_search_terms: @advanced_search_terms
) %> ) %>
<% else %> <% else %>
<%= render "/budgets/investments/header" %> <%= render "/budgets/investments/header" %>
<% end %> <% end %>
<div class="row"> <div class="row">
<div id="budget-investments" class="budget-investments-list small-12 medium-9 column"> <div id="budget-investments" class="budget-investments-list small-12 medium-9 column">
<% if @current_filter == "unfeasible" %> <% if @current_filter == "unfeasible" %>
@@ -86,5 +85,4 @@
</aside> </aside>
</div> </div>
</div> </div>
</main>

View File

@@ -8,24 +8,23 @@
<%= render "shared/canonical", href: debates_url %> <%= render "shared/canonical", href: debates_url %>
<% end %> <% end %>
<main> <% if @search_terms || @advanced_search_terms %>
<% if @search_terms || @advanced_search_terms %>
<%= render Shared::SearchResultsSummaryComponent.new( <%= render Shared::SearchResultsSummaryComponent.new(
results: @debates, results: @debates,
search_terms: @search_terms, search_terms: @search_terms,
advanced_search_terms: @advanced_search_terms advanced_search_terms: @advanced_search_terms
) %> ) %>
<% else %> <% else %>
<%= render "shared/section_header", i18n_namespace: "debates.index.section_header", image: "debates" %> <%= render "shared/section_header", i18n_namespace: "debates.index.section_header", image: "debates" %>
<% end %> <% end %>
<% if feature?("user.recommendations") && @recommended_debates.present? %> <% if feature?("user.recommendations") && @recommended_debates.present? %>
<%= render "shared/recommended_index", recommended: @recommended_debates, <%= render "shared/recommended_index", recommended: @recommended_debates,
disable_recommendations_path: recommendations_disable_debates_path, disable_recommendations_path: recommendations_disable_debates_path,
namespace: "debates" %> namespace: "debates" %>
<% end %> <% end %>
<div class="row"> <div class="row">
<div id="debates" class="debates-list small-12 medium-9 column"> <div id="debates" class="debates-list small-12 medium-9 column">
<%= render Shared::BannerComponent.new("debates") %> <%= render Shared::BannerComponent.new("debates") %>
@@ -82,6 +81,4 @@
<%= render "shared/tag_cloud", taggable: "Debate" %> <%= render "shared/tag_cloud", taggable: "Debate" %>
</aside> </aside>
</div> </div>
</div>
</div>
</main>

View File

@@ -22,7 +22,7 @@
<% end %> <% end %>
</nav> </nav>
<div class="admin-content <%= yield(:main_class) %>"> <main class="admin-content <%= yield(:main_class) %>">
<%= label_tag :show_menu, t("admin.menu.admin"), <%= label_tag :show_menu, t("admin.menu.admin"),
"aria-hidden": true, class: "button hollow expanded" %> "aria-hidden": true, class: "button hollow expanded" %>

View File

@@ -17,9 +17,11 @@
<div class="wrapper <%= yield(:wrapper_class) %>"> <div class="wrapper <%= yield(:wrapper_class) %>">
<%= render "layouts/header", with_subnavigation: true %> <%= render "layouts/header", with_subnavigation: true %>
<%= render "layouts/flash" %>
<main class="public-content <%= yield(:main_class) %>">
<%= render "layouts/flash" %>
<%= yield %> <%= yield %>
</main>
</div> </div>
<div class="footer"> <div class="footer">

View File

@@ -26,7 +26,7 @@
<%= render "dashboard/menu" %> <%= render "dashboard/menu" %>
</nav> </nav>
<div class="admin-content"> <main class="admin-content <%= yield(:main_class) %>">
<%= label_tag :show_menu, t("admin.menu.admin"), <%= label_tag :show_menu, t("admin.menu.admin"),
"aria-hidden": true, class: "button hollow expanded" %> "aria-hidden": true, class: "button hollow expanded" %>
@@ -34,7 +34,7 @@
<%= render "layouts/dashboard/proposal_totals" %> <%= render "layouts/dashboard/proposal_totals" %>
<%= render "layouts/dashboard/proposal_header" %> <%= render "layouts/dashboard/proposal_header" %>
<%= yield %> <%= yield %>
</div> </main>
</div> </div>
</body> </body>
</html> </html>

View File

@@ -21,11 +21,11 @@
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<div class="row"> <div class="row">
<div class="small-12 medium-9 large-7 small-centered column"> <div class="small-12 medium-9 large-7 small-centered column">
<div class="auth-form margin"> <main class="auth-form margin <%= yield(:main_class) %>">
<%= render "layouts/flash" %> <%= render "layouts/flash" %>
<%= yield %> <%= yield %>
</div> </main>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -8,8 +8,7 @@
<%= render "shared/canonical", href: proposals_url %> <%= render "shared/canonical", href: proposals_url %>
<% end %> <% end %>
<main> <% if [
<% if [
@search_terms, @search_terms,
@advanced_search_terms, @advanced_search_terms,
params[:retired].present?, params[:retired].present?,
@@ -26,17 +25,17 @@
<h2><%= t("proposals.index.selected_proposals") %></h2> <h2><%= t("proposals.index.selected_proposals") %></h2>
<% end %> <% end %>
<% end %> <% end %>
<% else %> <% else %>
<%= render "shared/section_header", i18n_namespace: "proposals.index.section_header", image: "proposals" %> <%= render "shared/section_header", i18n_namespace: "proposals.index.section_header", image: "proposals" %>
<% end %> <% end %>
<% if show_recommended_proposals? %> <% if show_recommended_proposals? %>
<%= render "shared/recommended_index", recommended: @recommended_proposals, <%= render "shared/recommended_index", recommended: @recommended_proposals,
disable_recommendations_path: recommendations_disable_proposals_path, disable_recommendations_path: recommendations_disable_proposals_path,
namespace: "proposals" %> namespace: "proposals" %>
<% end %> <% end %>
<div class="row"> <div class="row">
<div id="proposals" class="proposals-list small-12 medium-9 column"> <div id="proposals" class="proposals-list small-12 medium-9 column">
<%= render Shared::BannerComponent.new("proposals") %> <%= render Shared::BannerComponent.new("proposals") %>
@@ -125,6 +124,4 @@
<%= render "proposals_lists" %> <%= render "proposals_lists" %>
</aside> </aside>
</div> </div>
</div>
</div>
</main>

View File

@@ -1,5 +1,4 @@
<main> <div class="row proposals-summary">
<div class="row proposals-summary">
<div id="proposals" class="proposals-list small-12 medium-9 column"> <div id="proposals" class="proposals-list small-12 medium-9 column">
<%= back_link_to %> <%= back_link_to %>
@@ -49,5 +48,4 @@
<%= render Proposals::GeozonesComponent.new %> <%= render Proposals::GeozonesComponent.new %>
</aside> </aside>
</div> </div>
</div> </div>
</main>

View File

@@ -1,7 +1,7 @@
<main class="topic-edit"> <% provide :main_class, "topic-edit" %>
<%= back_link_to community_path(@community) %>
<h1><%= t("community.topic.edit") %></h1> <%= back_link_to community_path(@community) %>
<%= render "form" %> <h1><%= t("community.topic.edit") %></h1>
</main>
<%= render "form" %>

View File

@@ -1,9 +1,10 @@
<main class="topic-new"> <% provide :main_class, "topic-new" %>
<%= back_link_to community_path(@community) %>
<h1><%= t("community.topic.create") %></h1> <%= back_link_to community_path(@community) %>
<aside> <h1><%= t("community.topic.create") %></h1>
<aside>
<h2><%= t("community.topic.sidebar.recommendations_title") %></h2> <h2><%= t("community.topic.sidebar.recommendations_title") %></h2>
<ul class="recommendations"> <ul class="recommendations">
@@ -11,7 +12,6 @@
<li><%= t("community.topic.sidebar.recommendation_two") %></li> <li><%= t("community.topic.sidebar.recommendation_two") %></li>
<li><%= t("community.topic.sidebar.recommendation_three") %></li> <li><%= t("community.topic.sidebar.recommendation_three") %></li>
</ul> </ul>
</aside> </aside>
<%= render "form" %> <%= render "form" %>
</main>

View File

@@ -1,5 +1,4 @@
<main> <div class="activity row margin-top">
<div class="activity row margin-top">
<div class="small-12 column"> <div class="small-12 column">
<% if @user != current_user %> <% if @user != current_user %>
@@ -24,5 +23,4 @@
<%= render Users::PublicActivityComponent.new(@user) %> <%= render Users::PublicActivityComponent.new(@user) %>
</div> </div>
</div> </div>
</main>

View File

@@ -13,10 +13,9 @@
<%= render "shared/header", header: @header %> <%= render "shared/header", header: @header %>
<main> <%= render "feeds" %>
<%= render "feeds" %>
<div class="row"> <div class="row">
<% if @cards.any? %> <% if @cards.any? %>
<div class="small-12 column <%= "large-8" if feed_processes_enabled? %>"> <div class="small-12 column <%= "large-8" if feed_processes_enabled? %>">
<h2 class="title"><%= t("welcome.cards.title") %></h2> <h2 class="title"><%= t("welcome.cards.title") %></h2>
@@ -30,11 +29,10 @@
<%= render "processes" %> <%= render "processes" %>
</div> </div>
<% end %> <% end %>
</div> </div>
<% if feature?("user.recommendations") && (@recommended_debates.present? || @recommended_proposals.present?) %> <% if feature?("user.recommendations") && (@recommended_debates.present? || @recommended_proposals.present?) %>
<%= render "recommended", <%= render "recommended",
recommended_debates: @recommended_debates, recommended_debates: @recommended_debates,
recommended_proposals: @recommended_proposals %> recommended_proposals: @recommended_proposals %>
<% end %> <% end %>
</main>

View File

@@ -33,9 +33,9 @@
</head> </head>
<body> <body>
<div class="error"> <main class="error">
<h1>403</h1> <h1>403</h1>
<h2>Access to this page has been disabled by the administrators.</h2> <h2>Access to this page has been disabled by the administrators.</h2>
</div> </main>
</body> </body>
</html> </html>

View File

@@ -33,9 +33,9 @@
</head> </head>
<body> <body>
<div class="error"> <main class="error">
<h1>404</h1> <h1>404</h1>
<h2>Not found.</h2> <h2>Not found.</h2>
</div> </main>
</body> </body>
</html> </html>

View File

@@ -33,9 +33,9 @@
</head> </head>
<body> <body>
<div class="error"> <main class="error">
<h1>422</h1> <h1>422</h1>
<h2>The change you wanted was rejected.</h2> <h2>The change you wanted was rejected.</h2>
</div> </main>
</body> </body>
</html> </html>

View File

@@ -33,9 +33,9 @@
</head> </head>
<body> <body>
<div class="error"> <main class="error">
<h1>500</h1> <h1>500</h1>
<h2>Internal server error.</h2> <h2>Internal server error.</h2>
</div> </main>
</body> </body>
</html> </html>

View File

@@ -53,6 +53,20 @@ end
FactoryBot.use_parent_strategy = false FactoryBot.use_parent_strategy = false
module Capybara
module DSL
alias_method :original_visit, :visit
def visit(url, ...)
original_visit(url, ...)
unless url.match?("robots.txt") || url.match?("active_storage/representations")
expect(page).to have_css "main", count: 1
end
end
end
end
Capybara.register_driver :headless_chrome do |app| Capybara.register_driver :headless_chrome do |app|
options = Selenium::WebDriver::Chrome::Options.new.tap do |opts| options = Selenium::WebDriver::Chrome::Options.new.tap do |opts|
opts.add_argument "--headless" opts.add_argument "--headless"