次の HTML を生成する form_tag があります。
<form accept-charset="UTF-8" action="http://www.example.com/product_page" id="dates_form" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
Min date: <input id="datepicker_mini" name="datepicker_mini" type="text" />
Max date: <input id="datepicker_maxi" name="datepicker_maxi" type="text" />
</form>
上記は、生成された HTML のすべてです。この問題のデバッグをできるだけ簡単にするために、パーシャルとレイアウトをすべて削除しました。
datepicker フィールドは、jquery UI の datepicker を呼び出します。
テストに JavaScript を使用せず、日付フィールドにテキスト日付を入力するだけです。試してみfill_in "datepicker_mini", :with => "01/01/2010"
ましたが、テストが失敗することはありませんが、テストに使用save_and_open_page
したときにフィールドに入力されません。
更新: テストコード
it "runs report" do
login_test_user
within("#dates_form") do
fill_in "datepicker_mini", :with => "01/01/2010"
fill_in "datepicker_maxi", :with => "01/01/2020"
end
save_and_open_page
end
どんな助けでも大歓迎です。
ありがとう。