Sha256: 1cdb5910a81cec64aed960f49862efe325040cb287cb795c0853ec1d86d9685c

Contents?: true

Size: 895 Bytes

Versions: 11

Compression:

Stored size: 895 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 fa-solid 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 fa-solid fa-diamond\"></i> <span class=\"visually-hidden\">My text</span>"

    assert_equal expected, actual
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ui_bibz-4.0.0.beta16 test/ui/core/component_test.rb
ui_bibz-4.0.0.beta15 test/ui/core/component_test.rb
ui_bibz-4.0.0.beta14 test/ui/core/component_test.rb
ui_bibz-4.0.0.beta13 test/ui/core/component_test.rb
ui_bibz-4.0.0.beta10 test/ui/core/component_test.rb
ui_bibz-4.0.0.beta9 test/ui/core/component_test.rb
ui_bibz-4.0.0.beta8 test/ui/core/component_test.rb
ui_bibz-4.0.0.beta7 test/ui/core/component_test.rb
ui_bibz-4.0.0.beta6 test/ui/core/component_test.rb
ui_bibz-4.0.0.beta4 test/ui/core/component_test.rb
ui_bibz-4.0.0.beta3 test/ui/core/component_test.rb