add normal button

master
Kanezoh 2021-06-30 14:27:34 +09:00
parent a1e57c5ca9
commit 4df61c7906
2 changed files with 9 additions and 1 deletions

View File

@ -24,6 +24,7 @@ WebMock.stub(:get, "example.com/check_form").to_return(body:
<input type="reset" value="no">
<input type="submit" value="submit">
<input type="image" src="images/kaeru.png" alt="gerogero">
<button class="favorite styled" type="button">
</form>
</body>
</html>
@ -48,6 +49,6 @@ describe "Mechanize Form test" do
form.fields.size.should eq 4
form.checkboxes.size.should eq 1
form.radiobuttons.size.should eq 3
form.buttons.size.should eq 4
form.buttons.size.should eq 5
end
end

View File

@ -91,6 +91,13 @@ class MechanizeCr::Form
next if node["name"].empty?
@fields << FormContent::Textarea.new(node, node.inner_text)
end
@node.css("button").each do |node|
node = node.as(Myhtml::Node)
type = node.fetch("type", "submit").downcase
next if type == "reset"
@buttons << FormContent::Button.new(node, @node)
end
end
private def build_query_string(params : Array(Array(String)))