0
相關聯。在水豚+的Webkit +紅寶石1.9.3,我有以下的HTML測試與現場
simple_form產生時,有一個特定的字段中的錯誤以下。我在「獲取」錯誤文本範圍時遇到了麻煩,並且知道我確實擁有與「標題」關聯的關鍵字,而不是另一個也可能有錯誤的字段。
<div class="input-wrapper string required error">
<div class="input-label">
<label class="string required" for="event_title">
<abbr title="required">*</abbr>
Title
</label>
<span class="error-text">can't be blank</span>
<input id="event_title" class="string required" type="text" value="" size="50" name="event[title]">
</div>
(以及許多其他領域,當然!)
我想測試題目,其實需要,當用戶離開空白,並點擊提交按鈕,錯誤消息「Can」 t是空白的「存在。在調整simple_form來包裝整個事物之前,有沒有辦法簡單地找到標籤,然後轉到DOM中的下一個元素以查看它是否具有「不能空白」的內容?
非常好的一點。我繼承了測試,所以沒有考慮僅僅重構測試一件事情。優秀的建議。 – 2013-03-22 18:38:28