fix raw_value
parent
acbd92c79a
commit
93b8151abd
|
@ -8,7 +8,7 @@ WebMock.stub(:get, "example.com/form/fields").to_return(body:
|
|||
</head>
|
||||
<body>
|
||||
<form action="post_path" method="post" name="sample_form">
|
||||
<input type="text" name="name">
|
||||
<input type="text" name="name" value="kanezoh">
|
||||
<input type="text" name="email">
|
||||
</form>
|
||||
</body>
|
||||
|
@ -24,5 +24,7 @@ describe "Form Fields" do
|
|||
field = form.fields.first
|
||||
field.type.should eq "text"
|
||||
field.name.should eq "name"
|
||||
field.value.should eq "kanezoh"
|
||||
field.raw_value.should eq "kanezoh"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,10 +10,20 @@ class MechanizeCr::FormContent::Field
|
|||
@name = node.fetch("name", "")
|
||||
@value = value || node.fetch("value", nil)
|
||||
@type = node.fetch("type", "")
|
||||
@raw_value = value
|
||||
@raw_value = @value
|
||||
end
|
||||
|
||||
def query_value
|
||||
[@name, @value || ""]
|
||||
end
|
||||
|
||||
# returns DOM 'id' value
|
||||
def dom_id
|
||||
node.fetch("id", "")
|
||||
end
|
||||
|
||||
# returns DOM 'class' value
|
||||
def dom_class
|
||||
node.fetch("class", "")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue