Sha256: 236c470d64b424c6d9d631daddb961bfd88ebbfeb5b2102edd60c62382b7fc76

Contents?: true

Size: 870 Bytes

Versions: 5

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true

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><span class="empty-space"> </span>'

    assert_equal expected, actual
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ui_bibz-3.0.0.alpha8 test/ui/core/component_test.rb
ui_bibz-3.0.0.alpha6 test/ui/core/component_test.rb
ui_bibz-3.0.0.alpha5 test/ui/core/component_test.rb
ui_bibz-3.0.0.alpha3 test/ui/core/component_test.rb
ui_bibz-3.0.0.alpha2 test/ui/core/component_test.rb