Initialize Labels with a session refrence
This commit is contained in:
parent
9e743ea3e2
commit
40e0272dff
@ -96,7 +96,7 @@ module Webrat
|
|||||||
end
|
end
|
||||||
|
|
||||||
def labels
|
def labels
|
||||||
@labels ||= label_elements.map { |element| Label.new(self, element) }
|
@labels ||= label_elements.map { |element| Label.new(@session, element) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def label_elements
|
def label_elements
|
||||||
|
@ -48,7 +48,7 @@ module Webrat
|
|||||||
|
|
||||||
def labels
|
def labels
|
||||||
@labels ||= Webrat::XML.css_search(element, "label").map do |element|
|
@labels ||= Webrat::XML.css_search(element, "label").map do |element|
|
||||||
label = Label.new(nil, element)
|
label = Label.new(@session, element)
|
||||||
@session.elements[Webrat::XML.xpath_to(element)] = label
|
@session.elements[Webrat::XML.xpath_to(element)] = label
|
||||||
label
|
label
|
||||||
end
|
end
|
||||||
|
@ -7,8 +7,8 @@ module Webrat
|
|||||||
".//label"
|
".//label"
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(field, element)
|
def initialize(session, element)
|
||||||
@field = field
|
@session = session
|
||||||
@element = element
|
@element = element
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user