capybara 3.8.1 → 3.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +7 -0
- data/lib/capybara/queries/selector_query.rb +2 -2
- data/lib/capybara/version.rb +1 -1
- data/spec/selector_spec.rb +16 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ac88f1b755e07883e3173cbdc66d44cede7aab5730fbcbf7d374cb3d9aa2a78
|
4
|
+
data.tar.gz: 702d5533d8c404c67356748aa90f39ed0d606a00a611035b64608695a574d979
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99ef4c6e785412cd50ea04e89d46726cef9abba65d946a1c041abe71a4fadacf9d0772699959def2a48fe41b3a2f108c9f5a4bb44c88af13b5df4df6ff8db013
|
7
|
+
data.tar.gz: d2eef690d02242a4ac16580d9fc0a5904844efe6b5ebaa3ce223e9e4fee39bf4140fdb1a28dbd9fb1ad9f1e0f9e1b0783fce4091a12c6e97d51ad203d34e4422
|
data/History.md
CHANGED
@@ -251,7 +251,7 @@ module Capybara
|
|
251
251
|
|
252
252
|
classes = Array(options[:class]).group_by { |cl| cl.start_with? '!' }
|
253
253
|
(classes[false].to_a.map { |cl| ".#{Capybara::Selector::CSS.escape(cl)}" } +
|
254
|
-
classes[true].to_a.map { |cl| ":not(.#{Capybara::Selector::CSS.escape(cl.slice(1))})" }).join
|
254
|
+
classes[true].to_a.map { |cl| ":not(.#{Capybara::Selector::CSS.escape(cl.slice(1..-1))})" }).join
|
255
255
|
end
|
256
256
|
|
257
257
|
def css_from_id
|
@@ -266,7 +266,7 @@ module Capybara
|
|
266
266
|
|
267
267
|
Array(options[:class]).map do |klass|
|
268
268
|
if klass.start_with?('!')
|
269
|
-
!XPath.attr(:class).contains_word(klass.slice(1))
|
269
|
+
!XPath.attr(:class).contains_word(klass.slice(1..-1))
|
270
270
|
else
|
271
271
|
XPath.attr(:class).contains_word(klass)
|
272
272
|
end
|
data/lib/capybara/version.rb
CHANGED
data/spec/selector_spec.rb
CHANGED
@@ -11,13 +11,13 @@ RSpec.describe Capybara do
|
|
11
11
|
<title>selectors</title>
|
12
12
|
</head>
|
13
13
|
<body>
|
14
|
-
<div class="
|
15
|
-
<div class="
|
16
|
-
<h1 class="
|
14
|
+
<div class="aa" id="page">
|
15
|
+
<div class="bb" id="content">
|
16
|
+
<h1 class="aa">Totally awesome</h1>
|
17
17
|
<p>Yes it is</p>
|
18
18
|
</div>
|
19
|
-
<p class="
|
20
|
-
<p class="
|
19
|
+
<p class="bb cc">Some Content</p>
|
20
|
+
<p class="bb dd"></p>
|
21
21
|
</div>
|
22
22
|
<div id="#special">
|
23
23
|
</div>
|
@@ -84,12 +84,12 @@ RSpec.describe Capybara do
|
|
84
84
|
|
85
85
|
describe 'modify_selector' do
|
86
86
|
it 'allows modifying a selector' do
|
87
|
-
el = string.find(:custom_selector, '
|
87
|
+
el = string.find(:custom_selector, 'aa')
|
88
88
|
expect(el.tag_name).to eq 'div'
|
89
89
|
Capybara.modify_selector :custom_selector do
|
90
90
|
css { |css_class| "h1.#{css_class}" }
|
91
91
|
end
|
92
|
-
el = string.find(:custom_selector, '
|
92
|
+
el = string.find(:custom_selector, 'aa')
|
93
93
|
expect(el.tag_name).to eq 'h1'
|
94
94
|
end
|
95
95
|
|
@@ -97,9 +97,9 @@ RSpec.describe Capybara do
|
|
97
97
|
Capybara.modify_selector :custom_selector do
|
98
98
|
css { |css_class| "p.#{css_class}" }
|
99
99
|
end
|
100
|
-
expect(string).to have_selector(:custom_selector, '
|
101
|
-
expect(string).to have_selector(:custom_selector, '
|
102
|
-
expect(string).to have_selector(:custom_selector, '
|
100
|
+
expect(string).to have_selector(:custom_selector, 'bb', count: 1)
|
101
|
+
expect(string).to have_selector(:custom_selector, 'bb', not_empty: false, count: 1)
|
102
|
+
expect(string).to have_selector(:custom_selector, 'bb', not_empty: :all, count: 2)
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -151,15 +151,15 @@ RSpec.describe Capybara do
|
|
151
151
|
|
152
152
|
context 'with :class option' do
|
153
153
|
it 'works with compound css selectors' do
|
154
|
-
expect(string.all(:custom_css_selector, 'div, h1', class: '
|
155
|
-
expect(string.all(:custom_css_selector, 'h1, div', class: '
|
154
|
+
expect(string.all(:custom_css_selector, 'div, h1', class: 'aa').size).to eq 2
|
155
|
+
expect(string.all(:custom_css_selector, 'h1, div', class: 'aa').size).to eq 2
|
156
156
|
end
|
157
157
|
|
158
158
|
it 'handles negated classes' do
|
159
|
-
expect(string.all(:custom_css_selector, 'div, p', class: ['
|
160
|
-
expect(string.all(:custom_css_selector, 'div, p', class: ['!
|
161
|
-
expect(string.all(:custom_xpath_selector, XPath.descendant(:div, :p), class: ['
|
162
|
-
expect(string.all(:custom_xpath_selector, XPath.descendant(:div, :p), class: ['!
|
159
|
+
expect(string.all(:custom_css_selector, 'div, p', class: ['bb', '!cc']).size).to eq 2
|
160
|
+
expect(string.all(:custom_css_selector, 'div, p', class: ['!cc', '!dd', 'bb']).size).to eq 1
|
161
|
+
expect(string.all(:custom_xpath_selector, XPath.descendant(:div, :p), class: ['bb', '!cc']).size).to eq 2
|
162
|
+
expect(string.all(:custom_xpath_selector, XPath.descendant(:div, :p), class: ['!cc', '!dd', 'bb']).size).to eq 1
|
163
163
|
end
|
164
164
|
|
165
165
|
it "works with 'special' characters" do
|
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: 3.8.
|
4
|
+
version: 3.8.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: 2018-09-
|
13
|
+
date: 2018-09-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|