Sha256: 54f1823d0ebe82e3232d5a00cbd077d241cb7d259b86d70ef8f27f403d454989

Contents?: true

Size: 1.13 KB

Versions: 43

Compression:

Stored size: 1.13 KB

Contents

# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe HashAsHiddenFieldsHelper do
  include HashAsHiddenFieldsHelper
  before(:each) do
    @hash = {:q => "query", :search_field => "search_field", :per_page=>10, :page=>5, :extra_arbitrary_key=>"arbitrary_value", :f=> {:field1 => ["a", "b"], :field2=> ["z"]}}
  end

  it "should convert a hash with nested complex data to Rails-style hidden form fields" do

    generated = hash_as_hidden_fields(@hash)

    generated.should have_selector("input[type='hidden'][name='q'][value='query']")
    generated.should have_selector("input[type='hidden'][name='per_page'][value='10']")
    generated.should have_selector("input[type='hidden'][name='page'][value='5']")
    generated.should have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']")
    generated.should have_selector("input[type='hidden'][name='f[field2][]'][value='z']")
    generated.should have_selector("input[type='hidden'][name='f[field1][]'][value='a']")
    generated.should have_selector("input[type='hidden'][name='f[field1][]'][value='b']")
    
  end

end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
blacklight-4.6.3 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.6.2 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.6.1 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-5.0.0.pre1 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.6.0 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.5.0 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.5.0.rc1 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.4.2 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.4.1 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.4.0 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.3.0 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.2.2 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.2.1 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.2.0 spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.1.0 test_support/spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.0.1 test_support/spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-3.8.2 test_support/spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.0.0 test_support/spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.0.0.rc2 test_support/spec/helpers/hash_as_hidden_fields_spec.rb
blacklight-4.0.0.rc1 test_support/spec/helpers/hash_as_hidden_fields_spec.rb