Sha256: 4ece86508f647a7747ab7f856f46db7af52602ce755b4e17d6c48bfb8286f8b7

Contents?: true

Size: 1.9 KB

Versions: 16

Compression:

Stored size: 1.9 KB

Contents

require 'test_helper'

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

  test 'button group' do
    actual = ui_button_group do |bg|
      bg.button 'state'
    end
    expected = "<div class=\"btn-group\" role=\"group\"><button class=\"btn\">state</button></div>"

    assert_equal expected, actual
  end

  test 'button group vertical' do
    actual = ui_button_group(position: :vertical) do |bg|
      bg.button 'state'
    end
    expected = "<div class=\"btn-group-vertical\" role=\"group\"><button class=\"btn\">state</button></div>"

    assert_equal expected, actual
  end

  test 'button group status' do
    actual = ui_button_group(status: :primary) do |bg|
      bg.button 'state'
    end
    expected = "<div class=\"btn-group\" role=\"group\"><button class=\"btn-primary btn\">state</button></div>"

    assert_equal expected, actual
  end

  test 'button group size' do
    actual = ui_button_group(size: :sm) do |bg|
      bg.button 'state'
    end
    expected = "<div class=\"btn-group btn-group-sm\" role=\"group\"><button class=\"btn btn-sm\">state</button></div>"

    assert_equal expected, actual
  end

  test 'button group with dropdown' do
    actual = ui_button_group do |bg|
      bg.dropdown("Dropdown", { type: :dropup, status: :success }, { id: 'dropdown-test' }) do |d|
        d.link 'Link 1', url: '#link1', glyph: 'eye'
      end
    end
    expected = "<div class=\"btn-group\" role=\"group\"><div id=\"dropdown-test\" class=\"dropup btn-group\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"dropdown-test\">Dropdown <span class=\"caret\"></span></button><div class=\"dropdown-menu\" arial-labelledby=\"dropdown-test\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fas fa-eye\"></i>  Link 1</a></div></div></div>"

    assert_equal expected, actual
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ui_bibz-2.1.5 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.1.4 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.1.3 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.1.2 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.1.1 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.0.10 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.0.9 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.1.0 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.0.8 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.0.7 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.0.5 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.0.4 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.0.3 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.0.2 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.0.1 test/ui/core/forms/buttons/button_group_test.rb
ui_bibz-2.0.0 test/ui/core/forms/buttons/button_group_test.rb