add dom_id,class test

master
Kanezoh 2021-06-19 06:50:35 +09:00
parent 93b8151abd
commit 274d4fa0c5
1 changed files with 11 additions and 1 deletions

View File

@ -9,7 +9,7 @@ WebMock.stub(:get, "example.com/form/fields").to_return(body:
<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" value="kanezoh"> <input type="text" name="name" value="kanezoh">
<input type="text" name="email"> <input type="text" name="email" class="emailClass" id="emailID">
</form> </form>
</body> </body>
</html> </html>
@ -27,4 +27,14 @@ describe "Form Fields" do
field.value.should eq "kanezoh" field.value.should eq "kanezoh"
field.raw_value.should eq "kanezoh" field.raw_value.should eq "kanezoh"
end end
it "returns DOM id and class" do
field = form.fields.first
# dom_id and class returns empty string if there are no id, class
field.dom_id.should eq ""
field.dom_class.should eq ""
field = form.fields[1]
field.dom_id.should eq "emailID"
field.dom_class.should eq "emailClass"
end
end end