capybara 3.20.0 → 3.20.1

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: '087a3e5a863f14cabebd8344fa0e2f04cb5c48c386014e5fd46eab2e715a8040'
4
- data.tar.gz: 2ea4bc5aec32f6a7bd63856d922264d29d9629f4c6af71867d30b963d2f04697
3
+ metadata.gz: 6a7113f8a1fdef865586a49c01ae406da91d172955acf96b4038f81d39afdd4d
4
+ data.tar.gz: 9d01e25c2d34e5e2870da21ed33e3b136630c3b035fec3c95aeaccf02548e0cc
5
5
  SHA512:
6
- metadata.gz: cbc11a7fe022eb230aa9e9342d26b88619cb3cb65931b89487ff448575e6cb794e7460679bd1c37c336bdd65229ca72b4e489b5fbe1a5e2ea7ff92945bb1a1ca
7
- data.tar.gz: 0a3103be3113216c40efa1cb22cc261141ed940e205c6e9e9483233c5e672079da5b6950aa4f1bf6871524a6f803eb400ed735f48e13429f57eaa9e8376ae367
6
+ metadata.gz: ca15a47f8e6e98479d369c90518815fdecc62c2b0e576794fa88ec62a3fb5a39047733a482ec85af6ea85c359932b2c91d9dd77c84945b25021e21338787338e
7
+ data.tar.gz: ade8a1e834b23281cbcab18fdf226dcd5f7617d1fc9325c52d766f031497f0a1ef1129ff3582c5b87ce8df46a9449fbc6bd156a5e7fb5d941d5322751e4cd9de
data/History.md CHANGED
@@ -1,5 +1,13 @@
1
+ # Version 3.20.1
2
+ Release date: 2019-05-17
3
+
4
+ ### Fixed
5
+
6
+ * RackTest driver considers <template> elements to be non-visible and ignores the contents
7
+
1
8
  # Version 3.20.0
2
9
  Release date: 2019-05-14
10
+
3
11
  ### Added
4
12
 
5
13
  * `Node#obscured?` to check viewport presence and element overlap
@@ -371,6 +371,10 @@ module Capybara
371
371
  def HTML(html) # rubocop:disable Naming/MethodName
372
372
  if Nokogiri.respond_to?(:HTML5) && Capybara.allow_gumbo # Nokogumbo installed and allowed for use
373
373
  Nokogiri::HTML5(html).tap do |document|
374
+ document.xpath('//template').each do |template|
375
+ # template elements content is not part of the document
376
+ template.inner_html = ''
377
+ end
374
378
  document.xpath('//textarea').each do |textarea|
375
379
  # The Nokogumbo HTML5 parser already returns spec compliant contents
376
380
  textarea['_capybara_raw_value'] = textarea.content
@@ -378,6 +382,10 @@ module Capybara
378
382
  end
379
383
  else
380
384
  Nokogiri::HTML(html).tap do |document|
385
+ document.xpath('//template').each do |template|
386
+ # template elements content is not part of the document
387
+ template.inner_html = ''
388
+ end
381
389
  document.xpath('//textarea').each do |textarea|
382
390
  textarea['_capybara_raw_value'] = textarea.content.sub(/\A\n/, '')
383
391
  end
@@ -102,6 +102,7 @@ module Capybara
102
102
  #
103
103
  def visible?(check_ancestors = true)
104
104
  return false if (tag_name == 'input') && (native[:type] == 'hidden')
105
+ return false if tag_name == 'template'
105
106
 
106
107
  if check_ancestors
107
108
  !find_xpath(VISIBILITY_XPATH)
@@ -242,6 +242,7 @@ Capybara::SpecHelper.spec 'node' do
242
242
  expect(@session.find('//div[@id="hidden_attr"]')).not_to be_visible
243
243
  expect(@session.find('//a[@id="hidden_attr_via_ancestor"]')).not_to be_visible
244
244
  expect(@session.find('//input[@id="hidden_input"]')).not_to be_visible
245
+ expect(@session.find('//template')).not_to be_visible
245
246
  end
246
247
 
247
248
  it 'should be boolean' do
@@ -24,7 +24,7 @@ Capybara::SpecHelper.spec '#scroll_to', requires: [:scroll] do
24
24
  @session.scroll_to(el, align: :center)
25
25
  el_center = el.evaluate_script('(function(rect){return (rect.top + rect.bottom)/2})(this.getBoundingClientRect())')
26
26
  viewport_bottom = el.evaluate_script('document.body.clientHeight')
27
- expect(el_center).to be_within(1).of(viewport_bottom / 2)
27
+ expect(el_center).to be_within(2).of(viewport_bottom / 2)
28
28
  end
29
29
 
30
30
  it 'can scroll the window to the vertical top' do
@@ -178,5 +178,9 @@ banana</textarea>
178
178
  &#x20;&#x1680;&#x2000;&#x2001;&#x2002; &#x2003;&#x2004;&nbsp;&#x2005; &#x2006;&#x2007;&#x2008;&#x2009;&#x200A;&#x202F;&#x205F;&#x3000;
179
179
  </div>
180
180
 
181
+ <template id="template">
182
+ <input />
183
+ </template>
184
+
181
185
  <a href="/download.csv" download>Download Me</a>
182
186
  <a href="/download.csv" download="other.csv">Download Other</a>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Capybara
4
- VERSION = '3.20.0'
4
+ VERSION = '3.20.1'
5
5
  end
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.20.0
4
+ version: 3.20.1
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: 2019-05-15 00:00:00.000000000 Z
13
+ date: 2019-05-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable