ref: dockerize
test/unit/buttons_helper_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
require_relative "../test_helper" class ButtonsHelperTest < ActionView::TestCase include ButtonsHelper should 'append with-text class and keep existing classes' do expects(:button_without_text).with('type', 'label', 'url', { :class => 'with-text class1'}) button('type', 'label', 'url', { :class => 'class1' }) end should 'envelop a html with button-bar div' do result = button_bar { content_tag :b, 'foo' } assert_equal '<div class=" button-bar"><b>foo</b>'+ '<br style="clear: left;" /></div>', result end should 'add more classes to button-bar envelope' do result = button_bar :class=>'test' do content_tag :b, 'foo' end assert_equal '<div class="test button-bar"><b>foo</b>'+ '<br style="clear: left;" /></div>', result end should 'add more attributes to button-bar envelope' do result = button_bar :id=>'bt1' do content_tag :b, 'foo' end assert_tag_in_string result, :tag =>'div', :attributes => {:class => ' button-bar', :id => 'bt1'} assert_tag_in_string result, :tag =>'b', :content => 'foo', :parent => {:tag => 'div', :attributes => {:id => 'bt1'}} assert_tag_in_string result, :tag =>'br', :parent => {:tag => 'div', :attributes => {:id => 'bt1'}} end end |