Sha256: 21e199a819f0216e534b3fc36f8bf7204dc7c325ad7468efb723a8478f16e9a7

Contents?: true

Size: 1.42 KB

Versions: 53

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

require 'test_helper'

class MultiColumnFieldTest < ActionView::TestCase
  test 'Multi Column Field' do
    options  = options_for_select(Array.new(2) { |i| "option #{i}" })
    actual   = UiBibz::Ui::Core::Forms::Selects::MultiColumnField.new('example', option_tags: options).render
    expected = "<select name=\"example[]\" id=\"example\" class=\"multi-column-field\" multiple=\"multiple\"><option value=\"option 0\">option 0</option>
<option value=\"option 1\">option 1</option></select>"

    assert_equal expected, actual
  end

  test 'Multi Column Field data html options' do
    grouped_options = { 'North America' => [['United statuss', 'US'], 'Canada'], 'Europe' => %w[Denmark Germany France] }
    actual = UiBibz::Ui::Core::Forms::Selects::MultiColumnField.new('example', { option_tags: grouped_options_for_select(grouped_options), searchable: true, selectable_opt_group: true }).render
    expected = "<select name=\"example[]\" id=\"example\" data-searchable=\"true\" data-selectable-optgroup=\"true\" class=\"multi-column-field\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United statuss</option>
<option value=\"Canada\">Canada</option></optgroup><optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>
<option value=\"Germany\">Germany</option>
<option value=\"France\">France</option></optgroup></select>"

    assert_equal expected, actual
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
ui_bibz-4.0.0.beta16 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-4.0.0.beta15 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-4.0.0.beta14 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-4.0.0.beta13 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-4.0.0.beta10 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-4.0.0.beta9 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-4.0.0.beta8 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-4.0.0.beta7 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-4.0.0.beta6 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-4.0.0.beta4 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-4.0.0.beta3 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-3.0.13 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-3.0.12 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-3.0.11 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-3.0.10 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-3.0.9 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-3.0.8 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-3.0.7 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-3.0.6 test/ui/core/forms/selects/multi_column_field_test.rb
ui_bibz-3.0.5 test/ui/core/forms/selects/multi_column_field_test.rb