add button form_test
This commit is contained in:
parent
c627106259
commit
acbd92c79a
@ -8,12 +8,21 @@ WebMock.stub(:get, "example.com/check_form").to_return(body:
|
||||
</head>
|
||||
<body>
|
||||
<form action="post_path" method="post" name="sample_form">
|
||||
<!-- fields -->
|
||||
<input type="text" name="name">
|
||||
<input type="text" name="email">
|
||||
<input type="hidden" name="userid" value="12345">
|
||||
<input type="password" id="pass" name="password">
|
||||
<!-- checkbox -->
|
||||
<input type="checkbox" id="remember_me" name="remember_me" checked>
|
||||
<!-- radiobuttons -->
|
||||
<input type="radio" id="contactChoice1" name="contact" value="email">
|
||||
<input type="radio" id="contactChoice2" name="contact" value="phone">
|
||||
<input type="radio" id="contactChoice3" name="contact" value="mail">
|
||||
<!-- buttons -->
|
||||
<input type="button" value="pushit">
|
||||
<input type="reset" value="no">
|
||||
<input type="submit" value="submit">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@ -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
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user