cirandas.net

ref: master

test/unit/forms_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
require_relative "../test_helper"

class FormsHelperTest < ActiveSupport::TestCase

  include FormsHelper
  include ActionView::Helpers::TagHelper
  include ActionView::Helpers::FormOptionsHelper

  should 'wrapper required fields in <span class=required-field>' do
    content = required('<input type=text name=test>')
    assert_tag_in_string content, :tag => 'span', :attributes => {:class => 'required-field'}
  end

  should 'wrapper required fields message in <span class=required-field>' do
    content = required_fields_message()
    assert_tag_in_string content, :tag => 'span', :attributes => {:class => 'required-field'}
  end

  should 'wrapper highlighted in label pseudoformlabel' do
    content = required_fields_message()
    assert_tag_in_string content, :tag => 'label', :content => 'highlighted', :attributes => {:class => 'pseudoformlabel'}
  end

  should 'show title for option in select' do
    content = options_for_select_with_title({'option_value' => 'option_title'})
    assert_tag_in_string content, :tag => 'option', :attributes => {:title => 'option_value'}
  end

  protected
  include NoosferoTestHelper

end