Sha256: 1d07087b91768c42c4e6de5a71aa7c760f165fc674956e58bf2b131b69c43274

Contents?: true

Size: 1.79 KB

Versions: 3

Compression:

Stored size: 1.79 KB

Contents

require 'test_helper'

class ButtonChoiceTest < ActionView::TestCase
  include UiBibz::Helpers::Ui::CoreHelper

  test 'Button choice checkbox' do
    actual   = ui_button_choice do |bc|
      bc.button 'Checkbox 1'
      bc.button 'Checkbox 2', state: :active
    end
    expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice\"><label class=\"btn-secondary btn\"><input type=\"checkbox\" autocomplete=\"off\" />Checkbox 1</label><label class=\"active btn-secondary btn\" aria-pressed=\"true\"><input type=\"checkbox\" autocomplete=\"off\" checked=\"checked\" />Checkbox 2</label></div>"

    assert_equal expected, actual
  end

  test 'Button choice radio' do
    actual = ui_button_choice type: :radio do |bc|
      bc.button 'Radio 1'
      bc.button 'Radio 2', state: :active
    end
    expected = "<div data-toggle=\"buttons\" class=\"btn-group button-choice\"><label class=\"btn-secondary btn\"><input type=\"radio\" autocomplete=\"off\" />Radio 1</label><label class=\"active btn-secondary btn\" aria-pressed=\"true\"><input type=\"radio\" autocomplete=\"off\" checked=\"checked\" />Radio 2</label></div>"

    assert_equal expected, actual
  end

  test 'Button choice options' do
    actual = ui_button_choice size: :lg, outline: true, type: :radio do |bc|
      bc.button 'Radio 1', glyph: 'diamond', status: :primary
      bc.button 'Radio 2', state: :active
    end
    expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-lg button-choice\"><label class=\"btn-primary btn btn-lg\"><input type=\"radio\" autocomplete=\"off\" /><i class=\"glyph fa fa-diamond\"></i> Radio 1</label><label class=\"active btn-secondary btn btn-lg\" aria-pressed=\"true\"><input type=\"radio\" autocomplete=\"off\" checked=\"checked\" />Radio 2</label></div>"

    assert_equal expected, actual
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ui_bibz-2.0.0.beta2.5 test/ui/core/forms/buttons/button_choice_test.rb
ui_bibz-2.0.0.beta2.4 test/ui/core/forms/buttons/button_choice_test.rb
ui_bibz-2.0.0.beta2.3 test/ui/core/forms/buttons/button_choice_test.rb