Add set_hidden_field and submit_form methods ND/BH
This commit is contained in:
parent
3abaa924cc
commit
5ee4357cd6
|
@ -74,6 +74,10 @@ module Webrat
|
|||
labels.detect { |label| label.matches_text?(label_text) }
|
||||
end
|
||||
|
||||
def matches_id?(id)
|
||||
@element["id"] == id.to_s
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def fields_by_type(field_types)
|
||||
|
|
|
@ -44,6 +44,11 @@ module Webrat
|
|||
|
||||
alias_method :fills_in, :fill_in
|
||||
|
||||
def set_hidden_field(field_locator, options = {})
|
||||
field = locate_field(field_locator, HiddenField)
|
||||
field.set(options[:to])
|
||||
end
|
||||
|
||||
# Verifies that an input checkbox exists on the current page and marks it
|
||||
# as checked, so that the value will be submitted with the form.
|
||||
#
|
||||
|
@ -256,6 +261,11 @@ module Webrat
|
|||
|
||||
alias_method :clicks_button, :click_button
|
||||
|
||||
def submit_form(id)
|
||||
form = forms.detect { |f| f.matches_id?(id) }
|
||||
form.submit
|
||||
end
|
||||
|
||||
def dom # :nodoc:
|
||||
return @dom if @dom
|
||||
|
||||
|
|
|
@ -180,6 +180,8 @@ module Webrat
|
|||
end
|
||||
|
||||
def_delegators :current_scope, :fill_in, :fills_in
|
||||
def_delegators :current_scope, :set_hidden_field
|
||||
def_delegators :current_scope, :submit_form
|
||||
def_delegators :current_scope, :check, :checks
|
||||
def_delegators :current_scope, :uncheck, :unchecks
|
||||
def_delegators :current_scope, :choose, :chooses
|
||||
|
|
Loading…
Reference in New Issue