card-mod-platypus 0.11.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 452e5ecbc528b0b9eebec2b46d15e042d974a48799640ca97601fb7c318ab5bc
4
+ data.tar.gz: e98a37fbd75e60d1c567db4514e585b537bc808bbe36637e5c957aa169844c18
5
+ SHA512:
6
+ metadata.gz: ed7b4033497897641d7d42d2c957a531c1b74d6cb5a64e5e8d79a732f988ebd9b9a706dde5f386bb607acae54d52363da4446d84245b2dab1a3e4c5c2f8b56ea
7
+ data.tar.gz: c7d415c5fc6d29b167b47bd130df26e1cd36c1c777f4c828b1c8f7343570a62d86ac88bb70bbf88b8a8c3359d8f0f0dfb717fc0f3bdd45f9e373a118eda05637
@@ -0,0 +1 @@
1
+ require "fog/aws"
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capybara-select2.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 William Yeung
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,76 @@
1
+ # Capybara::Select2
2
+
3
+ [![Code Climate](https://codeclimate.com/github/goodwill/capybara-select2.png)](https://codeclimate.com/github/goodwill/capybara-select2)
4
+
5
+ All this gem does is something very simple- allow you to trigger select2 dropdown to select the value you want. The original select doesn't with the javascript overrides, so this new helper method does only this thing.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ``` ruby
12
+ gem 'capybara-select2', group: :test
13
+ ```
14
+
15
+ Or, add it into your test group
16
+
17
+ ``` ruby
18
+ group :test do
19
+ gem 'capybara-select2'
20
+ ...
21
+ end
22
+ ```
23
+
24
+ And then execute:
25
+
26
+ ``` bash
27
+ $ bundle
28
+ ```
29
+
30
+ Or install it yourself as:
31
+
32
+ ``` bash
33
+ $ gem install capybara-select2
34
+ ```
35
+
36
+ The gem automatically hook itself into rspec helper using Rspec.configure.
37
+
38
+ If you're using capybara outside of Rspec, you may have to include the following (eg: in `features/support/env.rb` for Cucumber users):
39
+
40
+ ``` ruby
41
+ include Capybara::Select2
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ Just use this method inside your capybara test:
47
+
48
+ ``` ruby
49
+ select2("Dropdown Text", from: "Label of the dropdown")
50
+ ```
51
+
52
+ or
53
+
54
+ ``` ruby
55
+ select2("Dropdown Text", xpath: "<xpath of the dropdown>")
56
+ ```
57
+
58
+ If the select2 field has a `min_length` option (acts as a search field) specify it with:
59
+
60
+ ``` ruby
61
+ select2("foo", from: "Label of the dropdown", search: true)
62
+ ```
63
+
64
+ If select2 field has [tags](http://ivaynberg.github.io/select2/#tags) option you can use:
65
+
66
+ ```ruby
67
+ select2_tag('value', from: 'Label of input')
68
+ ```
69
+
70
+ ## Contributing
71
+
72
+ 1. Fork it
73
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
74
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
75
+ 4. Push to the branch (`git push origin my-new-feature`)
76
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capybara-select2/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "capybara-select2"
8
+ gem.version = Capybara::Select2::VERSION
9
+ gem.authors = ["William Yeung"]
10
+ gem.email = ["william@tofugear.com"]
11
+ gem.description = %q{Helper for triggering select for select2 javascript library}
12
+ gem.summary = ""
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'rspec'
21
+ gem.add_dependency 'capybara'
22
+ end
@@ -0,0 +1,64 @@
1
+ require "capybara-select2/version"
2
+ require 'capybara/selectors/tag_selector'
3
+ require 'rspec/core'
4
+
5
+ module Capybara
6
+ module Select2
7
+ def select2(value, options = {})
8
+ raise "Must pass a hash containing 'from' or 'xpath' or 'css'" unless options.is_a?(Hash) and [:from, :xpath, :css].any? { |k| options.has_key? k }
9
+
10
+ if options.has_key? :xpath
11
+ select2_container = find(:xpath, options[:xpath])
12
+ elsif options.has_key? :css
13
+ select2_container = find(:css, options[:css])
14
+ else
15
+ select_name = options[:from]
16
+ select2_container = find("label", text: select_name).find(:xpath, '..').find(".select2-container")
17
+ end
18
+
19
+ # delay this a bit because it seems most times select2 is not
20
+ # actually ready right away
21
+ sleep 0.1
22
+
23
+ # Open select2 field
24
+ container = select2_container.find(".select2-selection, .select2-choices", visible: false)
25
+ if Capybara.current_driver == 'poltergeist'
26
+ container.trigger('click')
27
+ else
28
+ container.click
29
+ end
30
+
31
+ if options.has_key? :search
32
+ find(:xpath, "//body").find(".select2-search input.select2-search__field").set(value)
33
+ page.execute_script(%|$("input.select2-search__field:visible").keyup();|)
34
+ drop_container = ".select2-results__options"
35
+ else
36
+ drop_container = ".select2-results__options"
37
+ end
38
+
39
+ sleep options[:sleep] if options.has_key? :sleep
40
+
41
+ [value].flatten.each do |value|
42
+ begin
43
+ find(:xpath, "//body").find("#{drop_container} li.select2-results__option", text: value).click
44
+ rescue Capybara::ElementNotFound
45
+ # it seems that sometimes the "open select2 field" click
46
+ # would happen before select2 is initialized, hence
47
+ # the dropdown wouldn't actually be opened; retry both operations
48
+ container = select2_container.find(".select2-selection, .select2-choices")
49
+ if Capybara.current_driver == 'poltergeist'
50
+ container.trigger('click')
51
+ else
52
+ container.click
53
+ end
54
+ find(:xpath, "//body").find("#{drop_container} li.select2-results__option", text: value).click
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+ RSpec.configure do |config|
62
+ config.include Capybara::Select2
63
+ config.include Capybara::Selectors::TagSelector
64
+ end
@@ -0,0 +1,5 @@
1
+ module Capybara
2
+ module Select2
3
+ VERSION = "1.0.1"
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require '../capybara-select2'
@@ -0,0 +1,15 @@
1
+ module Capybara
2
+ module Selectors
3
+ module TagSelector
4
+ def select2_tag(value, options = {})
5
+ if options[:from]
6
+ find(:fillable_field, options[:from]).set(value)
7
+ else
8
+ find('input.select2-input').set(value)
9
+ end
10
+
11
+ find('.select2-drop li', text: value).click
12
+ end
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: card-mod-platypus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.11.0
5
+ platform: ruby
6
+ authors:
7
+ - Ethan McCutchen
8
+ - Philipp Kühl
9
+ - Gerry Gleason
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2020-12-24 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: card
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.101.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - '='
27
+ - !ruby/object:Gem::Version
28
+ version: 1.101.0
29
+ - !ruby/object:Gem::Dependency
30
+ name: codeclimate-test-reporter
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: fog-aws
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: yard
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ description: ''
72
+ email:
73
+ - info@decko.org
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - lib/card/mod/platypus.rb
79
+ - vendor/capybara-select2/Gemfile
80
+ - vendor/capybara-select2/LICENSE.txt
81
+ - vendor/capybara-select2/README.md
82
+ - vendor/capybara-select2/Rakefile
83
+ - vendor/capybara-select2/capybara-select2.gemspec
84
+ - vendor/capybara-select2/lib/capybara-select2.rb
85
+ - vendor/capybara-select2/lib/capybara-select2/version.rb
86
+ - vendor/capybara-select2/lib/capybara/select2.rb
87
+ - vendor/capybara-select2/lib/capybara/selectors/tag_selector.rb
88
+ homepage: http://decko.org
89
+ licenses:
90
+ - GPL-3.0
91
+ metadata:
92
+ card-mod: platypus
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '2.5'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubygems_version: 3.0.3
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: support for core developers (platypuses)
112
+ test_files: []