-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hides path selector button with rest of path selector #3459
Closed
Closed
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
946c803
Hides path selector button with rest of path selector
HazelGrant 282382e
Merge branch 'master' of https://github.com/OSC/ondemand into 3425-da…
HazelGrant c330afc
Adds comment
HazelGrant cac9564
Merge branch 'master' of https://github.com/OSC/ondemand into 3425-da…
HazelGrant 943f603
Fun with bundle
HazelGrant c1cd742
More fun with bundler
HazelGrant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# frozen_string_literal: true | ||
|
||
# TODO: Refactor batch_connect_test.rb to include tests that require slurm | ||
# (testing that things submit) and pull out/write tests for widgets (do not | ||
# require form submission) into this file - perhaps a batch_connect_test/ | ||
# directory | ||
|
||
require 'application_system_test_case' | ||
require 'ood_core/job/adapters/slurm' | ||
|
||
class BatchConnectWidgetsTest < ApplicationSystemTestCase | ||
def setup | ||
stub_sys_apps | ||
stub_user | ||
Configuration.stubs(:bc_dynamic_js).returns(true) | ||
Configuration.stubs(:bc_dynamic_js?).returns(true) #stub the alias too | ||
end | ||
|
||
def stub_git(dir) | ||
Open3.stubs(:capture3) | ||
.with('git', 'describe', '--always', '--tags', chdir: dir) | ||
.returns(['1.2.3', '', exit_success]) | ||
end | ||
|
||
def make_bc_app(dir, form) | ||
SysRouter.stubs(:base_path).returns(Pathname.new(dir)) | ||
app_dir = "#{dir}/app".tap { |d| Dir.mkdir(d) } | ||
stub_scontrol | ||
stub_sacctmgr | ||
stub_git(app_dir) | ||
Pathname.new(app_dir).join('form.yml').write(form) | ||
end | ||
|
||
test 'path_selector can be hidden with data-hide-*' 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 | ||
--- | ||
cluster: | ||
- owens | ||
form: | ||
- path | ||
- hide_path | ||
attributes: | ||
path: | ||
widget: 'path_selector' | ||
directory: "#{Rails.root}" | ||
hide_path: | ||
widget: 'select' | ||
options: | ||
- ['show path', 'show path'] | ||
- ['hide path', 'hide path', data-hide-path: 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') | ||
|
||
select('show path', from: 'batch_connect_session_context_hide_path') | ||
assert find('#batch_connect_session_context_path') | ||
assert find("[data-target='#batch_connect_session_context_path_path_selector']") | ||
|
||
select('hide path', from: 'batch_connect_session_context_hide_path') | ||
refute find('#batch_connect_session_context_path', visible: :hidden).visible? | ||
refute find("[data-target='#batch_connect_session_context_path_path_selector']", visible: :hidden).visible? | ||
end | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem here is that
text_field
is being passed alabel
option, which wraps the label/input HTML combination in its owndiv.form-group
element. So far simply searching for the top.form-group
parent has been easier than over-riding thewrapper_class
on thetext_field
. ... But this isn't my favorite option. I'd rather figure out how to ensure that each widget is only wrapped in one.form-group
div.