capybara-select-2 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 30e42ae946b9db5831c6b273b80b1375a4b38b04629c13936df6bc6fe39ab259
4
- data.tar.gz: 8421aa74a1d08543b75eb69e02dce4c35a30209ddf61e44a2f28482e9d43be95
2
+ SHA1:
3
+ metadata.gz: 290340769eff7f3d173f8fadd371ab6e187d1dee
4
+ data.tar.gz: 925f123e77286152ddeb507aa60a60705b13501a
5
5
  SHA512:
6
- metadata.gz: 1c31a763c6e2e095c17b77bbc5de112840204a8e4ce3d624ca82390002bab7acbe3802ea93f9c14a01c3b4ca195b5a4f3183ad140f0628359d4076978a2633fd
7
- data.tar.gz: f9e4d96512ed254a26acdb6f83291b4b60475991513636c2b6454167d50eba0e16c582222fbe3b921b39384a822866345ab247f84fc305bb86cf14ee94163838
6
+ metadata.gz: a19857778408a22ec1b639a5bbcd0f2f2c84e7b1c71e581be01d20332895d3a4073323dcbf5e340172b6dba63dd3c4e7e96feb3e37dca318287afc23a516bf70
7
+ data.tar.gz: 3ea9a7d7f4ba02493067037c13ae937ab3c88429ced79f9a702e4c78d218989aec0d2d9903b1035ddffc5ad07e33e912e1135168cec12beaebc3d241637c8a77
data/README.md CHANGED
@@ -19,90 +19,95 @@ And then execute:
19
19
 
20
20
  $ bundle
21
21
 
22
- Or install it yourself as:
22
+ Or install it with `gem install` command:
23
23
 
24
24
  $ gem install capybara-select-2
25
25
 
26
- [Note] In the projects which use RSpec or Cucumber, the `select2` helper is available out of the box
26
+ ## Configuration
27
27
 
28
- ### Manual installation with Minitest
29
-
30
- In your application_system_test_case.rb
28
+ ### Minitest
31
29
 
32
30
  ```ruby
31
+ # application_system_test_case.rb
33
32
  class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
34
33
  include CapybaraSelect2::Helpers
35
34
  end
36
35
  ```
37
36
 
38
- ### Manual installation with Rspec
39
-
40
- In your spec_helper.rb
37
+ ### Rspec
41
38
 
42
39
  ```ruby
40
+ # spec_helper.rb
43
41
  RSpec.configure do |config|
44
42
  config.include CapybaraSelect2
45
43
  end
46
44
  ```
45
+ [Note] In RSpec tests `select2` helper is available out of the box
47
46
 
48
- ### Manual installation with Cucumber
49
-
50
- In your env.rb
47
+ ### Cucumber
51
48
 
52
49
  ```ruby
50
+ # env.rb
53
51
  World CapybaraSelect2
54
52
  ```
55
53
 
56
54
  ## Usage
57
55
 
58
- ### Select from a node containing select2 control
56
+ ### Examples
59
57
 
60
- * Identified by CSS selector
61
58
  ```ruby
62
59
  select2 'Buy Milk', css: '#todo'
63
- ```
64
-
65
- * Identified by XPath selector
66
- ```ruby
67
60
  select2 'Buy Milk', xpath: '//div[@id="todo"]'
68
- ```
69
-
70
- [Note] CSS and xPath selectors should identify a block which wraps select2 element or a select2 element itself (an html element with the `.select2-container` class)
71
-
72
- ### Select from select2 control identified by label
73
- ```ruby
74
61
  select2 'Buy Milk', from: 'Things to do'
75
- ```
62
+ select2 'Buy Milk', 'Go to gym', css: '#todo'
76
63
 
77
- If you want to search for an option (via Ajax for example)
78
- ```ruby
79
64
  select2 'Buy Milk', from: 'Things to do', search: true
65
+ select2 'Millennials', from: 'Generation', tag: true
80
66
  ```
81
67
 
82
- ### Dynamically create an option from search input
83
- ```ruby
84
- select2 'Millennials', from: 'Generations', tag: true
85
- ```
68
+ [Note] CSS and XPath selectors must identify an HTML node that wraps select2 element or a select2 element itself (an HTML element with the `.select2-container` class)
86
69
 
87
- ### Select several options at once
88
- ```ruby
89
- select2 'Buy Milk', 'Go to gym', css: '#todo'
90
- ```
70
+ ### Options
71
+
72
+ Option | Purpose
73
+ :------|:-------
74
+ css | Identify select2 element by a CSS selector
75
+ xpath | Identify select2 element by an XPath selector
76
+ from | Identify select2 element by a label
77
+ search | Search for an option
78
+ tag | Create an option
79
+ match | Specifies Capybara's [matching strategy](https://github.com/teamcapybara/capybara#strategy) when selecting an option
80
+ exact_text | Whether an option text must match exactly
81
+
82
+ ### RSpec matchers
91
83
 
