mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
minor code cleanup
This commit is contained in:
parent
ccb409661a
commit
c6d81e7218
1 changed files with 13 additions and 21 deletions
|
@ -195,11 +195,9 @@ Capybara.add_selector(:fillable_field) do
|
|||
label 'field'
|
||||
|
||||
xpath(:allow_self) do |locator, **options|
|
||||
xpath = if options[:allow_self]
|
||||
XPath.descendant_or_self(:input, :textarea)
|
||||
else
|
||||
XPath.descendant(:input, :textarea)
|
||||
end[!XPath.attr(:type).one_of('submit', 'image', 'radio', 'checkbox', 'hidden', 'file')]
|
||||
xpath = XPath.axis(options[:allow_self] ? :"descendant-or-self" : :descendant, :input, :textarea)[
|
||||
!XPath.attr(:type).one_of('submit', 'image', 'radio', 'checkbox', 'hidden', 'file')
|
||||
]
|
||||
locate_field(xpath, locator, options)
|
||||
end
|
||||
|
||||
|
@ -228,11 +226,9 @@ Capybara.add_selector(:radio_button) do
|
|||
label 'radio button'
|
||||
|
||||
xpath(:allow_self) do |locator, **options|
|
||||
xpath = if options[:allow_self]
|
||||
XPath.descendant_or_self(:input)
|
||||
else
|
||||
XPath.descendant(:input)
|
||||
end[XPath.attr(:type) == 'radio']
|
||||
xpath = XPath.axis(options[:allow_self] ? :"descendant-or-self" : :descendant, :input)[
|
||||
XPath.attr(:type) == 'radio'
|
||||
]
|
||||
locate_field(xpath, locator, options)
|
||||
end
|
||||
|
||||
|
@ -248,11 +244,9 @@ end
|
|||
|
||||
Capybara.add_selector(:checkbox) do
|
||||
xpath(:allow_self) do |locator, **options|
|
||||
xpath = if options[:allow_self]
|
||||
XPath.descendant_or_self(:input)
|
||||
else
|
||||
XPath.descendant(:input)
|
||||
end[XPath.attr(:type) == 'checkbox']
|
||||
xpath = XPath.axis(options[:allow_self] ? :"descendant-or-self" : :descendant, :input)[
|
||||
XPath.attr(:type) == 'checkbox'
|
||||
]
|
||||
locate_field(xpath, locator, options)
|
||||
end
|
||||
|
||||
|
@ -387,12 +381,10 @@ end
|
|||
|
||||
Capybara.add_selector(:file_field) do
|
||||
label 'file field'
|
||||
xpath(:allow_self) do |locator, options|
|
||||
xpath = if options[:allow_self]
|
||||
XPath.descendant_or_self(:input)
|
||||
else
|
||||
XPath.descendant(:input)
|
||||
end[XPath.attr(:type) == 'file']
|
||||
xpath(:allow_self) do |locator, **options|
|
||||
xpath = XPath.axis(options[:allow_self] ? :"descendant-or-self" : :descendant, :input)[
|
||||
XPath.attr(:type) == 'file'
|
||||
]
|
||||
locate_field(xpath, locator, options)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue