Skip to content

Commit

Permalink
Adds failing test for data-option-exclusive-for-*
Browse files Browse the repository at this point in the history
  • Loading branch information
HazelGrant committed Dec 18, 2024
1 parent 7f1bdb4 commit 4205ae7
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions apps/dashboard/test/system/batch_connect_widgets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -480,4 +480,53 @@ def make_bc_app(dir, form)
assert_equal display_property, options[1].style('display')
end
end

test 'data-option-exlusive-for-*' do
Dir.mktmpdir do |dir|
"#{dir}/app".tap { |d| Dir.mkdir(d) }
SysRouter.stubs(:base_path).returns(Pathname.new(dir))
stub_scontrol
stub_sacctmgr
stub_git("#{dir}/app")

form = <<~HEREDOC
---
form:
- cluster
- node_type
attributes:
cluster:
widget: "select"
options:
- owens
- pitzer
node_type:
widget: "select"
options:
- standard
- ['gpu', 'gpu', data-option-exclusive-for-cluster-owens: true]
HEREDOC

Pathname.new("#{dir}/app/").join('form.yml').write(form)
base_id = 'batch_connect_session_context_path'

visit new_batch_connect_session_context_url('sys/app')

# owens is selected, standard and gpu are both visible
select('owens', from: 'batch_connect_session_context_cluster')
options = find_all("#batch_connect_session_context_node_type option")

assert_equal "standard", options[0]["innerHTML"]
assert_equal "gpu", options[1]["innerHTML"]

# pitzer is selected, gpu is not visible
select('pitzer', from: 'batch_connect_session_context_cluster')
options = find_all("#batch_connect_session_context_node_type option")

display_property = { "display" => "none" }

assert_equal "standard", options[0]["innerHTML"]
assert_equal display_property, options[1].style('display')
end
end
end

0 comments on commit 4205ae7

Please sign in to comment.