pickles 0.1.8 → 0.1.9

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
  SHA1:
3
- metadata.gz: 763495a5866fc3cfc1096efddba1c0c0bfec8e53
4
- data.tar.gz: 4d2291b4b4af79ff2a6b1b3639a9fc8183fd3311
3
+ metadata.gz: 8118ba0ab14b4b72c919b150f89486f1e6adb6a9
4
+ data.tar.gz: b9735e920420d9fcaaf34d87d7923d77dacdf0a4
5
5
  SHA512:
6
- metadata.gz: baa010f04476adc48f95725fee9bf0f045c2e093656faa128f7fa0b0440c524dd0b2d1b33a883a475993fe9b11b5ebc410bb94b0d6f19a18e111960dcd127aae
7
- data.tar.gz: 7deaf0a5273bb476b5b7aa167bd2d03a2259b8037510a78e8c5c1bf79fc3729d1e6805ed19d0d3be566b36d2a28b948cdf5d6601ccf76e769d040cdb80ae305b
6
+ metadata.gz: 94df6c00755830b691ba3323d62653c1759723c62c9a57c591e61a0bc2f4527cd5acb6a6863dd5b5ea2946367742d8b3c6cb18ee32e4b43f7bb511048d7ec44e
7
+ data.tar.gz: 7832423793a2791d27882482a4eb6d4530d47e6b7af0be48fd3ae98b829576e3a67b56afeece897306d7d107c2d3b20b5e475b4799a0f0241bac83a964354365
@@ -14,7 +14,7 @@ end
14
14
 
15
15
  class Pickles::Config
16
16
 
17
- using HashSymbolizeKeys
17
+ using HashStringifyKeys
18
18
 
19
19
  attr_accessor :css_node_map, :xpath_node_map, :log_xhr_response
20
20
 
@@ -78,7 +78,8 @@ module NodeFinders
78
78
  within ||= Capybara.current_session
79
79
  options[:visible] = false
80
80
 
81
- locator, index = Locator::Index.execute(input_locator)
81
+ locator, index = Locator::Index.execute(input_locator)
82
+ locator, label_xpath = Locator::Equal.execute(locator)
82
83
 
83
84
  if index
84
85
  index_xpath = "[#{index}]"
@@ -89,8 +90,6 @@ module NodeFinders
89
90
  # case 3
90
91
  _rescued_find([:xpath, xpath, options], locator, within: within, message: "@contenteditable with placeholder = #{locator}") do
91
92
 
92
- locator, label_xpath = Locator::Equal.execute(input_locator)
93
-
94
93
  inputtable_field_xpath = "*[self::input or self::textarea or @contenteditable]"
95
94
 
96
95
  xpath = "(#{label_xpath})#{index_xpath}/ancestor::*[.//#{inputtable_field_xpath}][position()=1]//#{inputtable_field_xpath}"
@@ -2,9 +2,11 @@ class FillIN::ComplexInput
2
2
 
3
3
  include Pickles
4
4
 
5
+ attr_reader :value, :label
6
+
5
7
  def initialize(label, value, within)
6
- @label = label
7
- @value = value
8
+ @label = label
9
+ @value = value
8
10
  @within = within || Capybara.current_session
9
11
  end
10
12
 
@@ -9,7 +9,11 @@ class FillIN::Factory
9
9
  end
10
10
 
11
11
  def call
12
- if !@value.nil? && @value[':']
12
+ if in_quotes?
13
+ remove_quotes!
14
+ end
15
+
16
+ if !@value.nil? && @value[':'] && !in_quotes?
13
17
  step = FillIN::ComplexInput
14
18
  elsif @label =~ TAG
15
19
  @label = $1
@@ -22,4 +26,15 @@ class FillIN::Factory
22
26
  step.new(@label, @value, @within)
23
27
  end
24
28
 
29
+ private
30
+
31
+ def in_quotes?
32
+ @in_quotes ||= @value && @value[0] == "\"" && @value[-1] == "\""
33
+ end
34
+
35
+ def remove_quotes!
36
+ @value[0] = ''
37
+ @value[-1] = ''
38
+ end
39
+
25
40
  end
@@ -1,5 +1,7 @@
1
1
  class FillIN::Input
2
2
 
3
+ attr_reader :label, :value
4
+
3
5
  def initialize(label, value, within)
4
6
  @label = label
5
7
  @value = value
@@ -1,3 +1,3 @@
1
1
  module Pickles
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -16,6 +16,7 @@ RSpec.describe '#Waiter' do
16
16
  @session.evaluate_script(
17
17
  <<~JS
18
18
  new XMLHttpRequest().open("GET", '')
19
+ new XMLHttpRequest().send()
19
20
  JS
20
21
  )
21
22
 
@@ -39,6 +39,16 @@ RSpec.describe '#FillIN::Factory' do
39
39
  expect(step).to be_instance_of(FillIN::ComplexInput)
40
40
  end
41
41
 
42
+ it 'uses default input step if value has : and surrounded by quotes' do
43
+ label = "input"
44
+ value = "\"1:2:3\""
45
+
46
+ step = FillIN::Factory.new(label, value).call
47
+
48
+ expect(step).to be_instance_of(FillIN::Input)
49
+ expect(step.value).to eq "1:2:3"
50
+ end
51
+
42
52
  it 'uses input step by default' do
43
53
  label = "input"
44
54
  value = "1"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pickles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - vs