Fixes #3740 - Core-Workflow: Option manipulation of boolean attributes not possible.
This commit is contained in:
parent
1a3ecd91f4
commit
81e71de5c1
2 changed files with 168 additions and 1 deletions
|
@ -19,6 +19,12 @@ class App.UiElement.boolean extends App.UiElement.ApplicationUiElement
|
||||||
# find selected/checked item of list
|
# find selected/checked item of list
|
||||||
@selectedOptions(attribute, params)
|
@selectedOptions(attribute, params)
|
||||||
|
|
||||||
|
# disable item of list
|
||||||
|
@disabledOptions(attribute, params)
|
||||||
|
|
||||||
|
# filter attributes
|
||||||
|
@filterOption(attribute, params)
|
||||||
|
|
||||||
item = $(App.view('generic/select')(attribute: attribute))
|
item = $(App.view('generic/select')(attribute: attribute))
|
||||||
item.find('select').data('field-type', 'boolean')
|
item.find('select').data('field-type', 'boolean')
|
||||||
item
|
item
|
||||||
|
|
|
@ -349,6 +349,167 @@ RSpec.shared_examples 'core workflow' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'modify boolean attribute', authenticated_as: :authenticate, db_strategy: :reset do
|
||||||
|
def authenticate
|
||||||
|
create(:object_manager_attribute_boolean, object_name: object_name, name: field_name, display: field_name, screens: screens)
|
||||||
|
ObjectManager::Attribute.migration_execute
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'action - show' do
|
||||||
|
before do
|
||||||
|
create(:core_workflow,
|
||||||
|
object: object_name,
|
||||||
|
perform: {
|
||||||
|
"#{object_name.downcase}.#{field_name}": {
|
||||||
|
operator: 'show',
|
||||||
|
show: 'true'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does perform' do
|
||||||
|
before_it.call
|
||||||
|
expect(page).to have_selector("select[name='#{field_name}']", wait: 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'action - hide' do
|
||||||
|
before do
|
||||||
|
create(:core_workflow,
|
||||||
|
object: object_name,
|
||||||
|
perform: {
|
||||||
|
"#{object_name.downcase}.#{field_name}": {
|
||||||
|
operator: 'hide',
|
||||||
|
hide: 'true'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does perform' do
|
||||||
|
before_it.call
|
||||||
|
expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-hidden", visible: :hidden, wait: 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'action - remove' do
|
||||||
|
before do
|
||||||
|
create(:core_workflow,
|
||||||
|
object: object_name,
|
||||||
|
perform: {
|
||||||
|
"#{object_name.downcase}.#{field_name}": {
|
||||||
|
operator: 'remove',
|
||||||
|
remove: 'true'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does perform' do
|
||||||
|
before_it.call
|
||||||
|
expect(page).to have_selector(".form-group[data-attribute-name='#{field_name}'].is-removed", visible: :hidden, wait: 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'action - set_optional' do
|
||||||
|
before do
|
||||||
|
create(:core_workflow,
|
||||||
|
object: object_name,
|
||||||
|
perform: {
|
||||||
|
"#{object_name.downcase}.#{field_name}": {
|
||||||
|
operator: 'set_optional',
|
||||||
|
set_optional: 'true'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does perform' do
|
||||||
|
before_it.call
|
||||||
|
expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_no_text('*', wait: 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'action - set_mandatory' do
|
||||||
|
before do
|
||||||
|
create(:core_workflow,
|
||||||
|
object: object_name,
|
||||||
|
perform: {
|
||||||
|
"#{object_name.downcase}.#{field_name}": {
|
||||||
|
operator: 'set_mandatory',
|
||||||
|
set_mandatory: 'true'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does perform' do
|
||||||
|
before_it.call
|
||||||
|
expect(page.find("div[data-attribute-name='#{field_name}'] div.formGroup-label label")).to have_text('*', wait: 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'action - restrict values' do
|
||||||
|
before do
|
||||||
|
create(:core_workflow,
|
||||||
|
object: object_name,
|
||||||
|
perform: {
|
||||||
|
"#{object_name.downcase}.#{field_name}": {
|
||||||
|
operator: 'set_fixed_to',
|
||||||
|
set_fixed_to: %w[true]
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does perform' do
|
||||||
|
before_it.call
|
||||||
|
expect(page).to have_selector("select[name='#{field_name}'] option[value='true']", wait: 10)
|
||||||
|
expect(page).to have_no_selector("select[name='#{field_name}'] option[value='false']", wait: 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'action - select' do
|
||||||
|
before do
|
||||||
|
create(:core_workflow,
|
||||||
|
object: object_name,
|
||||||
|
perform: {
|
||||||
|
"#{object_name.downcase}.#{field_name}": {
|
||||||
|
operator: 'select',
|
||||||
|
select: ['true']
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does perform' do
|
||||||
|
before_it.call
|
||||||
|
expect(page).to have_selector("select[name='#{field_name}'] option[value='true'][selected]", wait: 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'action - auto select' do
|
||||||
|
before do
|
||||||
|
create(:core_workflow,
|
||||||
|
object: object_name,
|
||||||
|
perform: {
|
||||||
|
"#{object_name.downcase}.#{field_name}": {
|
||||||
|
operator: 'set_fixed_to',
|
||||||
|
set_fixed_to: ['', 'true'],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
create(:core_workflow,
|
||||||
|
object: object_name,
|
||||||
|
perform: {
|
||||||
|
"#{object_name.downcase}.#{field_name}": {
|
||||||
|
operator: 'auto_select',
|
||||||
|
auto_select: 'true',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does perform' do
|
||||||
|
before_it.call
|
||||||
|
expect(page).to have_selector("select[name='#{field_name}'] option[value='true'][selected]", wait: 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'modify tree select attribute', authenticated_as: :authenticate, db_strategy: :reset do
|
describe 'modify tree select attribute', authenticated_as: :authenticate, db_strategy: :reset do
|
||||||
def authenticate
|
def authenticate
|
||||||
create(:object_manager_attribute_tree_select, object_name: object_name, name: field_name, display: field_name, screens: screens)
|
create(:object_manager_attribute_tree_select, object_name: object_name, name: field_name, display: field_name, screens: screens)
|
||||||
|
|
Loading…
Reference in a new issue