mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Use custom selectors in within methods
This continues the centralization of XPath generation and failure messages.
This commit is contained in:
parent
fd7cf4a4bc
commit
ea8463c010
2 changed files with 6 additions and 2 deletions
|
@ -100,6 +100,10 @@ Capybara.add_selector(:field) do
|
|||
xpath { |locator, options| XPath::HTML.field(locator) }
|
||||
end
|
||||
|
||||
Capybara.add_selector(:fieldset) do
|
||||
xpath { |locator, options| XPath::HTML.fieldset(locator) }
|
||||
end
|
||||
|
||||
Capybara.add_selector(:link_or_button) do
|
||||
xpath { |locator, options| XPath::HTML.link_or_button(locator) }
|
||||
failure_message { |node, selector| "no link or button '#{selector.locator}' found" }
|
||||
|
|
|
@ -203,7 +203,7 @@ module Capybara
|
|||
# @param [String] locator Id or legend of the fieldset
|
||||
#
|
||||
def within_fieldset(locator)
|
||||
within :xpath, XPath::HTML.fieldset(locator) do
|
||||
within :fieldset, locator do
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
@ -215,7 +215,7 @@ module Capybara
|
|||
# @param [String] locator Id or caption of the table
|
||||
#
|
||||
def within_table(locator)
|
||||
within :xpath, XPath::HTML.table(locator) do
|
||||
within :table, locator do
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue