This commit is contained in:
parent
fddc165d86
commit
9be7269646
3 changed files with 104 additions and 12 deletions
|
@ -621,7 +621,7 @@ to send no browser reload event, pass false
|
||||||
# config changes
|
# config changes
|
||||||
if attribute.to_config
|
if attribute.to_config
|
||||||
execute_config_count += 1
|
execute_config_count += 1
|
||||||
if attribute.data_option[:options]
|
if attribute.data_type == 'select' && attribute.data_option[:options]
|
||||||
historical_options = attribute.data_option[:historical_options] || {}
|
historical_options = attribute.data_option[:historical_options] || {}
|
||||||
historical_options.update(attribute.data_option[:options])
|
historical_options.update(attribute.data_option[:options])
|
||||||
historical_options.update(attribute.data_option_new[:options])
|
historical_options.update(attribute.data_option_new[:options])
|
||||||
|
@ -634,7 +634,7 @@ to send no browser reload event, pass false
|
||||||
next if !attribute.to_create && !attribute.to_migrate && !attribute.to_delete
|
next if !attribute.to_create && !attribute.to_migrate && !attribute.to_delete
|
||||||
end
|
end
|
||||||
|
|
||||||
if attribute.data_option[:options]
|
if attribute.data_type == 'select' && attribute.data_option[:options]
|
||||||
attribute.data_option[:historical_options] = attribute.data_option[:options]
|
attribute.data_option[:historical_options] = attribute.data_option[:options]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -116,4 +116,94 @@ class AdminObjectManagerTreeSelectTest < TestCase
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# verify the fix for issue #2206 - Unable to modify tree_select attributes with fresh 2.6
|
||||||
|
def test_modify_tree_select_attributes
|
||||||
|
@browser = instance = browser_instance
|
||||||
|
login(
|
||||||
|
username: 'master@example.com',
|
||||||
|
password: 'test',
|
||||||
|
url: browser_url,
|
||||||
|
)
|
||||||
|
tasks_close_all()
|
||||||
|
|
||||||
|
object_manager_attribute_create(
|
||||||
|
data: {
|
||||||
|
name: 'browser_test_tree_select2',
|
||||||
|
display: 'Browser Test TreeSelect2',
|
||||||
|
data_type: 'Tree Select',
|
||||||
|
data_option: {
|
||||||
|
options: {
|
||||||
|
'Incident' => {
|
||||||
|
'Hardware' => {
|
||||||
|
'Monitor' => {},
|
||||||
|
'Mouse' => {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'Service request' => {
|
||||||
|
'New software requirement' => {},
|
||||||
|
'New hardware' => {},
|
||||||
|
},
|
||||||
|
'Change request' => {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
object_manager_attribute_migrate
|
||||||
|
|
||||||
|
# open the newly created tree_select and add some new options
|
||||||
|
object_manager_attribute_update(
|
||||||
|
data: {
|
||||||
|
name: 'browser_test_tree_select2',
|
||||||
|
},
|
||||||
|
do_not_submit: true,
|
||||||
|
)
|
||||||
|
|
||||||
|
# add two new first level entries
|
||||||
|
2.times do |i|
|
||||||
|
instance.find_elements(css: '.modal .js-treeTable .js-key').last.click
|
||||||
|
|
||||||
|
element = instance.find_elements(css: '.modal .js-treeTable .js-key').last
|
||||||
|
element.clear
|
||||||
|
element.send_keys("new tree option #{i}")
|
||||||
|
end
|
||||||
|
|
||||||
|
click(
|
||||||
|
css: '.modal button.js-submit'
|
||||||
|
)
|
||||||
|
modal_disappear
|
||||||
|
|
||||||
|
object_manager_attribute_migrate
|
||||||
|
|
||||||
|
# open the tree select again and check that the newly added options are there
|
||||||
|
watch_for(
|
||||||
|
css: '.content.active table',
|
||||||
|
value: 'browser_test_tree_select2',
|
||||||
|
)
|
||||||
|
object_manager_attribute_update(
|
||||||
|
data: {
|
||||||
|
name: 'browser_test_tree_select2',
|
||||||
|
},
|
||||||
|
do_not_submit: true,
|
||||||
|
)
|
||||||
|
2.times do |i|
|
||||||
|
exists(
|
||||||
|
css: '.modal .js-treeTable',
|
||||||
|
value: "new tree option #{i}",
|
||||||
|
)
|
||||||
|
end
|
||||||
|
modal_close
|
||||||
|
|
||||||
|
# clean up and confirm the deletion of newly created attributes
|
||||||
|
object_manager_attribute_delete(
|
||||||
|
data: {
|
||||||
|
name: 'browser_test_tree_select2',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
object_manager_attribute_migrate
|
||||||
|
|
||||||
|
match_not(
|
||||||
|
css: '.content.active table',
|
||||||
|
value: 'browser_test_tree_select2',
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4196,6 +4196,7 @@ wait untill text in selector disabppears
|
||||||
options: data[:data_option][:options],
|
options: data[:data_option][:options],
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
if action == 'update'
|
||||||
# first clear all existing entries
|
# first clear all existing entries
|
||||||
loop do
|
loop do
|
||||||
target = {
|
target = {
|
||||||
|
@ -4207,6 +4208,7 @@ wait untill text in selector disabppears
|
||||||
click(target)
|
click(target)
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
|
end
|
||||||
|
|
||||||
# then populate the table with the new values
|
# then populate the table with the new values
|
||||||
data[:data_option][:options].each do |key, value|
|
data[:data_option][:options].each do |key, value|
|
||||||
|
|
Loading…
Reference in a new issue