diff --git a/spec/form_spec.cr b/spec/form_spec.cr index ce29a40..3fc3d79 100644 --- a/spec/form_spec.cr +++ b/spec/form_spec.cr @@ -8,12 +8,21 @@ WebMock.stub(:get, "example.com/check_form").to_return(body:
+ + + + + + + + +
@@ -33,7 +42,11 @@ describe "Mechanize Form test" do form.name.should eq "sample_form" end - it "includes fields" do - form.fields.size.should eq 2 + it "includes fields, radiobuttons, checkboxes, buttons" do + # fields: input type = (text,hidden, or others) + form.fields.size.should eq 4 + form.checkboxes.size.should eq 1 + form.radiobuttons.size.should eq 3 + form.buttons.size.should eq 3 end end diff --git a/src/mechanize/form.cr b/src/mechanize/form.cr index ea9378d..0663d4d 100644 --- a/src/mechanize/form.cr +++ b/src/mechanize/form.cr @@ -83,11 +83,11 @@ class MechanizeCr::Form when "radio" radiobuttons << FormContent::RadioButton.new(html_node, self) when "button" - @buttons << FormContent::Button.new(html_node) + buttons << FormContent::Button.new(html_node) when "submit" - @buttons << FormContent::SubmitButton.new(html_node) + buttons << FormContent::SubmitButton.new(html_node) when"reset" - @buttons << FormContent::ResetButton.new(html_node) + buttons << FormContent::ResetButton.new(html_node) when "text" fields << FormContent::Text.new(html_node) when "hidden"