capybara 3.8.1 → 3.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc35446857b540db49c4c67f5f70ad80dcb49d8642a39c178886f0429e14e44f
4
- data.tar.gz: 75cdc8e0b3014fdebe9d58cc454045874144b4d9aa647b2b7636cce9dc92f61a
3
+ metadata.gz: 5ac88f1b755e07883e3173cbdc66d44cede7aab5730fbcbf7d374cb3d9aa2a78
4
+ data.tar.gz: 702d5533d8c404c67356748aa90f39ed0d606a00a611035b64608695a574d979
5
5
  SHA512:
6
- metadata.gz: d63a63b21444a97e292346593a221dd5339ec32ec9c243f37b3761f526dc810bbc0488da7caa38252dca25601aea1a70f9a1863a7756c3e766ce82a1f9f2a7e5
7
- data.tar.gz: f3c2a58ecec72d56d8cad3df1868012a5f000173dd9d43b976df316eec1186279c8c557fab294f8e2e7e48ac1c0de088af34757986aa9ac0ecc147bc320497d8
6
+ metadata.gz: 99ef4c6e785412cd50ea04e89d46726cef9abba65d946a1c041abe71a4fadacf9d0772699959def2a48fe41b3a2f108c9f5a4bb44c88af13b5df4df6ff8db013
7
+ data.tar.gz: d2eef690d02242a4ac16580d9fc0a5904844efe6b5ebaa3ce223e9e4fee39bf4140fdb1a28dbd9fb1ad9f1e0f9e1b0783fce4091a12c6e97d51ad203d34e4422
data/History.md CHANGED
@@ -1,3 +1,10 @@
1
+ # Version 3.8.2
2
+ Release date: 2018-09-26
3
+
4
+ ### Fixed
5
+
6
+ * Fixed negated class selector option - Issue #2103
7
+
1
8
  # Version 3.8.1
2
9
  Release date: 2018-09-22
3
10
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Capybara
4
- VERSION = '3.8.1'
4
+ VERSION = '3.8.2'
5
5
  end
@@ -11,13 +11,13 @@ RSpec.describe Capybara do
11
11
  <title>selectors</title>
12
12
  </head>
13
13
  <body>
14
- <div class="a" id="page">
15
- <div class="b" id="content">
16
- <h1 class="a">Totally awesome</h1>
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="b c">Some Content</p>
20
- <p class="b d"></p>
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, 'a')
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, 'a')
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, 'b', count: 1)
101
- expect(string).to have_selector(:custom_selector, 'b', not_empty: false, count: 1)
102
- expect(string).to have_selector(:custom_selector, 'b', not_empty: :all, count: 2)
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: 'a').size).to eq 2
155
- expect(string.all(:custom_css_selector, 'h1, div', class: 'a').size).to eq 2
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: ['b', '!c']).size).to eq 2
160
- expect(string.all(:custom_css_selector, 'div, p', class: ['!c', '!d', 'b']).size).to eq 1
161
- expect(string.all(:custom_xpath_selector, XPath.descendant(:div, :p), class: ['b', '!c']).size).to eq 2
162
- expect(string.all(:custom_xpath_selector, XPath.descendant(:div, :p), class: ['!c', '!d', 'b']).size).to eq 1
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.1
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-22 00:00:00.000000000 Z
13
+ date: 2018-09-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable