Fixes #738 - Object Manager: Max length attribute has no impact on the validation in the browser.
This commit is contained in:
parent
b88d051dec
commit
72c1cab71b
4 changed files with 86 additions and 1 deletions
|
@ -1 +1 @@
|
||||||
<input id="<%= @attribute.id %>" type="<%= @attribute.type %>" name="<%= @attribute.name %>" value="<%= @attribute.value %>" class="form-control <%= @attribute.class %>" <% if @attribute.placeholder: %>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 %>/>
|
<input id="<%= @attribute.id %>" type="<%= @attribute.type %>" name="<%= @attribute.name %>" value="<%= @attribute.value %>" class="form-control <%= @attribute.class %>" <% if @attribute.placeholder: %>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 %>/>
|
||||||
|
|
|
@ -317,4 +317,28 @@ RSpec.describe 'Ticket Create', type: :system do
|
||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|
|
@ -1285,4 +1285,31 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
expect(ticket.reload.articles.last.content_type).to eq('text/html')
|
expect(ticket.reload.articles.last.content_type).to eq('text/html')
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
34
spec/system/user/profile_spec.rb
Normal file
34
spec/system/user/profile_spec.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue