Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions apps/dashboard/app/assets/stylesheets/batch_connect/sessions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@
background-color: #f5f5f5;
}

.collapsible-app-card {
.collapsible-app-card-toggle {
cursor: pointer;
display: flex;
align-items: center;
justify-content: space-between;

&::after {
content: "";
width: 0;
height: 0;
border-style: solid;
border-width: 0.3rem 0 0.3rem 0.45rem;
border-color: transparent transparent transparent currentColor;
}

&[aria-expanded="true"]::after {
transform: rotate(90deg);
}
}
}

.custom-range {
height: 4px;
box-shadow: inset 0 1px 10px gray;
Expand Down
21 changes: 18 additions & 3 deletions apps/dashboard/app/views/batch_connect/shared/_app_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
<div class="card <%= local_assigns.fetch(:style, "system-and-shared-apps-header") %>">
<div class="card-header"><%= title %></div>
<div class="list-group list-group-flush">
<%
# HTML ids use underscores per project convention (see CONTRIBUTING.md).
# Parameterize the card title so ids stay valid and pair with aria-controls.
slug = title.to_s.parameterize(separator: "_").presence || "group"
list_dom_id = "bc_app_list_#{slug}_items"
%>
<div class="card collapsible-app-card <%= local_assigns.fetch(:style, "system-and-shared-apps-header") %>">
<button
class="card-header collapsible-app-card-toggle"
type="button"
data-bs-toggle="collapse"
data-bs-target="#<%= list_dom_id %>"
aria-expanded="true"
aria-controls="<%= list_dom_id %>"
>
<span><%= title %></span>
</button>
<div id="<%= list_dom_id %>" class="list-group list-group-flush collapse show">
<%-
OodAppGroup.groups_for(
apps: apps,
Expand Down
24 changes: 24 additions & 0 deletions apps/dashboard/test/system/batch_connect_sessions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,30 @@ def stub_scheduler(state, cores: 1, nodes: 1)
assert_equal(I18n.t('dashboard.batch_connect_no_sessions'), no_session_text)
end

test 'collapsible batch connect app menu toggles' do
visit(batch_connect_sessions_path)

within('nav[aria-label="Interactive Apps Menu"]') do
card = find('.collapsible-app-card', match: :first)
button = card.find('button.collapsible-app-card-toggle')
target_id = button['aria-controls']
list_group = card.find("##{target_id}", visible: :all)

assert_equal('false', button['aria-expanded'])
assert_not_includes(list_group[:class], 'show')

button.click

assert_selector("##{target_id}.show")
assert_equal('true', button['aria-expanded'])

button.click

assert_no_selector("##{target_id}.show")
assert_equal('false', button['aria-expanded'])
end
end

test 'queued session' do
Dir.mktmpdir do |dir|
create_test_file(dir)
Expand Down