capybara 2.9.1 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.md +7 -0
- data/README.md +1 -1
- data/lib/capybara/queries/selector_query.rb +4 -1
- data/lib/capybara/selector.rb +8 -4
- data/lib/capybara/spec/session/find_spec.rb +5 -0
- data/lib/capybara/spec/session/selectors_spec.rb +5 -1
- data/lib/capybara/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db09e9654963783c82ada646c4814ddc80c2ddb7
|
4
|
+
data.tar.gz: 17cd310533f903c6074ab255346e37c40046f3e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e20f671c5012aa0edcc8b51e9cd75fcac85ef8e8d784131e12cba87a1d89d6464f64d77f529787803b702d628022a48bf114ad37550995c354c409e25bb2f0b8
|
7
|
+
data.tar.gz: 3257116b6f9eb2584a154aecdc82342a1486a420eff1ebccb9df680ad0816d1f7a15aa1bc5aa8b321dc09471c6c991f035c35aa1c731fa17aa2d6827135a9667
|
data/History.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
#Version 2.9.2
|
2
|
+
Release date: 2016-09-29
|
3
|
+
|
4
|
+
### Fixed
|
5
|
+
* :label built-in selector finds nested label/control by control id if the label has no 'for' attribute [Thomas Walpole]
|
6
|
+
* Warning issued if an unknown selector type is specified
|
7
|
+
|
1
8
|
#Version 2.9.1
|
2
9
|
Release date: 2016-09-23
|
3
10
|
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ through an external gem.
|
|
13
13
|
**Need help?** Ask on the mailing list (please do not open an issue on
|
14
14
|
GitHub): http://groups.google.com/group/ruby-capybara
|
15
15
|
|
16
|
-
**Note: Firefox 48
|
16
|
+
**Note: Firefox 48+** If you're using Firefox with selenium-webdriver, stay on either Firefox [45.0esr](https://ftp.mozilla.org/pub/firefox/releases/45.0esr/) or [47.0.1](https://ftp.mozilla.org/pub/firefox/releases/47.0.1/) and selenium-webdriver 2.53.4. Firefox 48+ requires geckodriver and selenium-webdriver v3, the combo of which currently has multiple issues and is feature incomplete.
|
17
17
|
|
18
18
|
## Table of contents
|
19
19
|
|
@@ -11,7 +11,10 @@ module Capybara
|
|
11
11
|
@options = if args.last.is_a?(Hash) then args.pop.dup else {} end
|
12
12
|
|
13
13
|
if args[0].is_a?(Symbol)
|
14
|
-
@selector = Selector.all
|
14
|
+
@selector = Selector.all.fetch(args.shift) do |selector_type|
|
15
|
+
warn "Unknown selector type (:#{selector_type}), defaulting to :#{Capybara.default_selector} - This will raise an exception in a future version of Capybara"
|
16
|
+
nil
|
17
|
+
end
|
15
18
|
@locator = args.shift
|
16
19
|
else
|
17
20
|
@selector = Selector.all.values.find { |s| s.match?(args[0]) }
|
data/lib/capybara/selector.rb
CHANGED
@@ -429,21 +429,25 @@ end
|
|
429
429
|
#
|
430
430
|
Capybara.add_selector(:label) do
|
431
431
|
label "label"
|
432
|
-
xpath do |locator|
|
432
|
+
xpath(:for) do |locator, options|
|
433
433
|
xpath = XPath.descendant(:label)
|
434
434
|
xpath = xpath[XPath.string.n.is(locator.to_s) | XPath.attr(:id).equals(locator.to_s)] unless locator.nil?
|
435
|
+
if options.has_key?(:for) && !options[:for].is_a?(Capybara::Node::Element)
|
436
|
+
xpath = xpath[XPath.attr(:for).equals(options[:for].to_s).or((~XPath.attr(:for)).and(XPath.descendant()[XPath.attr(:id).equals(options[:for].to_s)]))]
|
437
|
+
end
|
435
438
|
xpath
|
436
439
|
end
|
437
440
|
|
438
441
|
filter(:for) do |node, field_or_value|
|
439
442
|
if field_or_value.is_a? Capybara::Node::Element
|
440
|
-
if
|
441
|
-
|
443
|
+
if node[:for]
|
444
|
+
field_or_value[:id] == node[:for]
|
442
445
|
else
|
443
446
|
field_or_value.find_xpath('./ancestor::label[1]').include? node.base
|
444
447
|
end
|
445
448
|
else
|
446
|
-
|
449
|
+
#Non element values were handled through the expression filter
|
450
|
+
true
|
447
451
|
end
|
448
452
|
end
|
449
453
|
|
@@ -12,7 +12,11 @@ Capybara::SpecHelper.spec Capybara::Selector do
|
|
12
12
|
expect(@session.find(:label, for: 'form_other_title')['for']).to eq 'form_other_title'
|
13
13
|
end
|
14
14
|
|
15
|
-
it "finds a label from nested input using :for filter" do
|
15
|
+
it "finds a label from nested input using :for filter with id string" do
|
16
|
+
expect(@session.find(:label, for: 'nested_label').text).to eq 'Nested Label'
|
17
|
+
end
|
18
|
+
|
19
|
+
it "finds a label from nested input using :for filter with element" do
|
16
20
|
input = @session.find(:id, 'nested_label')
|
17
21
|
expect(@session.find(:label, for: input).text).to eq 'Nested Label'
|
18
22
|
end
|
data/lib/capybara/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Walpole
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain:
|
12
12
|
- gem-public_cert.pem
|
13
|
-
date: 2016-09-
|
13
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|