mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Fix custom field form builder specs
This commit is contained in:
@@ -68,13 +68,7 @@ class CustomFieldFormBuilder < TabularFormBuilder
|
||||
|
||||
case field_format.try(:edit_as)
|
||||
when 'date'
|
||||
angular_component_tag 'op-single-date-picker',
|
||||
class: input_options.class,
|
||||
inputs: {
|
||||
value: input_options.value,
|
||||
id: input_options.id,
|
||||
name: input_options.name
|
||||
}
|
||||
date_picker(field, input_options)
|
||||
when 'text'
|
||||
text_area(field, input_options.merge(with_text_formatting: true, macros: false, editor_type: 'constrained'))
|
||||
when 'bool'
|
||||
|
||||
@@ -84,6 +84,7 @@ class TabularFormBuilder < ActionView::Helpers::FormBuilder
|
||||
end
|
||||
|
||||
def date_picker(field, options = {})
|
||||
options[:class] = Array(options[:class])
|
||||
merge_required_attributes(options[:required], options)
|
||||
options[:visible_overflow] = true;
|
||||
|
||||
|
||||
@@ -93,17 +93,14 @@ describe CustomFieldFormBuilder do
|
||||
custom_field.field_format = 'date'
|
||||
end
|
||||
|
||||
it_behaves_like 'wrapped in container', 'text-field-container' do
|
||||
it_behaves_like 'wrapped in container', 'field-container' do
|
||||
let(:container_count) { 2 }
|
||||
end
|
||||
|
||||
it 'outputs element' do
|
||||
expect(output).to be_html_eql(%{
|
||||
<input class="custom-class -augmented-datepicker form--text-field"
|
||||
id="user#{custom_field.id}"
|
||||
name="user[#{custom_field.id}]"
|
||||
type="text" />
|
||||
}).at_path('input')
|
||||
<op-single-date-picker class="custom-class" data-value="null" data-id='"user_custom_field_#{custom_field.id}"' data-name='"user[custom_field_#{custom_field.id}]"'></op-single-date-picker>
|
||||
}).at_path('op-single-date-picker')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user