Skip to content

Commit

Permalink
Set API Users table to vertical_on_small_screen
Browse files Browse the repository at this point in the history
Using the app's new version of the Table component, this lays the
table's contents out vertically on screens tablet-sized and below.

In the related controller test, I've switched to using a regexp instead
of a string to match the contents of the table cells. The implementation
of `vertical_on_small_screen` embeds some markup in each table cell,
which would break these strict matchers.
  • Loading branch information
mike29736 committed Sep 5, 2023
1 parent 334d924 commit b5cf2a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/views/api_users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
} %>
</div>

<%= render "govuk_publishing_components/components/table", {
<%= render "components/table", {
caption: "API users",
caption_classes: "govuk-visually-hidden",
filterable: true,
vertical_on_small_screen: true,
label: "Filter API users",
head: [
{
Expand Down
4 changes: 2 additions & 2 deletions test/controllers/api_users_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ class ApiUsersControllerTest < ActionController::TestCase
should "list api users" do
create(:api_user, email: "api_user@email.com")
get :index
assert_select "td", "api_user@email.com"
assert_select "td", /api_user@email.com/
end

should "not list web users" do
create(:user, email: "web_user@email.com")
get :index
assert_select "td", count: 0, text: "web_user@email.com"
assert_select "td", count: 0, text: /web_user@email.com/
end
end

Expand Down

0 comments on commit b5cf2a5

Please sign in to comment.