OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#64235] Provide A11y labels for pagination links (#19468)
Alexander Brandon Colesf6c2b16e2121
diff --git a/app/components/projects/table_component.html.erb b/app/components/projects/table_component.html.erbindex 289bc6f7206..ca4087a80e9 100644--- a/app/components/projects/table_component.html.erb+++ b/app/components/projects/table_component.html.erb@@ -95,6 +95,6 @@ See COPYRIGHT and LICENSE files for more details.</div></div><% if paginated? %>- <%= helpers.pagination_links_full(model, pagination_options) %>+ <%= helpers.pagination_links_full(model, **pagination_options) %><% end %><% end %>diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rbindex 38f86560e68..8bce8089284 100644--- a/app/helpers/application_helper.rb+++ b/app/helpers/application_helper.rb@@ -476,8 +476,8 @@ module ApplicationHelperendend- def link_to_content_update(text, url_params = {}, html_options = {})- link_to(text, url_params, html_options.reverse_merge(target: "_top"))+ def link_to_content_update(name, options = {}, html_options = {}, &)+ link_to(name, options, html_options.reverse_merge(target: "_top"), &)enddef password_complexity_requirementsdiff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rbindex e881a4b6ab2..3756c01ce4d 100644--- a/app/helpers/pagination_helper.rb+++ b/app/helpers/pagination_helper.rb@@ -35,79 +35,15 @@ module PaginationHelperSHOW_MORE_DEFAULT_INCREMENT = 20SHOW_MORE_MAX_LIMIT = 1000- def pagination_links_full(paginator, options = {})+ def pagination_links_full(paginator, params: {}, allowed_params: nil, per_page_links: true, **)return unless paginator.total_entries > 0- pagination_options = default_options.merge(options)-content_tag(:div, class: "op-pagination") do- content = content_tag(:nav,- pagination_entries(paginator, pagination_options),- class: "op-pagination--pages")-- if pagination_options[:per_page_links]- content << pagination_option_links(paginator, pagination_options)- end-- content.html_safe+ concat pagination_pages_section(paginator, renderer: OpenProject::LinkRenderer, params:, allowed_params:, **)+ concat pagination_options_section(paginator, params:, allowed_params:) if per_page_linksendend- def pagination_option_links(paginator, pagination_options)- allowed_params = pagination_options[:allowed_params] || %w[filters sortBy]-- option_links = pagination_settings(paginator,- pagination_options[:params]- .merge(safe_query_params(allowed_params)))-- content_tag(:div, option_links, class: "op-pagination--options")- end-- ##- # Builds the pagination nav with pages and range- def pagination_entries(paginator, options)- page_first = paginator.offset + 1- page_last = paginator.offset + paginator.length- total = paginator.total_entries-- content_tag(:ul, class: "op-pagination--items op-pagination--items_start") do- # will_paginate will return nil early when no pages available- content = will_paginate(paginator, options) || ""-- range = "(#{page_first} - #{page_last}/#{total})"- content += content_tag(:li, range, class: "op-pagination--range", title: range)-- content.html_safe- end- end-- ##- # Builds pagination options (range).- def pagination_settings(paginator, options)- links = per_page_links(paginator, options)-- if links.size > 1- label = I18n.t(:label_per_page)- content_tag(:ul, class: "op-pagination--items op-pagination--items_end") do- content_tag(:li, label + ":", class: "op-pagination--label", title: label) + links- end- end- end-- ##- # Constructs the 'n items per page' entries- # determined from available options in the settings.- def per_page_links(paginator, options)- Setting.per_page_options_array.inject("") do |html, n|- if n == paginator.per_page- html + content_tag(:li, n, class: "op-pagination--item op-pagination--item_current")- else- link = link_to_content_update(n, options.merge(page: 1, per_page: n), { class: "op-pagination--item-link" })- html + content_tag(:li, link.html_safe, class: "op-pagination--item")- end- end.html_safe- end-# Returns page option used for pagination# based on:# * offset@@ -175,92 +111,66 @@ module PaginationHelperpaginator.paginate(page: 1, per_page: show_more_limit_param(options))end- class LinkRenderer < ::WillPaginate::ActionView::LinkRenderer- def to_html- pagination.inject("") do |html, item|- html + (item.is_a?(Integer) ? page_number(item) : send(item))- end.html_safe- end-- protected+ private- def merge_get_params(url_params)- params = super- allowed_params ? params.slice(*allowed_params) : params+ def pagination_pages_section(paginator, **)+ content_tag(:nav, class: "op-pagination--pages", aria: { label: I18n.t(:"js.pagination.page_navigation") }) do+ pagination_entries(paginator, **)end+ end- def page_number(page)- if page == current_page- tag(:li, page, class: "op-pagination--item op-pagination--item_current")- else- tag(:li, link(page, page, { class: "op-pagination--item-link" }), class: "op-pagination--item")+ def pagination_options_section(paginator, params:, allowed_params:)+ per_page_options = Setting.per_page_options_array+ return "".html_safe if per_page_options.empty?++ allowed_params ||= %w[filters sortBy]+ content_tag(:div, class: "op-pagination--options") do+ content_tag(:nav, aria: { label: I18n.t(:"js.pagination.per_page_navigation") }) do+ pagination_options_list(+ per_page_options,+ current_per_page: paginator.per_page,+ **params.merge(safe_query_params(allowed_params))+ )endend+ end- def gap- tag(:li, "…", class: "op-pagination--space")- end+ ##+ # Builds the pagination nav with pages and range+ def pagination_entries(paginator, **)+ page_first = paginator.offset + 1+ page_last = paginator.offset + paginator.length+ total = paginator.total_entries- def previous_page- num = @collection.current_page > 1 && (@collection.current_page - 1)- previous_or_next_page(num, I18n.t(:label_previous), "prev")+ content_tag(:ul, class: "op-pagination--items op-pagination--items_start", role: "presentation") do+ concat will_paginate(paginator, **, container: false)+ concat content_tag(:li, "(#{page_first} - #{page_last}/#{total})", class: "op-pagination--range")end+ end- def next_page- num = @collection.current_page < total_pages && (@collection.current_page + 1)- previous_or_next_page(num, I18n.t(:label_next), "next")+ def pagination_options_list(per_pages, current_per_page:, **)+ content_tag(:ul, class: "op-pagination--items op-pagination--items_end", role: "presentation") do+ safe_join [+ content_tag(:li, I18n.t(:label_per_page), class: "op-pagination--label"),+ per_pages.map { |per_page| pagination_options_item(per_page, current: per_page == current_per_page, **) }+ ]end+ end- def previous_or_next_page(page, text, class_suffix)- if page- tag(:li,- link(text, page, { class: "op-pagination--item-link op-pagination--item-link_#{class_suffix}" }),- class: "op-pagination--item op-pagination--item_#{class_suffix}")- else- ""+ ##+ # Constructs the 'n items per page' entries+ # determined from available options in the settings.+ def pagination_options_item(per_page, current:, **options)+ label = I18n.t("js.pagination.pages.show_per_page", number: per_page)+ content_tag(:li, class: ["op-pagination--item", { "op-pagination--item_current": current }]) do+ link_to_unless(+ current,+ per_page,+ options.merge(page: 1, per_page:),+ class: "op-pagination--item-link", aria: { label: }, target: "_top"+ ) do+ content_tag(:span, per_page, aria: { label:, current: "page" }, tabindex: 0)endend-- private-- def link(text, target, attributes)- new_attributes = attributes.dup- new_attributes["data-turbo-stream"] = true if turbo?- new_attributes["data-turbo-action"] = turbo_action if turbo_action.present?-- super(text, target, new_attributes)- end-- def allowed_params- @options[:allowed_params] # rubocop:disable Rails/HelperInstanceVariable- end-- # Customize the Turbo visit action for pagination links. Can be set to "advance" or "replace".- # "advance" - push a new entry onto the history stack.- # "replace" - replace the current history entry.- # See: https://turbo.hotwired.dev/reference/attributes- #- # Example: Promoting a Frame Navigation to a Page Visit- # By default navigation within a turbo frame does not change the rest of the browser's state,- # but you can promote a frame navigation a "Visit" by setting the turbo-action attribute to "advance".- # See: https://turbo.hotwired.dev/handbook/frames#promoting-a-frame-navigation-to-a-page-visit- #- def turbo_action- @options[:turbo_action] # rubocop:disable Rails/HelperInstanceVariable- end-- def turbo?- @options[:turbo] # rubocop:disable Rails/HelperInstanceVariable- end- end-- private-- def default_options- {- renderer: LinkRenderer,- per_page_links: true,- params: {}- }endenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex 9c543215aa1..e6cbe50bab8 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -3123,7 +3123,7 @@ en:label_password_rule_special: "Special Characters"label_password_rule_uppercase: "Uppercase"label_path_encoding: "Path encoding"- label_per_page: "Per page"+ label_per_page: "Per page:"label_people: "People"label_permissions: "Permissions"label_permissions_report: "Permissions report"diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex 75d40ec8ca6..27cf07e621c 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -700,8 +700,6 @@ en:page_navigation: "Pagination navigation"per_page_navigation: 'Items per page selection'pages:- next: "Next page"- previous: "Previous page"page_number: Page %{number}show_per_page: Show %{number} per pagediff --git a/frontend/src/app/shared/components/table-pagination/table-pagination.component.html b/frontend/src/app/shared/components/table-pagination/table-pagination.component.htmlindex 6ddd6c0d4d9..828a6ece8bb 100644--- a/frontend/src/app/shared/components/table-pagination/table-pagination.component.html+++ b/frontend/src/app/shared/components/table-pagination/table-pagination.component.html@@ -7,9 +7,9 @@class="op-pagination--item-link op-pagination--item-link_prev"type="button"(click)="showPage(pagination.page - 1)"- rel="prev start"- [attr.aria-label]="text.label_previous">- <+ rel="prev start">+ <svg chevron-left-icon size="xsmall" class="op-pagination--item-link-icon op-pagination--item-link-icon_prev" />+ {{text.label_previous}}</button></li>@@ -66,12 +66,12 @@<li [hidden]="!(pagination.total && pagination.page < pageNumbers[pageNumbers.length - 1])"class="op-pagination--item"><button+ class="op-pagination--item-link op-pagination--item-link_next"type="button"(click)="showPage(pagination.page + 1)"- rel="next"- class="op-pagination--item-link op-pagination--item-link_next"- [attr.aria-label]="text.label_next">- >+ rel="next">+ {{text.label_next}}+ <svg chevron-right-icon size="xsmall" class="op-pagination--item-link-icon op-pagination--item-link-icon_next" /></button></li><li class="op-pagination--range">diff --git a/frontend/src/app/shared/components/table-pagination/table-pagination.component.ts b/frontend/src/app/shared/components/table-pagination/table-pagination.component.tsindex 1db8e1d32f4..6c26f0a0d49 100644--- a/frontend/src/app/shared/components/table-pagination/table-pagination.component.ts+++ b/frontend/src/app/shared/components/table-pagination/table-pagination.component.ts@@ -61,8 +61,8 @@ export class TablePaginationComponent extends UntilDestroyedMixin implements OnIpublic pagination:PaginationInstance;public text = {- label_previous: this.I18n.t('js.pagination.pages.previous'),- label_next: this.I18n.t('js.pagination.pages.next'),+ label_previous: this.I18n.t('js.label_previous'),+ label_next: this.I18n.t('js.label_next'),per_page: this.I18n.t('js.label_per_page'),no_other_page: this.I18n.t('js.pagination.no_other_page'),page_navigation: this.I18n.t('js.pagination.page_navigation'),diff --git a/frontend/src/global_styles/content/_pagination.sass b/frontend/src/global_styles/content/_pagination.sassindex 4e3299d478c..8b9874a0ca4 100644--- a/frontend/src/global_styles/content/_pagination.sass+++ b/frontend/src/global_styles/content/_pagination.sass@@ -47,6 +47,7 @@ $pagination--font-size: 0.8125rem&--itemslist-style-type: nonedisplay: flex+ align-items: centermargin: 0padding: 0font-size: $pagination--font-size@@ -62,10 +63,6 @@ $pagination--font-size: 0.8125remmargin: 0 5px 0 0white-space: nowrap- &_prev,- &_next- min-width: 25px-&_currentbackground: var(--body-background)border: 1px solid var(--body-background)@@ -76,10 +73,11 @@ $pagination--font-size: 0.8125rem&-linkmargin: 0- display: block+ display: inline-flex+ align-items: baselinemin-width: 25px- text-align: center- padding: 3px 3px+ justify-content: center+ padding: 3px var(--base-size-4)background: var(--button--background-color)border-radius: 2pxborder: 1px solid var(--button-default-borderColor-rest)@@ -92,6 +90,23 @@ $pagination--font-size: 0.8125remtext-decoration: nonebackground: var(--button--background-hover-color)+ &_prev+ padding-left: var(--base-size-6)+ padding-right: var(--base-size-8)++ &_next+ padding-left: var(--base-size-8)+ padding-right: var(--base-size-6)++ &-link-icon+ align-self: center++ &_prev+ margin-right: var(--base-size-4)++ &_next+ margin-left: var(--base-size-4)+&--spacebackground: var(--body-background)border: 1px solid var(--body-background)diff --git a/lib/open_project/link_renderer.rb b/lib/open_project/link_renderer.rbnew file mode 100644index 00000000000..17c653c21f4--- /dev/null+++ b/lib/open_project/link_renderer.rb@@ -0,0 +1,140 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module OpenProject+ class LinkRenderer < ::WillPaginate::ActionView::LinkRenderer+ include ActionView::Helpers::OutputSafetyHelper++ protected++ def merge_get_params(url_params)+ params = super+ allowed_params ? params.slice(*allowed_params) : params+ end++ def page_number(page)+ label = I18n.t("js.pagination.pages.page_number", number: page)+ if page == current_page+ tag(:li,+ tag(:em, page, "aria-label": label, "aria-current": "page", tabindex: 0),+ class: "op-pagination--item op-pagination--item_current")+ else+ tag(:li,+ link(page, page, class: "op-pagination--item-link", "aria-label": label),+ class: "op-pagination--item")+ end+ end++ def gap+ tag(:li, "…", class: "op-pagination--space", role: "separator")+ end++ def previous_page+ num = @collection.current_page > 1 && (@collection.current_page - 1)+ previous_or_next_page(+ num,+ safe_join_components(+ render_octicon(:"chevron-left", class_suffix: "prev"),+ I18n.t(:label_previous)+ ),+ "prev"+ )+ end++ def next_page+ num = @collection.current_page < total_pages && (@collection.current_page + 1)+ previous_or_next_page(+ num,+ safe_join_components(+ I18n.t(:label_next),+ render_octicon(:"chevron-right", class_suffix: "next")+ ),+ "next"+ )+ end++ def previous_or_next_page(page, text, class_suffix)+ if page+ tag(:li,+ link(text, page, { class: "op-pagination--item-link op-pagination--item-link_#{class_suffix}" }),+ class: "op-pagination--item")+ else+ ""+ end+ end++ private++ def link(text, target, attributes)+ new_attributes = attributes.dup+ new_attributes["data-turbo-stream"] = true if turbo?+ new_attributes["data-turbo-action"] = turbo_action if turbo_action.present?++ super(text, target, new_attributes)+ end++ def allowed_params+ @options[:allowed_params]+ end++ # Customize the Turbo visit action for pagination links. Can be set to "advance" or "replace".+ # "advance" - push a new entry onto the history stack.+ # "replace" - replace the current history entry.+ # See: https://turbo.hotwired.dev/reference/attributes+ #+ # Example: Promoting a Frame Navigation to a Page Visit+ # By default navigation within a turbo frame does not change the rest of the browser's state,+ # but you can promote a frame navigation a "Visit" by setting the turbo-action attribute to "advance".+ # See: https://turbo.hotwired.dev/handbook/frames#promoting-a-frame-navigation-to-a-page-visit+ #+ def turbo_action+ @options[:turbo_action]+ end++ def turbo?+ @options[:turbo]+ end++ def safe_join_components(*components)+ safe_join(components, " ")+ end++ def render_octicon(icon_name, class_suffix:, **)+ @template.render(+ Primer::Beta::Octicon.new(+ icon_name,+ size: :xsmall,+ classes: ["op-pagination--item-link-icon", "op-pagination--item-link-icon_#{class_suffix}"],+ **+ )+ )+ end+ end+enddiff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rbindex 11969d89f33..1b13a2bd482 100644--- a/spec/helpers/application_helper_spec.rb+++ b/spec/helpers/application_helper_spec.rb@@ -242,4 +242,30 @@ RSpec.describe ApplicationHelper doERRendend++ describe "#link_to_content_update" do+ let(:options) { { controller: "work_packages", action: "show", id: 10 } }++ subject { link_to_content_update("Пакет работ", options, html_options) }++ context "without html_options" do+ let(:html_options) { {} }++ it "renders with 'target=\"_top\"'" do+ expect(subject).to be_html_eql %{+ <a target="_top" href="/work_packages/10">Пакет работ</a>+ }+ end+ end++ context "with html_options" do+ let(:html_options) { { aria: { label: "Работайте усердно!", current: "page" } } }++ it "renders with 'target=\"_top\"'" do+ expect(subject).to be_html_eql %{+ <a target="_top" aria-label="Работайте усердно!" aria-current="page" href="/work_packages/10">Пакет работ</a>+ }+ end+ end+ endenddiff --git a/spec/helpers/pagination_helper_spec.rb b/spec/helpers/pagination_helper_spec.rbindex ab44afa7952..d471fe4c951 100644--- a/spec/helpers/pagination_helper_spec.rb+++ b/spec/helpers/pagination_helper_spec.rb@@ -52,7 +52,9 @@ RSpec.describe PaginationHelper dolet(:total_entries) { 55 }let(:offset) { 1 }let(:current_page) { 1 }- let(:pagination) { helper.pagination_links_full(paginator) }+ let(:pages) { (1..(total_entries / per_page)) }++ subject(:pagination) { helper.pagination_links_full(paginator) }before do# setup the helpers environment as if the helper is rendered after having called@@ -71,30 +73,44 @@ RSpec.describe PaginationHelper doexpect(pagination).to have_css("div.op-pagination")end- it "has a next_page reference" do- expect(pagination).to have_css(".op-pagination--item_next")+ it "renders a labelled nav element" do+ expect(pagination).to have_element "nav", aria: { label: "Pagination navigation" }end- it "does not have a previous_page reference" do- expect(pagination).to have_no_css(".op-pagination--item_prev")+ it "renders 2 presentational lists" do+ expect(pagination).to have_css "ul.op-pagination--items[role=presentation]", count: 2end- it "has links to every page except the current one" do- (1..(total_entries / per_page)).each do |i|- next if i == current_page+ it "has a next page link" do+ expect(pagination).to have_link "Next" do |link|+ expect(link).to have_octicon :"chevron-right"+ expect(link["rel"]).to eq "next"+ end+ end++ it "does not have a previous page link" do+ expect(pagination).to have_no_link "Previous"+ end- expect(pagination).to have_css("a[href='#{work_packages_path(page: i)}']",- text: Regexp.new("^#{i}$"))+ it "has links to every page except the current one" do+ pages.excluding(current_page).each do |page|+ path = work_packages_path(page:)+ expect(pagination).to have_link text: page, exact_text: true, href: path, current: nil do |link|+ expect(link["aria-label"]).to eq "Page #{page}"+ endendendit "does not have a link to the current page" do- expect(pagination).to have_no_css("a", text: Regexp.new("^#{current_page}$"))+ expect(pagination).to have_no_link text: current_page, exact_text: true, current: "page"end- it "has an element for the current page" do- expect(pagination).to have_css(".op-pagination--item_current",- text: Regexp.new("^#{current_page}$"))+ it "has a focusable element for the current page" do+ expect(pagination).to have_css ".op-pagination--item_current", text: current_page, exact_text: true+ expect(pagination).to have_element text: current_page, exact_text: true, aria: { current: "page" } do |element|+ expect(element["aria-label"]).to eq "Page #{current_page}"+ expect(element["tabindex"]).to eq "0"+ endendit "shows the range of the entries displayed" do@@ -113,33 +129,69 @@ RSpec.describe PaginationHelper dohref = work_packages_path({ page: i }.merge(params))- expect(pagination).to have_css("a[href='#{href}']", text: Regexp.new("^#{i}$"))+ expect(pagination).to have_link text: i, exact_text: true, href:, current: nilendend- it "shows the available per page options" do- allow(Setting)- .to receive(:per_page_options)- .and_return("#{per_page},#{per_page * 10}")-- expect(pagination).to have_css(".op-pagination--options")+ describe "per page options" do+ context "with multiple per page", with_settings: { per_page_options: "10,50,100" } do+ it "renders per page options" do+ expect(pagination).to have_css ".op-pagination--options"+ end++ it "renders a labelled nav element" do+ expect(pagination).to have_element "nav", aria: { label: "Items per page selection" }+ end++ it "has a link to every per page option except the current one" do+ expect(pagination).to have_css(".op-pagination--options") do |pagination_options|+ [50, 100].each do |other_per_page|+ path = work_packages_path(page: current_page, per_page: other_per_page)+ expect(pagination_options).to have_link href: path, current: nil do |link|+ expect(link["aria-label"]).to eq "Show #{other_per_page} per page"+ end+ end+ end+ end++ it "does not have a link to the current per page option" do+ expect(pagination).to have_css(".op-pagination--options") do |pagination_options|+ expect(pagination_options).to have_no_link text: per_page, exact_text: true, current: "page"+ end+ end++ it "has a focusable element for the current per page option" do+ expect(pagination).to have_css(".op-pagination--options") do |pagination_options|+ expect(pagination_options).to have_css(".op-pagination--item_current", text: per_page)+ expect(pagination_options).to have_element text: per_page, exact_text: true, aria: { current: "page" } do |element|+ expect(element["aria-label"]).to eq "Show #{per_page} per page"+ expect(element["tabindex"]).to eq "0"+ end+ end+ end+ end- expect(pagination).to have_css(".op-pagination--options .op-pagination--item_current", text: per_page)+ context "with no per page", with_settings: { per_page_options: "" } do+ it "renders per page options" do+ expect(pagination).to have_no_css ".op-pagination--options"+ end- path = work_packages_path(page: current_page, per_page: Setting.per_page_options_array.last)- expect(pagination).to have_css(".op-pagination--options a[href='#{path}']")+ it "does not render a labelled nav element" do+ expect(pagination).to have_no_element "nav", aria: { label: "Items per page selection" }+ end+ endenddescribe "WHEN the first page is the current" dolet(:current_page) { 1 }it "deactivates the previous page link" do- expect(pagination).to have_no_css(".op-pagination--item_prev")+ expect(pagination).to have_no_link "Previous"endit "has a link to the next page" dopath = work_packages_path(page: current_page + 1)- expect(pagination).to have_css(".op-pagination--item_next a[href='#{path}']")+ expect(pagination).to have_link "Next", href: pathendend@@ -147,12 +199,12 @@ RSpec.describe PaginationHelper dolet(:current_page) { (total_entries / per_page) + 1 }it "deactivates the next page link" do- expect(pagination).to have_no_css(".op-pagination--item_next")+ expect(pagination).to have_no_link "Next"endit "has a link to the previous page" dopath = work_packages_path(page: current_page - 1)- expect(pagination).to have_css(".op-pagination--item_prev a[href='#{path}']")+ expect(pagination).to have_link "Previous", href: pathendend@@ -166,6 +218,10 @@ RSpec.describe PaginationHelper doit "shows no pagination" doexpect(pagination).to have_no_css(".op-pagination")end++ it "does not render a labelled nav element" do+ expect(pagination).to have_no_element "nav", aria: { label: "Pagination navigation" }+ endendend