Sha256: 82310fcb5ac08154fdc758b94eb0f78b284bceab78ff3b87e6d5d5cbc4f99af2

Contents?: true

Size: 1.74 KB

Versions: 5

Compression:

Stored size: 1.74 KB

Contents

require 'test_helper'

class BootstrapButtonHelperTest < ActionView::TestCase
  include BootstrapBaseHelper

  test 'a' do
    text = btn('button', block: true, size: 'small', class: 'primary', icon: 'plus', js: 'alert(1)')

    assert_not_nil text
    assert_match /<a /i, text
    assert_match /class="btn/i, text
    assert_match /btn-primary/i, text
    assert_match /btn-small/i, text
    assert_match /btn-block/i, text
    assert_match /class="icon-plus/i, text
  end

  test 'button' do
    text = btn('button', block: true, size: 'small', class: 'primary', icon: 'plus', js: 'alert(1)', type: 'button')

    assert_not_nil text
    assert_match /<button /i, text
    assert_match /class="btn/i, text
    assert_match /btn-primary/i, text
    assert_match /btn-small/i, text
    assert_match /btn-block/i, text
    assert_match /class="icon-plus/i, text
  end

  test 'submit' do
    text = btn('button', block: true, size: 'small', class: 'primary', icon: 'plus', type: 'submit')

    assert_not_nil text
    assert_match /<label /i, text
    assert_match /<input /i, text
    assert_match /type="submit"/i, text
    assert_match /class="btn/i, text
    assert_match /btn-primary/i, text
    assert_match /btn-small/i, text
    assert_match /btn-block/i, text
    assert_match /class="icon-plus/i, text
  end

  test 'disabled button' do
    text = btn('button', block: true, size: 'small', class: 'primary', icon: 'plus', js: 'alert(1)', type: 'button', disabled: true)

    assert_not_nil text
    assert_match /<button /i, text
    assert_match /class="btn/i, text
    assert_match /disabled="disabled"/i, text
    assert_match /btn-primary/i, text
    assert_match /btn-small/i, text
    assert_match /btn-block/i, text
    assert_match /class="icon-plus/i, text
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bs-helper-0.1.4 test/unit/helpers/bootstrap_button_helper_test.rb
bs-helper-0.1.3 test/unit/helpers/bootstrap_button_helper_test.rb
bs-helper-0.1.2 test/unit/helpers/bootstrap_button_helper_test.rb
bs-helper-0.1.1 test/unit/helpers/bootstrap_button_helper_test.rb
bs-helper-0.1.0 test/unit/helpers/bootstrap_button_helper_test.rb