Fixes #3271 - AttributeManager doesn't display boolean default values within the UI

This commit is contained in:
Romit Choudhary 2021-09-09 14:40:53 +02:00 committed by Thorsten Eckel
parent 41691e9846
commit 3b0a373de0
2 changed files with 20 additions and 2 deletions

View file

@ -13,14 +13,14 @@
<td class="settings-list-control-cell"> <td class="settings-list-control-cell">
<input class="form-control form-control--small js-valueTrue" type="text" value="<% if @params.data_option && @params.data_option.options: %><%= @params.data_option.options[true] %><% end %>" name="data_option::options::true" placeholder="<%- @T('yes') %>" required/> <input class="form-control form-control--small js-valueTrue" type="text" value="<% if @params.data_option && @params.data_option.options: %><%= @params.data_option.options[true] %><% end %>" name="data_option::options::true" placeholder="<%- @T('yes') %>" required/>
<td class="settings-list-row-control"> <td class="settings-list-row-control">
<input class="js-selected js-boolean" type="radio" name="data_option::default" value="true" <% if @params.data_option && @params.data_option.default is 'true': %>checked<% end %>/> <input class="js-selected js-boolean" type="radio" name="data_option::default" value="true" <% if @params.data_option && @params.data_option.default is true: %>checked<% end %>/>
<tr> <tr>
<td class="settings-list-control-cell"> <td class="settings-list-control-cell">
false false
<td class="settings-list-control-cell"> <td class="settings-list-control-cell">
<input class="form-control form-control--small js-valueFalse" type="text" value="<% if @params.data_option && @params.data_option.options: %><%= @params.data_option.options[false] %><% end %>" name="data_option::options::false" placeholder="<%- @T('no') %>" required/> <input class="form-control form-control--small js-valueFalse" type="text" value="<% if @params.data_option && @params.data_option.options: %><%= @params.data_option.options[false] %><% end %>" name="data_option::options::false" placeholder="<%- @T('no') %>" required/>
<td class="settings-list-row-control"> <td class="settings-list-row-control">
<input class="js-selected js-boolean" type="radio" name="data_option::default" value="false" <% if @params.data_option && @params.data_option.default is 'false': %>checked<% end %>/> <input class="js-selected js-boolean" type="radio" name="data_option::default" value="false" <% if @params.data_option && @params.data_option.default is false: %>checked<% end %>/>
</tbody> </tbody>
</table> </table>
</div> </div>

View file

@ -114,6 +114,24 @@ RSpec.describe 'Admin Panel > Objects', type: :system do
expect(ObjectManager::Attribute.last.data_option['options']).to eq(expected_data_options) expect(ObjectManager::Attribute.last.data_option['options']).to eq(expected_data_options)
end end
it 'checks default boolean value visibility' do
page.find('.js-new').click
fill_in 'Name', with: 'bool1'
find('input[name=display]').set('Bool 1')
page.find('select[name=data_type]').select('Boolean')
choose('data_option::default', option: 'true')
page.find('.js-submit').click
td = page.find(:css, 'td', text: 'bool1')
tr = td.find(:xpath, './parent::tr')
tr.click
expect(page).to have_checked_field('data_option::default', with: 'true')
end
# https://github.com/zammad/zammad/issues/3647 # https://github.com/zammad/zammad/issues/3647
context 'when setting Min/Max values for integer' do context 'when setting Min/Max values for integer' do
before do before do