# frozen_string_literal: true require 'test_helper' class AutoCompleteFieldTest < ActionView::TestCase test 'auto_complete_field' do options = options_for_select(Array.new(2) { |i| "option #{i}" }) actual = UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new('test', { option_tags: options }, { id: 'test' }).render expected = " " assert_equal expected, actual end test 'auto_complete_field with refresh button' do options = options_for_select(Array.new(2) { |i| "option #{i}" }) actual = UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new('test', { option_tags: options, refresh: { target: { url: '/' } } }, { id: 'test' }).render expected = "
" assert_equal expected, actual end test 'auto_complete_field with refresh button and append content' do options = options_for_select(Array.new(2) { |i| "option #{i}" }) actual = UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new('test', { option_tags: options, append: 'Append content', refresh: { target: { url: '/' } } }, { id: 'test' }).render expected = "
Append content
" assert_equal expected, actual end test 'auto_complete_field with prepend content' do options = options_for_select(Array.new(2) { |i| "option #{i}" }) actual = UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new('test', { option_tags: options, prepend: 'Append content' }, { id: 'test' }).render expected = "
Append content
" assert_equal expected, actual end end