Browse Source

Remove "user" tag

CLDC-1183-assistive-tech
Ted-U 3 years ago
parent
commit
ee21c85aba
  1. 2
      app/helpers/tab_nav_helper.rb
  2. 2
      app/views/organisations/users.html.erb
  3. 2
      app/views/users/_user_list.html.erb
  4. 2
      spec/helpers/tab_nav_helper_spec.rb
  5. 2
      spec/requests/organisations_controller_spec.rb

2
app/helpers/tab_nav_helper.rb

@ -3,7 +3,7 @@ module TabNavHelper
def user_cell(user) def user_cell(user)
link_text = user.name.presence || user.email link_text = user.name.presence || user.email
[govuk_link_to(link_text, user), "<span class=\"govuk-visually-hidden\">User </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{user.email}</span>"].join("\n") [govuk_link_to(link_text, user), "<span class=\"govuk-visually-hidden\"> </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{user.email}</span>"].join("\n")
end end
def location_cell(location, link) def location_cell(location, link)

2
app/views/organisations/users.html.erb

@ -9,7 +9,7 @@
<%= render SubNavigationComponent.new( <%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id), items: secondary_items(request.path, @organisation.id),
) %> ) %>
<h2 class="govuk-visually-hidden">Users</h2> <h2 class="govuk-visually-hidden"> </h2>
<% end %> <% end %>
<% if current_user.data_coordinator? || current_user.support? %> <% if current_user.data_coordinator? || current_user.support? %>

2
app/views/users/_user_list.html.erb

@ -52,7 +52,7 @@
<% row.cell(text: simple_format(org_cell(user), {}, wrapper_tag: "div")) %> <% row.cell(text: simple_format(org_cell(user), {}, wrapper_tag: "div")) %>
<% row.cell(text: user.active? ? user.last_sign_in_at&.to_formatted_s(:govuk_date) : "Deactivated") %> <% row.cell(text: user.active? ? user.last_sign_in_at&.to_formatted_s(:govuk_date) : "Deactivated") %>
<%= govuk_link_to users_path(user) do %> <%= govuk_link_to users_path(user) do %>
<span class="govuk-visually-hidden">User </span><%= user.id %> <span class="govuk-visually-hidden"> </span><%= user.id %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

2
spec/helpers/tab_nav_helper_spec.rb

@ -8,7 +8,7 @@ RSpec.describe TabNavHelper do
describe "#user_cell" do describe "#user_cell" do
it "returns user link and email separated by a newline character" do it "returns user link and email separated by a newline character" do
expected_html = "<a class=\"govuk-link\" href=\"/users\">#{user.name}</a>\n<span class=\"govuk-visually-hidden\">User </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{user.email}</span>" expected_html = "<a class=\"govuk-link\" href=\"/users\">#{user.name}</a>\n<span class=\"govuk-visually-hidden\"> </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{user.email}</span>"
expect(user_cell(user)).to match(expected_html) expect(user_cell(user)).to match(expected_html)
end end
end end

2
spec/requests/organisations_controller_spec.rb

@ -255,7 +255,7 @@ RSpec.describe OrganisationsController, type: :request do
end end
it "shows hidden accesibility fields only for active users in the current user's organisation" do it "shows hidden accesibility fields only for active users in the current user's organisation" do
expected_case_row_log = "<span class=\"govuk-visually-hidden\">User </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{user.email}</span>" expected_case_row_log = "<span class=\"govuk-visually-hidden\"> </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{user.email}</span>"
unauthorized_case_row_log = "<span class=\"govuk-visually-hidden\">User </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{other_org_user.email}</span>" unauthorized_case_row_log = "<span class=\"govuk-visually-hidden\">User </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{other_org_user.email}</span>"
expect(CGI.unescape_html(response.body)).to include(expected_case_row_log) expect(CGI.unescape_html(response.body)).to include(expected_case_row_log)
expect(CGI.unescape_html(response.body)).not_to include(unauthorized_case_row_log) expect(CGI.unescape_html(response.body)).not_to include(unauthorized_case_row_log)

Loading…
Cancel
Save