Permalink
Browse files

Implement PasswordInput.

  • Loading branch information...
1 parent 003fe29 commit 11a72cb5a70c57f1eec8c15dec80ede9a4d1fa54 @mjbellantoni committed Sep 2, 2012
@@ -18,7 +18,7 @@ module Inputs
autoload :NumberInput, "formtastic-bootstrap/inputs/number_input"
# autoload :NumericInput # TODO Where does Formtastic actually define this?
autoload :PasswordInput, "formtastic-bootstrap/inputs/password_input"
- # autoload :PhoneInput
+ autoload :PhoneInput, "formtastic-bootstrap/inputs/phone_input"
# autoload :RadioInput
# autoload :RangeInput
# autoload :SearchInput
@@ -5,7 +5,7 @@ class PhoneInput < Formtastic::Inputs::PhoneInput
include Base::Stringish
def to_html
- generic_input_wrapping do
+ bootstrap_wrapping do
builder.phone_field(method, input_html_options)
end
end
@@ -8,7 +8,6 @@
before do
@output_buffer = ''
mock_everything
- Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
end
describe "when object is provided" do
@@ -18,10 +17,10 @@
end)
end
+ it_should_have_bootstrap_horizontal_wrapping
it_should_have_input_wrapper_with_class(:phone)
- it_should_have_input_wrapper_with_class(:clearfix)
+ it_should_have_input_wrapper_with_class(:input)
it_should_have_input_wrapper_with_class(:stringish)
- it_should_have_input_class_in_the_right_place
it_should_have_input_wrapper_with_id("post_phone_input")
it_should_have_label_with_text(/Phone/)
it_should_have_label_for("post_phone")
@@ -44,6 +43,34 @@
end
+ describe "when index is provided" do
+
+ before do
+ @output_buffer = ''
+ mock_everything
+
+ concat(semantic_form_for(@new_post) do |builder|
+ concat(builder.fields_for(:author, :index => 3) do |author|
+ concat(author.input(:name, :as => :phone))
+ end)
+ end)
+ end
+
+ it 'should index the id of the control group' do
+ output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ end
+
+ it 'should index the id of the select tag' do
+ output_buffer.should have_tag("input#post_author_attributes_3_name")
+ end
+
+ it 'should index the name of the select tag' do
+ output_buffer.should have_tag("input[@name='post[author_attributes][3][name]']")
+ end
+
+ end
+
+
describe "when required" do
it "should add the required attribute to the input's html options" do
with_config :use_required_attribute, true do

0 comments on commit 11a72cb

Please sign in to comment.