Skip to content

Commit

Permalink
downcase auto modules so they are dynamic as well (#3905)
Browse files Browse the repository at this point in the history
  • Loading branch information
johrstrom authored Oct 31, 2024
1 parent 643115b commit 73e5638
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def filter_versions?
# normalize module names so they can be accessed through methods.
# see https://github.com/OSC/ondemand/issues/2933
def normalize_module(module_name)
module_name.to_s.gsub('-', '_')
module_name.to_s.gsub('-', '_').downcase
end

private
Expand Down
34 changes: 34 additions & 0 deletions apps/dashboard/test/system/batch_connect_widgets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,38 @@ def make_bc_app(dir, form)
assert_equal('Four', find("[for='#{bc_ele_id('vector_four')}']").text)
end
end

test 'auto modules something' do
Dir.mktmpdir do |dir|
with_modified_env({ OOD_MODULE_FILE_DIR: 'test/fixtures/modules' }) do
form = <<~HEREDOC
cluster: owens
form:
- auto_modules_R
- module_hider
attributes:
module_hider:
widget: select
options:
- ['show', 'show']
- ['hide', 'hide', data-hide-auto-modules-r: true]
HEREDOC

make_bc_app(dir, form)
visit new_batch_connect_session_context_url('sys/app')

# just to be sure auto_modules_r actually populates with module options
assert_equal(20, find_all_options('auto_modules_r', nil).size)
assert(find("##{bc_ele_id('auto_modules_r')}").visible?)

# select hide and auto_modules_r isn't visible anymore.
select('hide', from: bc_ele_id('module_hider'))
refute(find("##{bc_ele_id('auto_modules_r')}", visible: :hidden).visible?)

# select show and it's back.
select('show', from: bc_ele_id('module_hider'))
assert(find("##{bc_ele_id('auto_modules_r')}").visible?)
end
end
end
end

0 comments on commit 73e5638

Please sign in to comment.