diff --git a/app/assets/javascripts/app/views/generic/input.jst.eco b/app/assets/javascripts/app/views/generic/input.jst.eco index bbcfbfe34..0e7dc34b0 100644 --- a/app/assets/javascripts/app/views/generic/input.jst.eco +++ b/app/assets/javascripts/app/views/generic/input.jst.eco @@ -1 +1 @@ -placeholder="<%- @Ti(@attribute.placeholder) %>"<% end %> <%= @attribute.required %> <%= @attribute.autofocus %> <%- @attribute.autocapitalize %> <%- @attribute.autocomplete %> <% if @attribute.min isnt undefined: %> min="<%= @attribute.min %>"<% end %><% if @attribute.max isnt undefined: %> max="<%= @attribute.max %>"<% end %><% if @attribute.step: %> step="<%= @attribute.step %>"<% end %><% if @attribute.disabled: %> disabled<% end %>/> \ No newline at end of file +placeholder="<%- @Ti(@attribute.placeholder) %>"<% end %> <%= @attribute.required %> <%= @attribute.autofocus %> <%- @attribute.autocapitalize %> <%- @attribute.autocomplete %> <% if @attribute.min isnt undefined: %> min="<%= @attribute.min %>"<% end %><% if @attribute.max isnt undefined: %> max="<%= @attribute.max %>"<% end %><% if @attribute.step: %> step="<%= @attribute.step %>"<% end %><% if @attribute.maxlength: %> maxlength="<%= @attribute.maxlength %>"<% end %><% if @attribute.disabled: %> disabled<% end %>/> diff --git a/spec/system/ticket/create_spec.rb b/spec/system/ticket/create_spec.rb index 358673afc..b6bb0857a 100644 --- a/spec/system/ticket/create_spec.rb +++ b/spec/system/ticket/create_spec.rb @@ -317,4 +317,28 @@ RSpec.describe 'Ticket Create', type: :system do end end end + + describe 'object manager attributes maxlength', authenticated_as: :authenticate, db_strategy: :reset do + def authenticate + create :object_manager_attribute_text, name: 'maxtest', display: 'maxtest', screens: attributes_for(:required_screen), data_option: { + 'type' => 'text', + 'maxlength' => 3, + 'null' => true, + 'translate' => false, + 'default' => '', + 'options' => {}, + 'relation' => '', + } + ObjectManager::Attribute.migration_execute + true + end + + it 'checks ticket create' do + visit 'ticket/create' + within(:active_content) do + fill_in 'maxtest', with: 'hellu' + expect(page.find_field('maxtest').value).to eq('hel') + end + end + end end diff --git a/spec/system/ticket/zoom_spec.rb b/spec/system/ticket/zoom_spec.rb index 04d36d0c0..bef7196e1 100644 --- a/spec/system/ticket/zoom_spec.rb +++ b/spec/system/ticket/zoom_spec.rb @@ -1285,4 +1285,31 @@ RSpec.describe 'Ticket zoom', type: :system do expect(ticket.reload.articles.last.content_type).to eq('text/html') end end + + describe 'object manager attributes maxlength', authenticated_as: :authenticate, db_strategy: :reset do + let(:ticket) { create(:ticket, group: Group.find_by(name: 'Users')) } + + def authenticate + ticket + create :object_manager_attribute_text, name: 'maxtest', display: 'maxtest', screens: attributes_for(:required_screen), data_option: { + 'type' => 'text', + 'maxlength' => 3, + 'null' => true, + 'translate' => false, + 'default' => '', + 'options' => {}, + 'relation' => '', + } + ObjectManager::Attribute.migration_execute + true + end + + it 'checks ticket zoom' do + visit "ticket/zoom/#{ticket.id}" + within(:active_content) do + fill_in 'maxtest', with: 'hellu' + expect(page.find_field('maxtest').value).to eq('hel') + end + end + end end diff --git a/spec/system/user/profile_spec.rb b/spec/system/user/profile_spec.rb new file mode 100644 index 000000000..b6eec23d4 --- /dev/null +++ b/spec/system/user/profile_spec.rb @@ -0,0 +1,34 @@ +require 'rails_helper' + +require 'system/examples/text_modules_examples' + +RSpec.describe 'User Profile', type: :system do + let(:customer) { create(:customer) } + + describe 'object manager attributes maxlength', authenticated_as: :authenticate, db_strategy: :reset do + def authenticate + customer + create :object_manager_attribute_text, object_name: 'User', name: 'maxtest', display: 'maxtest', screens: attributes_for(:required_screen), data_option: { + 'type' => 'text', + 'maxlength' => 3, + 'null' => true, + 'translate' => false, + 'default' => '', + 'options' => {}, + 'relation' => '', + } + ObjectManager::Attribute.migration_execute + true + end + + it 'checks ticket create' do + visit "#user/profile/#{customer.id}" + within(:active_content) do + page.find('.profile .js-action').click + page.find('.profile li[data-type=edit]').click + fill_in 'maxtest', with: 'hellu' + expect(page.find_field('maxtest').value).to eq('hel') + end + end + end +end