92
- ### Add match strategy in case of ambiguous results
93
84
  ```ruby
94
- select2 'Buy Milk', from: 'Things to do', search: true, match: :first
85
+ # Check that a select2 option with specified text is present on the page
86
+ expect(page).to have_select2_option 'Buy Milk'
95
87
  ```
96
88
 
97
- ### Search for exact text in the specified node
98
- ```ruby
99
- select2 'Buy Milk', from: 'Things to do', exact_text: true
89
+ ## Testing
90
+
91
+ ### See test examples
92
+
93
+ To see test examples for a specific select2 version, start Sinatra app first:
94
+
95
+ ```bash
96
+ $ rackup spec/support/select2_examples/config.ru
100
97
  ```
101
98
 
102
- ### Check for select2 option on the page
103
- ```ruby
104
- expect(page).to have_select2_option('Buy Milk')
99
+ Visit http://localhost:9292/select2/v4.0.5/examples in your browser to see examples for select2 version `4.0.5`
100
+
101
+ ### Running tests
102
+
103
+ ```bash
104
+ # run spec cases for all select2 versions
105
+ $ bundle exec rspec
106
+
107
+ # run spec cases for a specific select2 version
108
+ $ VERSION=4.0.5 bundle exec rspec spec/shared
105
109
  ```
110
+
106
111
  ## Contributing
107
112
 
108
113
  1. Add a test case which covers the bug
@@ -27,14 +27,14 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
 
29
29
  spec.add_development_dependency "bundler", "~> 2.0"
30
- spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "rake", "~> 13.0"
31
31
  spec.add_development_dependency "rspec", "~> 3.9"
32
- spec.add_development_dependency "capybara", "~> 3.12"
33
- spec.add_development_dependency "chromedriver-helper", "~> 2.1"
34
- spec.add_development_dependency "selenium-webdriver", "~> 3.141.0"
32
+ spec.add_development_dependency "capybara", "~> 3.31"
33
+ spec.add_development_dependency "selenium-webdriver", "~> 3.142"
34
+ spec.add_development_dependency "webdrivers", "~> 4.2"
35
35
  spec.add_development_dependency "capybara-screenshot" , "~> 1.0"
36
- spec.add_development_dependency "puma", "~> 3.12"
37
- spec.add_development_dependency "pry", "~> 0.11.0"
38
- spec.add_development_dependency "simplecov", "~> 0.16"
36
+ spec.add_development_dependency "puma", "~> 4.3"
37
+ spec.add_development_dependency "pry", "~> 0.12"
38
+ spec.add_development_dependency "simplecov", "~> 0.18"
39
39
  spec.add_development_dependency "sinatra", "~> 2.0"
40
40
  end
@@ -27,7 +27,7 @@ module CapybaraSelect2
27
27
  OptionSelectors = {
28
28
  '2' => ".select2-container-active .select2-result",
29
29
  '3' => ".select2-drop-active .select2-result-label",
30
- '4' => ".select2-results .select2-results__option[aria-selected='false']"
30
+ '4' => ".select2-results .select2-results__option:not([role='group'])"
31
31
  }.freeze
32
32
 
33
33
  def option_selector(select2_version)
@@ -1,3 +1,3 @@
1
1
  module CapybaraSelect2
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-select-2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dzmitry Kavalionak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-06 00:00:00.000000000 Z
11
+ date: 2020-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,42 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.12'
61
+ version: '3.31'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.12'
68
+ version: '3.31'
69
69
  - !ruby/object:Gem::Dependency
70
- name: chromedriver-helper
70
+ name: selenium-webdriver
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '2.1'
75
+ version: '3.142'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '2.1'
82
+ version: '3.142'
83
83
  - !ruby/object:Gem::Dependency
84
- name: selenium-webdriver
84
+ name: webdrivers
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 3.141.0
89
+ version: '4.2'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 3.141.0
96
+ version: '4.2'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: capybara-screenshot
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,42 +114,42 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '3.12'
117
+ version: '4.3'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '3.12'
124
+ version: '4.3'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: pry
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.11.0
131
+ version: '0.12'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.11.0
138
+ version: '0.12'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: simplecov
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.16'
145
+ version: '0.18'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0.16'
152
+ version: '0.18'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: sinatra
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -211,7 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  requirements: []
214
- rubygems_version: 3.0.2
214
+ rubyforge_project:
215
+ rubygems_version: 2.6.11
215
216
  signing_key:
216
217
  specification_version: 4
217
218
  summary: Capybara helpers for https://select2.org select box (supports Select2 versions