Sha256: aa506502924fe0f1f16e997b88ddb4c351ede1b0d94fe88217143b5927f29a72
Contents?: true
Size: 1.6 KB
Versions: 1
Compression:
Stored size: 1.6 KB
Contents
require "helper" class TestPadrinoFieldsSettings < ActiveSupport::TestCase should "make setup block yield self" do PadrinoFields::Settings.configure do |config| assert_equal PadrinoFields::Settings, config end end context "for #container setting" do should "wrap field in a custom container" do PadrinoFields::Settings.container = :div actual = field.input(:name) assert_has_tag("div") { actual } end end context "for #label_required_marker setting" do should "display custom label marker for a required field" do PadrinoFields::Settings.label_required_marker = "*" actual = field.setup_label(:name, 'string') assert_has_tag("label", :content => "*Name") { actual } end end context "for #label_required_marker_position setting" do should "prepend label marker to a required field" do PadrinoFields::Settings.label_required_marker_position = :prepend actual = field.setup_label(:name, 'string') assert_has_tag("label", :content => "*Name") { actual } end should "append label marker to a required field" do PadrinoFields::Settings.label_required_marker_position = :append actual = field.setup_label(:name, 'string') assert_has_tag("label", :content => "Name*") { actual } end end %w(date email number search tel url).each do |type| class_eval <<-EOF context 'for ##{type}_field method' do should "return a #{type} field" do actual = field.#{type}_field('#{type}') assert_has_tag('input', type:'#{type}') { actual } end end EOF end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
padrino-fields-0.3.3 | test/test_settings.rb |