Sha256: 06b4e5e59d036a0c9218ce450cf4cea13a562e5a6fee0b6db54286edb3cd1bdb

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require 'test_helper'

class TextFieldTest < ActionView::TestCase
  test 'text_field without prepend and append' do
    actual = UiBibz::Ui::Core::Forms::Texts::TextField.new('test').render
    expected = '<input type="text" name="test" id="test" class="form-control" />'

    assert_equal expected, actual
  end

  test 'text_field with prepend and append' do
    actual = UiBibz::Ui::Core::Forms::Texts::TextField.new('test', append: '1', prepend: '2').render
    expected = '<div class="input-group ui_surround_field"><span class="input-group-addon">1</span><input type="text" name="test" id="test" class="form-control" /><span class="input-group-addon">2</span></div>'

    assert_equal expected, actual
  end

  test 'text_field size' do
    actual = UiBibz::Ui::Core::Forms::Texts::TextField.new('test', size: :xs, append: '1', prepend: '2').render
    expected = '<div class="input-group-xs input-group ui_surround_field"><span class="input-group-addon">1</span><input type="text" name="test" id="test" class="form-control form-control-xs" /><span class="input-group-addon">2</span></div>'

    assert_equal expected, actual
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ui_bibz-2.5.6 test/ui/core/forms/texts/text_field_test.rb
ui_bibz-2.5.5 test/ui/core/forms/texts/text_field_test.rb
ui_bibz-2.5.3 test/ui/core/forms/texts/text_field_test.rb
ui_bibz-2.5.2 test/ui/core/forms/texts/text_field_test.rb
ui_bibz-2.5.1 test/ui/core/forms/texts/text_field_test.rb
ui_bibz-2.5.0 test/ui/core/forms/texts/text_field_test.rb