require 'test_helper'
include UiBibz::Helpers
class InputsTest < ActionView::TestCase
test "Date Picker Field" do
actual = UiBibz::Ui::Core::DatePickerField.new(['date_1', 'date_2'], { append: 'a', prepend: 'b', range: 'u' }, { class: 'datepicker-test' }).render
expected = "
aub
"
assert_equal expected, actual
end
test "Date Picker Field data html options" do
actual = UiBibz::Ui::Core::DatePickerField.new('date', { date_today_highlight: true, calendar_weeks: true, autoclose: true, dates_disabled: ["11/01/2016", "12/01/2016"] }, { class: 'datepicker-test' }).render
expected = ""
assert_equal expected, actual
end
test "Multi Column Field" do
options = options_for_select(2.times.map{ |i| "option #{i}" })
actual = UiBibz::Ui::Core::MultiColumnField.new('example', option_tags: options).render
expected = ""
assert_equal expected, actual
end
test "Multi Column Field data html options" do
grouped_options = { 'North America' => [['United statuss','US'], 'Canada'], 'Europe' => ['Denmark','Germany','France'] }
actual = UiBibz::Ui::Core::MultiColumnField.new('example', { option_tags: grouped_options_for_select(grouped_options), searchable: true, selectable_opt_group: true }).render
expected = ""
assert_equal expected, actual
end
test "Multi Select Field" do
options = options_for_select(2.times.map{ |i| "option #{i}" })
actual = UiBibz::Ui::Core::MultiSelectField.new('example', option_tags: options).render
expected = ""
assert_equal expected, actual
end
test "Multi Select Field data html options" do
grouped_options = { 'North America' => [['United statuss','US'], 'Canada'], 'Europe' => ['Denmark','Germany','France'] }
actual = UiBibz::Ui::Core::MultiSelectField.new('example', { option_tags: grouped_options_for_select(grouped_options), clickable_opt_group: true, collapsible_opt_group: true, searchable: true, select_all_option: true, status: :danger }).render
expected = ""
assert_equal expected, actual
end
test 'surround_field without prepend and append' do
actual = UiBibz::Ui::Core::SurroundField.new('test').render
expected = ""
assert_equal expected, actual
end
test 'surround_field with prepend and append' do
actual = UiBibz::Ui::Core::SurroundField.new('test', append: '1', prepend: '2').render
expected = "
12
"
assert_equal expected, actual
end
test 'surround_field size' do
actual = UiBibz::Ui::Core::SurroundField.new('test', size: :xs, append: '1', prepend: '2').render
expected = "
12
"
assert_equal expected, actual
end
test 'autocomplete_field' do
options = options_for_select(2.times.map{ |i| "option #{i}" })
actual = UiBibz::Ui::Core::AutocompleteField.new('test', { option_tags: options }, { id: 'test' }).render
expected = ""
assert_equal expected, actual
end
test 'formula_field' do
actual = UiBibz::Ui::Core::FormulaField.new('value').render
expected = "