We applied the Capybara/SpecificMatcher in commit f52a86b46. However,
this rule doesn't convert methods finding <a> tags to methods finding
links because <a> tags only count as links when they've got the `href`
attribute. For instance, in the `xss_spec.rb` file we check what happens
when clicking on an anchor tag because we're testing that the `href`
attribute has been removed and so we can't use `click_link`.
So, basically, we can't enable a rule to automatically detect when we're
using `have_css` instead of `have_link`, but we should still do it
because `have_link` adds an extra check which affects accessibility
since it makes sure the tag has the `href` attribute and so it's
recognizable as a link by screen readers.
17 lines
538 B
Ruby
17 lines
538 B
Ruby
require "rails_helper"
|
|
|
|
describe Budgets::PhasesComponent do
|
|
let(:budget) { create(:budget) }
|
|
|
|
it "shows budget current phase main link when defined" do
|
|
render_inline Budgets::PhasesComponent.new(budget)
|
|
|
|
expect(page).not_to have_css(".main-link")
|
|
|
|
budget.current_phase.update!(main_link_text: "Phase link!", main_link_url: "https://consuldemocracy.org")
|
|
render_inline Budgets::PhasesComponent.new(budget)
|
|
|
|
expect(page).to have_link "Phase link!", href: "https://consuldemocracy.org", class: "main-link"
|
|
end
|
|
end
|