Skip to content

Commit

Permalink
Merge pull request #352 from pulibrary/344-preserve-locker-size-choice
Browse files Browse the repository at this point in the history
Saving size selection when changing floor selection
  • Loading branch information
christinach authored Oct 23, 2024
2 parents 6de5333 + 67d3bee commit 5cfbe70
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/javascript/components/locker_size_filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ export default class LockerSizeFilter {
#addListener() {
this.preferredFloor.addEventListener('change', () => {
if (this.library === 'Firestone') {
const selectedFloor = this.preferredSize.value;
if (this.preferredFloor.value === 'A floor') {
this.preferredSize.options.length = 0;
this.preferredSize[0] = new Option('6-foot', 6);
} else {
this.preferredSize.options.length = 0;
this.preferredSize[0] = new Option('4-foot', 4);
this.preferredSize[1] = new Option('6-foot', 6);
this.preferredSize.value = selectedFloor;
}
}
});
Expand Down
9 changes: 9 additions & 0 deletions spec/features/locker_application_new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@
new_application.reload
expect(new_application.accessibility_needs).to contain_exactly('Keyed entry (rather than combination)')
end

it 'keeps the selected locker size when selecting floor' do
visit root_path
select('Firestone Library', from: :locker_application_building_id)
click_button('Next')
select('6-foot', from: :locker_application_preferred_size)
select('C floor', from: :locker_application_preferred_general_area)
expect(page).to have_select('Preferred Size', selected: '6-foot')
end
end

context 'with lewis_patrons off' do
Expand Down

0 comments on commit 5cfbe70

Please sign in to comment.