Sha256: 723c226a1afcbe0f3794400f6bab0d00e497ed9065dd24bc7838e16236ff0615

Contents?: true

Size: 808 Bytes

Versions: 11

Compression:

Stored size: 808 Bytes

Contents

require 'test_helper'

class ComponentTest < ActionView::TestCase

  test 'create complex component' do
    actual = UiBibz::Ui::Core::Component.new('New component', { state: :active, glyph: 'add' }, { class: 'new-class' }).render
    expected = '<i class="glyph fas fa-add"></i>  New component'

    assert_equal expected, actual
  end

  test 'create complex component with block' do
    actual = UiBibz::Ui::Core::Component.new(state: :active) do
      "New content"
    end.render
    expected = 'New content'

    assert_equal expected, actual
  end

  test 'create component without text and glyph' do
    actual = UiBibz::Ui::Core::Component.new('My text', { glyph: 'diamond', text: false }).render
    expected = "<i class=\"glyph fas fa-diamond\"></i>"

    assert_equal expected, actual
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ui_bibz-2.4.0 test/ui/core/component_test.rb
ui_bibz-2.3.15 test/ui/core/component_test.rb
ui_bibz-2.3.14 test/ui/core/component_test.rb
ui_bibz-2.3.13 test/ui/core/component_test.rb
ui_bibz-2.3.12 test/ui/core/component_test.rb
ui_bibz-2.3.11 test/ui/core/component_test.rb
ui_bibz-2.3.10 test/ui/core/component_test.rb
ui_bibz-2.3.9 test/ui/core/component_test.rb
ui_bibz-2.3.8 test/ui/core/component_test.rb
ui_bibz-2.3.7 test/ui/core/component_test.rb
ui_bibz-2.3.6 test/ui/core/component_test.rb