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