From 4205ae7cb75654c8a24fa1bf48353a55b09ac7a9 Mon Sep 17 00:00:00 2001 From: HazelGrant Date: Wed, 18 Dec 2024 15:16:28 -0500 Subject: [PATCH] Adds failing test for data-option-exclusive-for-* --- .../test/system/batch_connect_widgets_test.rb | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/apps/dashboard/test/system/batch_connect_widgets_test.rb b/apps/dashboard/test/system/batch_connect_widgets_test.rb index a5851f741..ac20b7837 100644 --- a/apps/dashboard/test/system/batch_connect_widgets_test.rb +++ b/apps/dashboard/test/system/batch_connect_widgets_test.rb @@ -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