Sha256: 2174f127531c6a3f3dd491aed2b10a46df667454d1abee832dca719d3eb9c8d1

Contents?: true

Size: 969 Bytes

Versions: 2

Compression:

Stored size: 969 Bytes

Contents

shared_examples_for 'the icon helper' do
  all_tests_pass_with 'no icon options'
  all_tests_pass_with 'extra icon options'
  all_tests_pass_with 'the :library icon option'
end

#--

shared_examples_for 'no icon options' do
  specify 'creates a <i> with an icon' do
    html = '<i class="far fa-zoom-in"></i>'
    expect(:icon).to generate html
  end
end

shared_examples_for 'extra icon options' do
  specify 'passes the options to the <i>' do
    options = {name: :zoom_in, class: 'important', data: {value: 1}, id: 'my-icon'}
    html = '<i class="important far fa-zoom-in" data-value="1" id="my-icon"></i>'
    expect(icon: options).to generate html
  end
end

shared_examples_for 'the :library icon option' do
  Railsstrap::Icon.libraries.each do |library, library_class|
    specify %Q{set to :#{library}, adds the class "#{library_class}"} do
      html = %r{<i class="#{library_class}.*}
      expect(icon: {library: library}).to generate html
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
railsstrap-4.0.0.beta3 spec/shared/icon_helper.rb
railsstrap-4.0.0.beta2 spec/shared/icon_helper.rb