require 'test_helper'
class RailsBootstrapHelperTest < ActionView::TestCase
include SimpleForm::ActionViewExtensions::FormHelper
tests RailsBootstrapHelper::Helper
def test_status_tag
assert_equal 'Default', status_tag("Default")
assert_equal 'Success', status_tag("Success", level: 'success')
assert_equal 'Warning', status_tag("Warning", level: 'warning')
assert_equal 'Important', status_tag("Important", level: 'important')
assert_equal 'Info', status_tag("Info", level: 'info')
assert_equal 'Inverse', status_tag("Inverse", level: 'inverse')
assert_equal 'Custom Class', status_tag("Custom Class", level: 'inverse', class: "custom")
assert_equal 'Custom ID', status_tag("Custom ID", level: 'inverse', id: "custom")
end
def test_badge_tag
assert_equal 'Default', badge_tag("Default")
assert_equal 'Success', badge_tag("Success", level: 'success')
assert_equal 'Warning', badge_tag("Warning", level: 'warning')
assert_equal 'Danger', badge_tag("Danger", level: 'danger')
assert_equal 'Info', badge_tag("Info", level: 'info')
assert_equal 'Primary', badge_tag("Primary", level: 'primary')
assert_equal 'Custom Class', badge_tag("Custom Class", level: 'primary', class: "custom")
assert_equal 'Custom ID', badge_tag("Custom ID", level: 'primary', id: "custom")
end
def test_pill_badge_tag
assert_equal 'Default', pill_badge_tag("Default")
assert_equal 'Success', pill_badge_tag("Success", level: 'success')
end
def test_button_link_to
assert_equal 'Default', button_link_to("Default", "http://google.com")
assert_equal 'Link', button_link_to("Link", "http://google.com", level: 'link')
assert_equal 'Small Button', button_link_to("Small Button", "http://google.com", size: 'small')
assert_equal 'Default Success', button_link_to("Default Success", "http://google.com", level: 'success')
assert_equal 'Default Small Success', button_link_to("Default Small Success", "http://google.com", size: 'small', level: 'success')
assert_equal 'Custom Class Default Small Success', button_link_to("Custom Class Default Small Success", "http://google.com", class: "custom", size: 'small', level: 'success')
assert_equal 'Custom ID Default Small Success', button_link_to("Custom ID Default Small Success", "http://google.com", id: "custom", size: 'small', level: 'success')
end
def test_button_link_to_outline
assert_equal 'Default', button_link_to("Default", "http://google.com", level: 'outline-secondary')
end
def test_icon_button_link_to
assert_equal ' Default', icon_button_link_to("Default", "http://google.com", icon: 'plus')
assert_equal ' Small Button', icon_button_link_to("Small Button", "http://google.com", size: 'small', icon: 'plus')
assert_equal ' Default Success', icon_button_link_to("Default Success", "http://google.com", level: 'success', icon: 'plus')
assert_equal ' Default Small Success', icon_button_link_to("Default Small Success", "http://google.com", size: 'small', level: 'success', icon: 'plus')
assert_equal ' Custom Class Default Small Success', icon_button_link_to("Custom Class Default Small Success", "http://google.com", class: "custom", size: 'small', level: 'success', icon: 'plus')
assert_equal ' Custom ID Default Small Success', icon_button_link_to("Custom ID Default Small Success", "http://google.com", id: "custom", size: 'small', level: 'success', icon: 'plus')
end
def test_icon_tag
assert_equal '', icon_tag('star')
assert_equal '', icon_tag('star', class: 'text-success')
assert_equal '', icon_tag('star', style: 'color:white')
assert_equal '', icon_tag('star', class: 'text-success', style: 'color:white')
end
end