Skip to content
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

Normalize bc keys #3867

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dashboard/app/lib/smart_attributes/attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Attribute
# @param id [#to_s] id of attribute
# @param opts [#to_h] options for attribute
def initialize(id, opts = {})
@id = id.to_s
@id = id.to_s.downcase
@opts = opts.to_h.symbolize_keys
end

Expand Down
32 changes: 32 additions & 0 deletions apps/dashboard/test/system/batch_connect_widgets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,36 @@ def make_bc_app(dir, form)
assert_equal('Global Queues', label.text)
end
end

test 'forms correctly deal with capitalized ids' do
Dir.mktmpdir do |dir|
form = <<~HEREDOC
---
form:
- switcher
- Eastern_City
- Western_City
attributes:
switcher:
widget: 'select'
options:
- ["east", data-hide-Western-City: true]
- ["west", data-hide-Eastern-City: true]
HEREDOC

make_bc_app(dir, form)

visit(new_batch_connect_session_context_url('sys/app'))

# select east, and west is no longer visible. Also note that the id is lowercase.
select('east', from: bc_ele_id('switcher'))
assert(find("##{bc_ele_id('eastern_city')}").visible?)
refute(find("##{bc_ele_id('western_city')}", visible: false).visible?)

# select west, and now ease is no longer visible
select('west', from: bc_ele_id('switcher'))
assert(find("##{bc_ele_id('western_city')}").visible?)
refute(find("##{bc_ele_id('eastern_city')}", visible: false).visible?)
end
end
end
Loading