card-mod-format 0.14.2 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/assets/script/decko/clicks_and_hovers.js.coffee +49 -0
  3. data/assets/script/decko/decko.js.coffee +32 -0
  4. data/assets/script/decko/decko_jquery.js.coffee +25 -0
  5. data/assets/script/decko/slot.js.coffee +150 -0
  6. data/assets/script/decko/slot_ready.js.coffee +11 -0
  7. data/assets/script/decko/slotter.js.coffee +208 -0
  8. data/assets/script/jquery/jquery-ui.min.js +13 -0
  9. data/assets/script/jquery/jquery.autosize.js +274 -0
  10. data/assets/script/jquery/jquery.ui.autocomplete.html.js +41 -0
  11. data/assets/script/manifest.yml +38 -0
  12. data/assets/style/common.scss +73 -0
  13. data/assets/style/logo_and_credit.scss +24 -0
  14. data/assets/style/menu.scss +43 -0
  15. data/assets/style/messaging.scss +59 -0
  16. data/assets/style/misc.scss +90 -0
  17. data/assets/style/open_and_closed.scss +68 -0
  18. data/data/files/credit_image.svg +59 -0
  19. data/data/files/mod_format_script_asset_output/file.js +66 -0
  20. data/data/real.yml +67 -0
  21. data/lib/card/format/html_format.rb +0 -2
  22. data/lib/card/mod/format.rb +4 -0
  23. data/lib/card/path.rb +20 -20
  24. data/set/all/base.rb +1 -11
  25. data/set/all/content.rb +3 -11
  26. data/set/all/csv.rb +22 -74
  27. data/set/all/data.rb +2 -2
  28. data/set/all/demo.rb +6 -2
  29. data/set/all/error.rb +1 -1
  30. data/set/all/html/error.rb +1 -1
  31. data/set/all/html/head.rb +22 -12
  32. data/set/all/html/header.rb +10 -40
  33. data/set/all/html/header_wrap.haml +3 -4
  34. data/set/all/html/labeled.haml +1 -1
  35. data/set/all/html/menu.rb +36 -12
  36. data/set/all/html/views.rb +8 -17
  37. data/set/all/html/wrap.rb +5 -4
  38. data/set/all/html.rb +2 -3
  39. data/set/all/json.rb +1 -5
  40. data/set/right/head.rb +1 -0
  41. data/set/type/cardtype.rb +4 -6
  42. data/set/type/json.rb +1 -1
  43. data/set/type/number.rb +1 -16
  44. data/vendor/jquery_file_upload/LICENSE.txt +20 -0
  45. data/vendor/jquery_file_upload/README.md +224 -0
  46. data/vendor/jquery_file_upload/SECURITY.md +227 -0
  47. data/vendor/jquery_file_upload/VULNERABILITIES.md +118 -0
  48. data/vendor/jquery_file_upload/cors/postmessage.html +85 -0
  49. data/vendor/jquery_file_upload/cors/result.html +26 -0
  50. data/vendor/jquery_file_upload/css/jquery.fileupload-noscript.css +22 -0
  51. data/vendor/jquery_file_upload/css/jquery.fileupload-ui-noscript.css +17 -0
  52. data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +68 -0
  53. data/vendor/jquery_file_upload/css/jquery.fileupload.css +36 -0
  54. data/vendor/jquery_file_upload/docker-compose.yml +55 -0
  55. data/vendor/jquery_file_upload/img/loading.gif +0 -0
  56. data/vendor/jquery_file_upload/img/progressbar.gif +0 -0
  57. data/vendor/jquery_file_upload/index.html +357 -0
  58. data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +126 -0
  59. data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +97 -0
  60. data/vendor/jquery_file_upload/js/demo.js +75 -0
  61. data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +101 -0
  62. data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +347 -0
  63. data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +170 -0
  64. data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +759 -0
  65. data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +119 -0
  66. data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +101 -0
  67. data/vendor/jquery_file_upload/js/jquery.fileupload.js +1604 -0
  68. data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +227 -0
  69. data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +805 -0
  70. data/vendor/jquery_file_upload/package-lock.json +6853 -0
  71. data/vendor/jquery_file_upload/package.json +116 -0
  72. data/vendor/jquery_file_upload/server/gae-python/app.yaml +18 -0
  73. data/vendor/jquery_file_upload/server/gae-python/main.py +204 -0
  74. data/vendor/jquery_file_upload/server/gae-python/static/favicon.ico +0 -0
  75. data/vendor/jquery_file_upload/server/gae-python/static/robots.txt +2 -0
  76. data/vendor/jquery_file_upload/server/php/Dockerfile +44 -0
  77. data/vendor/jquery_file_upload/server/php/UploadHandler.php +1480 -0
  78. data/vendor/jquery_file_upload/server/php/index.php +15 -0
  79. data/vendor/jquery_file_upload/server/php/php.ini +5 -0
  80. data/vendor/jquery_file_upload/test/index.html +49 -0
  81. data/vendor/jquery_file_upload/test/unit.js +989 -0
  82. data/vendor/jquery_file_upload/test/vendor/chai.js +10854 -0
  83. data/vendor/jquery_file_upload/test/vendor/mocha.css +325 -0
  84. data/vendor/jquery_file_upload/test/vendor/mocha.js +18178 -0
  85. data/vendor/jquery_file_upload/wdio/LICENSE.txt +20 -0
  86. data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
  87. data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
  88. data/vendor/jquery_file_upload/wdio/conf/chrome.js +40 -0
  89. data/vendor/jquery_file_upload/wdio/conf/firefox.js +25 -0
  90. data/vendor/jquery_file_upload/wdio/hooks/index.js +36 -0
  91. data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +79 -0
  92. data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +25 -0
  93. data/vendor/jquery_file_upload/wdio/wdio.conf.js +4 -0
  94. data/vendor/jquery_rails/CHANGELOG.md +359 -0
  95. data/vendor/jquery_rails/CONTRIBUTING.md +132 -0
  96. data/vendor/jquery_rails/Gemfile +22 -0
  97. data/vendor/jquery_rails/MIT-LICENSE +21 -0
  98. data/vendor/jquery_rails/README.md +75 -0
  99. data/vendor/jquery_rails/Rakefile +59 -0
  100. data/vendor/jquery_rails/VERSIONS.md +62 -0
  101. data/vendor/jquery_rails/jquery-rails.gemspec +26 -0
  102. data/vendor/jquery_rails/lib/jquery/assert_select.rb +149 -0
  103. data/vendor/jquery_rails/lib/jquery/rails/engine.rb +6 -0
  104. data/vendor/jquery_rails/lib/jquery/rails/version.rb +9 -0
  105. data/vendor/jquery_rails/lib/jquery/rails.rb +8 -0
  106. data/vendor/jquery_rails/lib/jquery-rails.rb +1 -0
  107. data/vendor/jquery_rails/test/assert_select_jquery_test.rb +85 -0
  108. data/vendor/jquery_rails/test/test_helper.rb +6 -0
  109. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.js +11008 -0
  110. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.js +5 -0
  111. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.map +1 -0
  112. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.js +9814 -0
  113. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.js +4 -0
  114. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.map +1 -0
  115. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.js +10364 -0
  116. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.js +2 -0
  117. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.map +1 -0
  118. data/vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js +555 -0
  119. metadata +104 -7
@@ -0,0 +1,132 @@
1
+ Contributing to jquery-rails
2
+ =====================
3
+
4
+ [![Build Status](https://travis-ci.org/rails/jquery-rails.svg?branch=master)](https://travis-ci.org/rails/jquery-rails)
5
+
6
+ jquery-rails is work of [many contributors](https://github.com/rails/jquery-rails/graphs/contributors). You're encouraged to submit [pull requests](https://github.com/rails/jquery-rails/pulls), [propose features and discuss issues](https://github.com/rails/jquery-rails/issues).
7
+
8
+ #### Updating jQuery
9
+
10
+ If the jquery or jquery-ui scripts are outdated (i.e. maybe a new version of jquery was released yesterday), feel free to open an issue and prod us to get that thing updated. However, for security reasons, we won't be accepting pull requests with updated jquery or jquery-ui scripts.
11
+
12
+ #### Changes to jquery_ujs.js
13
+
14
+ **If it's an issue pertaining to the jquery-ujs javascript, please
15
+ report it to the [rails/jquery-ujs project](https://github.com/rails/jquery-ujs/issues).**
16
+
17
+ #### Fork the Project
18
+
19
+ Fork the [project on Github](https://github.com/rails/jquery-rails) and check out your copy.
20
+
21
+ ```
22
+ git clone https://github.com/contributor/jquery-rails.git
23
+ cd jquery-rails
24
+ git remote add upstream https://github.com/rails/jquery-rails.git
25
+ ```
26
+
27
+ #### Create a Topic Branch
28
+
29
+ Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
30
+
31
+ ```
32
+ git checkout master
33
+ git pull upstream master
34
+ git checkout -b my-feature-branch
35
+ ```
36
+
37
+ #### Bundle Install and Test
38
+
39
+ Ensure that you can build the project and run tests.
40
+
41
+ ```
42
+ bundle install
43
+ bundle exec rake test
44
+ ```
45
+
46
+ #### Write Tests
47
+
48
+ Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add to [test](test).
49
+
50
+ #### Testing
51
+
52
+ This is a gem that simply includes jQuery and jQuery UJS into the Rails
53
+ asset pipeline. The asset pipeline functionality is well tested within the
54
+ Rails framework. And jQuery and jQuery UJS each have their own extensive
55
+ test suites. Thus, there's not a lot to actually test here.
56
+
57
+ That being said, we do have a few integration-level tests to make sure
58
+ everything is being included and basic UJS functionality works within a
59
+ sample Rails app.
60
+
61
+ If you're making changes to the actual gem, run the tests as follows:
62
+
63
+ 1. Checkout the demo Rails app: `git clone git://github.com/JangoSteve/Rails-jQuery-Demo.git`
64
+
65
+ 2. Install the gems: `bundle install`
66
+
67
+ 3. Change the jquery-rails gem in the Gemfile to use your local
68
+ version of the gem with your updates: `gem 'jquery-rails', :path => '../path/to/jquery-rails'`
69
+
70
+ 4. Update your bundled jquery-rails gem: `bundle update jquery-rails`
71
+
72
+ 5. Run the tests: `bundle exec rspec spec/`
73
+
74
+ We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
75
+
76
+ #### Write Code
77
+
78
+ Implement your feature or bug fix.
79
+
80
+ Make sure that `bundle exec rake test` completes without errors.
81
+
82
+ #### Write Documentation
83
+
84
+ Document any external behavior in the [README](README.md).
85
+
86
+ #### Commit Changes
87
+
88
+ Make sure git knows your name and email address:
89
+
90
+ ```
91
+ git config --global user.name "Your Name"
92
+ git config --global user.email "contributor@example.com"
93
+ ```
94
+
95
+ Writing good commit logs is important. A commit log should describe what changed and why.
96
+
97
+ ```
98
+ git add ...
99
+ git commit
100
+ ```
101
+
102
+ #### Push
103
+
104
+ ```
105
+ git push origin my-feature-branch
106
+ ```
107
+
108
+ #### Make a Pull Request
109
+
110
+ Go to https://github.com/contributor/jquery-rails and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
111
+
112
+ #### Rebase
113
+
114
+ If you've been working on a change for a while, rebase with upstream/master.
115
+
116
+ ```
117
+ git fetch upstream
118
+ git rebase upstream/master
119
+ git push origin my-feature-branch -f
120
+ ```
121
+
122
+ #### Check on Your Pull Request
123
+
124
+ Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
125
+
126
+ #### Be Patient
127
+
128
+ It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
129
+
130
+ #### Thank You
131
+
132
+ Please do know that we really appreciate and value your time and work. We love you, really.
@@ -0,0 +1,22 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "mime-types", "< 3", group: :test
4
+
5
+ if RUBY_VERSION >= '2.2.2'
6
+ gem 'rails'
7
+ gem 'rack'
8
+ gem 'json', '>= 2'
9
+ else
10
+ gem 'rails', '~> 4.2.0'
11
+ gem 'rack', '~>1.6'
12
+ gem 'json', '~> 1.8.0'
13
+ end
14
+
15
+ if RUBY_VERSION >= '2.1'
16
+ gem 'nokogiri'
17
+ else
18
+ gem 'nokogiri', '~> 1.6.0'
19
+ end
20
+
21
+ # Specify your gem's dependencies in jquery-rails.gemspec
22
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010-2016 Andre Arko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,75 @@
1
+ # jquery-rails
2
+
3
+ jQuery! For Rails! So great.
4
+
5
+ This gem provides:
6
+
7
+ * jQuery 1, 2 and 3
8
+ * the jQuery UJS adapter
9
+ * assert_select_jquery to test jQuery responses in Ruby tests
10
+
11
+ ## Versions
12
+
13
+ Starting with v2.1, the jquery-rails gem follows these version guidelines
14
+ to provide more control over your app's jQuery version from your Gemfile:
15
+
16
+ ```
17
+ patch version bump = updates to jquery-ujs, jquery-rails, and patch-level updates to jQuery
18
+ minor version bump = minor-level updates to jQuery
19
+ major version bump = major-level updates to jQuery and updates to Rails which may be backwards-incompatible
20
+ ```
21
+
22
+ See [VERSIONS.md](VERSIONS.md) to see which versions of jquery-rails bundle which
23
+ versions of jQuery.
24
+
25
+ ## Installation
26
+
27
+ The jquery and jquery-ujs files will be added to the asset pipeline and available for you to use. If they're not already in `app/assets/javascripts/application.js` by default, add these lines:
28
+
29
+ ```js
30
+ //= require jquery
31
+ //= require jquery_ujs
32
+ ```
33
+
34
+ If you are running Rails 5.1 and up, and if you have included `//= require rails-ujs`, then `jquery_ujs` is not needed anymore. You can just add:
35
+
36
+ ```js
37
+ //= require jquery
38
+ ```
39
+
40
+ If you want to use jQuery 2, you can require `jquery2` instead:
41
+
42
+ ```js
43
+ //= require jquery2
44
+ //= require jquery_ujs
45
+ ```
46
+
47
+ And if you want to use jQuery 3, you can require `jquery3`:
48
+
49
+ ```js
50
+ //= require jquery3
51
+ //= require jquery_ujs
52
+ ```
53
+
54
+ For jQuery UI, we recommend the [jquery-ui-rails](https://github.com/joliss/jquery-ui-rails) gem, as it includes the jquery-ui css and allows easier customization.
55
+
56
+ *As of v3.0, jquery-rails no longer includes jQuery UI. Use the
57
+ jquery-ui-rails gem above.*
58
+
59
+ ## Contributing to jquery-rails
60
+
61
+ jquery-rails is work of many contributors. You're encouraged to submit pull requests, propose
62
+ features and discuss issues.
63
+
64
+ * If it's an issue pertaining to the jquery-ujs javascript, please report it to the [jquery-ujs project](https://github.com/rails/jquery-ujs).
65
+
66
+ * If the jQuery scripts are outdated (i.e. maybe a new version of jquery was released yesterday), feel free to open an issue and prod us to get that thing updated. However, for security reasons, we won't be accepting pull requests with updated jQuery scripts.
67
+
68
+ See [CONTRIBUTING](CONTRIBUTING.md).
69
+
70
+ ## License
71
+ jquery-rails is released under the [MIT License](MIT-LICENSE).
72
+
73
+ ## Acknowledgements
74
+
75
+ Many thanks are due to all of [the jquery-rails contributors](https://github.com/rails/jquery-rails/graphs/contributors). Special thanks to [JangoSteve](http://github.com/JangoSteve) for tirelessly answering questions and accepting patches, and the [Rails Core Team](https://github.com/organizations/rails/teams/617) for making jquery-rails an official part of Rails 3.1.
@@ -0,0 +1,59 @@
1
+ require 'bundler'
2
+ require 'rake/testtask'
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ task default: :test
6
+
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs << 'lib'
9
+ t.pattern = 'test/**/*_test.rb'
10
+ t.warning = true
11
+ t.verbose = true
12
+ end
13
+
14
+ # Check if versions are correct between VERSION constants and .js files
15
+ #
16
+ task :release => [:guard_version]
17
+
18
+ task :guard_version do
19
+ def check_version(file, pattern, constant)
20
+ body = File.read("vendor/assets/javascripts/#{file}")
21
+ match = body.match(pattern) or abort "Version check failed: no pattern matched in #{file}"
22
+ file_version = match[1]
23
+ constant_version = Jquery::Rails.const_get(constant)
24
+
25
+ unless constant_version == file_version
26
+ abort "Jquery::Rails::#{constant} was #{constant_version} but it should be #{file_version}"
27
+ end
28
+ end
29
+
30
+ check_version('jquery.js', /jQuery JavaScript Library v([\S]+)/, 'JQUERY_VERSION')
31
+ check_version('jquery2.js', /jQuery JavaScript Library v([\S]+)/, 'JQUERY_2_VERSION')
32
+ check_version('jquery3.js', /jQuery JavaScript Library v([\S]+)/, 'JQUERY_3_VERSION')
33
+ end
34
+
35
+ desc "Update jQuery versions"
36
+ task :update_jquery do
37
+ def download_jquery(filename, version)
38
+ suffix = "-#{version}"
39
+
40
+ puts "Downloading #{filename}.js"
41
+ puts `curl -o vendor/assets/javascripts/#{filename}.js https://code.jquery.com/jquery#{suffix}.js`
42
+ puts "Downloading #{filename}.min.js"
43
+ puts `curl -o vendor/assets/javascripts/#{filename}.min.js https://code.jquery.com/jquery#{suffix}.min.js`
44
+ puts "Downloading #{filename}.min.map"
45
+ puts `curl -o vendor/assets/javascripts/#{filename}.min.map https://code.jquery.com/jquery#{suffix}.min.map`
46
+ end
47
+
48
+ download_jquery('jquery', Jquery::Rails::JQUERY_VERSION)
49
+ download_jquery('jquery2', Jquery::Rails::JQUERY_2_VERSION)
50
+ download_jquery('jquery3', Jquery::Rails::JQUERY_3_VERSION)
51
+ puts "\e[32mDone!\e[0m"
52
+ end
53
+
54
+ desc "Update jQuery UJS version"
55
+ task :update_jquery_ujs do
56
+ puts "Downloading jquery_ujs.js"
57
+ puts `curl -o vendor/assets/javascripts/jquery_ujs.js https://raw.githubusercontent.com/rails/jquery-ujs/v#{Jquery::Rails::JQUERY_UJS_VERSION}/src/rails.js`
58
+ puts "\e[32mDone!\e[0m"
59
+ end
@@ -0,0 +1,62 @@
1
+ # Bundled Versions
2
+
3
+ | Gem | jQuery | jQuery UJS | jQuery UI |
4
+ |--------|--------|------------| ----------|
5
+ | 4.3.3 | 1.12.4 & 2.2.4 & 3.3.1 | 1.2.2 | - |
6
+ | 4.3.2 | 1.12.4 & 2.2.4 & 3.3.0 | 1.2.2 | - |
7
+ | 4.3.1 | 1.12.4 & 2.2.4 & 3.2.1 | 1.2.2 | - |
8
+ | 4.3.0 | 1.12.4 & 2.2.4 & 3.2.0 | 1.2.2 | - |
9
+ | 4.2.2 | 1.12.4 & 2.2.4 & 3.1.1 | 1.2.2 | - |
10
+ | 4.2.1 | 1.12.4 & 2.2.4 & 3.1.0 | 1.2.2 | - |
11
+ | 4.2.0 | 1.12.4 & 2.2.4 & 3.0.0 | 1.2.2 | - |
12
+ | 4.1.1 | 1.12.1 & 2.2.1 | 1.2.1 | - |
13
+ | 4.1.0 | 1.12.0 & 2.2.0 | 1.2.0 | - |
14
+ | 4.0.5 | 1.11.3 & 2.1.4 | 1.1.0 | - |
15
+ | 4.0.4 | 1.11.2 & 2.1.3 | 1.0.4 | - |
16
+ | 4.0.3 | 1.11.2 & 2.1.3 | 1.0.3 | - |
17
+ | 4.0.2 | - | - | - |
18
+ | 4.0.1 | - | - | - |
19
+ | 4.0.0 | 1.11.1 & 2.1.1 | 1.0.2 | - |
20
+ | 3.1.3 | 1.11.1 | 1.0.4 | - |
21
+ | 3.1.2 | 1.11.1 | 1.0.1 | - |
22
+ | 3.1.1 | 1.11.1 | 1.0.0 | - |
23
+ | 3.1.0 | 1.11.0 | - | - |
24
+ | 3.0.5 | 1.11.0 | - | - |
25
+ | 3.0.4 | ↾ | - | - |
26
+ | 3.0.3 | 1.10.2 | - | - |
27
+ | 3.0.2 | ↾ | - | - |
28
+ | 3.0.1 | 1.10.1 | - | - |
29
+ | 3.0.0 | ↾ | - | - |
30
+ | 2.3.0 | 1.10.0 | - | 1.10.3 |
31
+ | 2.2.2 | ↾ | - | ↾ |
32
+ | 2.2.1 | 1.9.1 | - | ↾ |
33
+ | 2.2.0 | 1.9.0 | - | ↾ |
34
+ | 2.1.4 | 1.8.3 | - | 1.9.2 |
35
+ | 2.1.3 | 1.8.2 | - | ↾ |
36
+ | 2.1.2 | 1.8.1 | - | ↾ |
37
+ | 2.1.1 | ↾ | - | ↾ |
38
+ | 2.1.0 | 1.8.0 | - | 1.8.23 |
39
+ | 2.0.3 | ↾ | - | ↾ |
40
+ | 2.0.2 | 1.7.2 | - | 1.8.18 |
41
+ | 2.0.1 | ↾ | - | ↾ |
42
+ | 2.0.0 | ↾ | - | ↾ |
43
+ | 1.0.19 | 1.7.1 | - | ↾ |
44
+ | 1.0.18 | ↾ | - | ↾ |
45
+ | 1.0.17 | 1.7.0 | - | ↾ |
46
+ | 1.0.16 | 1.6.4 | - | 1.8.16 |
47
+ | 1.0.15 | ↾ | - | ↾ |
48
+ | 1.0.14 | ↾ | - | ↾ |
49
+ | 1.0.13 | 1.6.2 | - | 1.8.14 |
50
+ | 1.0.12 | ↾ | - | ↾ |
51
+ | 1.0.11 | ↾ | - | ↾ |
52
+ | 1.0.10 | ↾ | - | ↾ |
53
+ | 1.0.9 | ↾ | - | ↾ |
54
+ | 1.0.8 | ↾ | - | ↾ |
55
+ | 1.0.7 | ↾ | - | ↾ |
56
+ | 1.0.6 | ↾ | - | ↾ |
57
+ | 1.0.5 | ↾ | - | ↾ |
58
+ | 1.0.4 | ↾ | - | ↾ |
59
+ | 1.0.3 | 1.6.1 | - | ↾ |
60
+ | 1.0.2 | ↾ | - | ↾ |
61
+ | 1.0.1 | ↾ | - | 1.8.12 |
62
+ | 1.0.0 | 1.6.0 | - | - |
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/jquery/rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "jquery-rails"
6
+ s.version = Jquery::Rails::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["André Arko"]
9
+ s.email = ["andre@arko.net"]
10
+ s.homepage = "https://github.com/rails/jquery-rails"
11
+ s.summary = "Use jQuery with Rails 4+"
12
+ s.description = "This gem provides jQuery and the jQuery-ujs driver for your Rails 4+ application."
13
+ s.license = "MIT"
14
+
15
+ s.required_ruby_version = ">= 1.9.3"
16
+ s.required_rubygems_version = ">= 1.3.6"
17
+
18
+ s.add_dependency "railties", ">= 4.2.0"
19
+ s.add_dependency "thor", ">= 0.14", "< 2.0"
20
+
21
+ s.add_dependency "rails-dom-testing", ">= 1", "< 3"
22
+
23
+ s.files = `git ls-files`.split("\n")
24
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
25
+ s.require_path = 'lib'
26
+ end
@@ -0,0 +1,149 @@
1
+ require 'rails/dom/testing/assertions/selector_assertions'
2
+
3
+ module Rails::Dom::Testing::Assertions::SelectorAssertions
4
+ # Selects content from a JQuery response. Patterned loosely on
5
+ # assert_select_rjs.
6
+ #
7
+ # === Narrowing down
8
+ #
9
+ # With no arguments, asserts that one or more method calls are made.
10
+ #
11
+ # Use the +method+ argument to narrow down the assertion to only
12
+ # statements that call that specific method.
13
+ #
14
+ # Use the +opt+ argument to narrow down the assertion to only statements
15
+ # that pass +opt+ as the first argument.
16
+ #
17
+ # Use the +id+ argument to narrow down the assertion to only statements
18
+ # that invoke methods on the result of using that identifier as a
19
+ # selector.
20
+ #
21
+ # === Using blocks
22
+ #
23
+ # Without a block, +assert_select_jquery_ merely asserts that the
24
+ # response contains one or more statements that match the conditions
25
+ # specified above
26
+ #
27
+ # With a block +assert_select_jquery_ also asserts that the method call
28
+ # passes a javascript escaped string containing HTML. All such HTML
29
+ # fragments are selected and passed to the block. Nested assertions are
30
+ # supported.
31
+ #
32
+ # === Examples
33
+ #
34
+ # # asserts that the #notice element is hidden
35
+ # assert_select :hide, '#notice'
36
+ #
37
+ # # asserts that the #cart element is shown with a blind parameter
38
+ # assert_select :show, :blind, '#cart'
39
+ #
40
+ # # asserts that #cart content contains a #current_item
41
+ # assert_select :html, '#cart' do
42
+ # assert_select '#current_item'
43
+ # end
44
+ #
45
+ # # asserts that #product append to a #product_list
46
+ # assert_select_jquery :appendTo, '#product_list' do
47
+ # assert_select '.product'
48
+ # end
49
+
50
+ PATTERN_HTML = "['\"]((\\\\\"|\\\\'|[^\"'])*)['\"]"
51
+ PATTERN_UNICODE_ESCAPED_CHAR = /\\u([0-9a-zA-Z]{4})/
52
+ SKELETAL_PATTERN = "(?:jQuery|\\$)\\(%s\\)\\.%s\\(%s\\)[;]?"
53
+
54
+ def assert_select_jquery(*args, &block)
55
+ jquery_method = args.first.is_a?(Symbol) ? args.shift : nil
56
+ jquery_opt = args.first.is_a?(Symbol) ? args.shift : nil
57
+ id = args.first.is_a?(String) ? escape_id(args.shift) : nil
58
+
59
+ target_pattern = "['\"]#{id || '.*'}['\"]"
60
+ method_pattern = "#{jquery_method || '\\w+'}"
61
+ argument_pattern = jquery_opt ? "['\"]#{jquery_opt}['\"].*" : PATTERN_HTML
62
+
63
+ # $("#id").show('blind', 1000);
64
+ # $("#id").html("<div>something</div>");
65
+ # $("#id").replaceWith("<div>something</div>");
66
+ target_as_receiver_pattern = SKELETAL_PATTERN % [target_pattern, method_pattern, argument_pattern]
67
+
68
+ # $("<div>something</div>").appendTo("#id");
69
+ # $("<div>something</div>").prependTo("#id");
70
+ target_as_argument_pattern = SKELETAL_PATTERN % [argument_pattern, method_pattern, target_pattern]
71
+
72
+ # $("#id").remove();
73
+ # $("#id").hide();
74
+ argumentless_pattern = SKELETAL_PATTERN % [target_pattern, method_pattern, '']
75
+
76
+ patterns = [target_as_receiver_pattern, target_as_argument_pattern]
77
+ patterns << argumentless_pattern unless jquery_opt
78
+
79
+ matched_pattern = nil
80
+ patterns.each do |pattern|
81
+ if response.body.match(Regexp.new(pattern))
82
+ matched_pattern = pattern
83
+ break
84
+ end
85
+ end
86
+
87
+ unless matched_pattern
88
+ opts = [jquery_method, jquery_opt, id].compact
89
+ flunk "No JQuery call matches #{opts.inspect}"
90
+ end
91
+
92
+ if block_given?
93
+ @selected ||= nil
94
+ fragments = Nokogiri::HTML::Document.new.fragment
95
+
96
+ if matched_pattern
97
+ response.body.scan(Regexp.new(matched_pattern)).each do |match|
98
+ flunk 'This function can\'t have HTML argument' if match.is_a?(String)
99
+
100
+ doc = Nokogiri::HTML::DocumentFragment.parse(unescape_js(match.first))
101
+ doc.children.each do |child|
102
+ fragments << child if child.element?
103
+ end
104
+ end
105
+ end
106
+
107
+ begin
108
+ in_scope, @selected = @selected, fragments
109
+ yield
110
+ ensure
111
+ @selected = in_scope
112
+ end
113
+ end
114
+ end
115
+
116
+ private
117
+
118
+ # Unescapes a JS string.
119
+ def unescape_js(js_string)
120
+ # js encodes double quotes and line breaks.
121
+ unescaped= js_string.gsub('\"', '"')
122
+ unescaped.gsub!('\\\'', "'")
123
+ unescaped.gsub!(/\\\//, '/')
124
+ unescaped.gsub!('\n', "\n")
125
+ unescaped.gsub!('\076', '>')
126
+ unescaped.gsub!('\074', '<')
127
+ # js encodes non-ascii characters.
128
+ unescaped.gsub!(PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')}
129
+ unescaped
130
+ end
131
+
132
+ def escape_id(selector)
133
+ return unless selector
134
+
135
+ id = selector.gsub('[', '\[')
136
+ id.gsub!(']', '\]')
137
+ id.gsub!('*', '\*')
138
+ id.gsub!('(', '\(')
139
+ id.gsub!(')', '\)')
140
+ id.gsub!('.', '\.')
141
+ id.gsub!('|', '\|')
142
+ id.gsub!('^', '\^')
143
+ id.gsub!('$', '\$')
144
+ id.gsub!('+', "\\\\+")
145
+ id.gsub!(',', '\,')
146
+
147
+ id
148
+ end
149
+ end
@@ -0,0 +1,6 @@
1
+ module Jquery
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ module Jquery
2
+ module Rails
3
+ VERSION = "4.3.3"
4
+ JQUERY_VERSION = "1.12.4"
5
+ JQUERY_2_VERSION = "2.2.4"
6
+ JQUERY_3_VERSION = "3.3.1"
7
+ JQUERY_UJS_VERSION = "1.2.2"
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ require 'jquery/assert_select' if ::Rails.env.test?
2
+ require 'jquery/rails/engine'
3
+ require 'jquery/rails/version'
4
+
5
+ module Jquery
6
+ module Rails
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ require 'jquery/rails'
@@ -0,0 +1,85 @@
1
+ require 'ostruct'
2
+ require_relative 'test_helper'
3
+ require_relative '../lib/jquery/assert_select'
4
+
5
+ class AssertSelectJQueryTest < ActiveSupport::TestCase
6
+ include Rails::Dom::Testing::Assertions::SelectorAssertions
7
+ attr_reader :response
8
+
9
+ JAVASCRIPT_TEST_OUTPUT = <<-JS
10
+ $("#card").show("blind", 1000);
11
+ $("#id").html('<div><p>something</p></div>');
12
+ $('#card').html('<div><p>something else</p></div>');
13
+ jQuery("#id").replaceWith("<div><p>something</p></div>");
14
+ $("<div><p>something</p></div>").appendTo("#id");
15
+ $("<div><p>something else</p></div>").appendTo("#id");
16
+ jQuery("<div><p>something</p></div>").prependTo("#id");
17
+ $('#id').remove();
18
+ jQuery("#id").hide();
19
+ $("[data-placeholder~=name]").remove();
20
+ $("#cart tr:not(.total_line) > *").remove();
21
+ $("[href|=\"val\"][href$=\"val\"][href^=\"val\"]").remove();
22
+ $("tr + td, li").remove();
23
+
24
+ // without semicolon
25
+ $("#browser_cart").hide("blind", 1000)
26
+ JS
27
+
28
+ setup do
29
+ @response = OpenStruct.new(content_type: 'text/javascript', body: JAVASCRIPT_TEST_OUTPUT)
30
+ end
31
+
32
+ def test_target_as_receiver
33
+ assert_nothing_raised do
34
+ assert_select_jquery :show, :blind, '#card'
35
+ assert_select_jquery :hide, :blind, '#browser_cart'
36
+ assert_select_jquery :html, '#id' do
37
+ assert_select 'p', 'something'
38
+ end
39
+ assert_select_jquery :replaceWith, '#id' do
40
+ assert_select 'p', 'something'
41
+ end
42
+ assert_select_jquery :remove, "[data-placeholder~=name]"
43
+ assert_select_jquery :remove, "#cart tr:not(.total_line) > *"
44
+ assert_select_jquery :remove, "[href|=\"val\"][href$=\"val\"][href^=\"val\"]"
45
+ assert_select_jquery :remove, "tr + td, li"
46
+ end
47
+
48
+ assert_raise Minitest::Assertion, "No JQuery call matches [:show, :some_wrong]" do
49
+ assert_select_jquery :show, :some_wrong
50
+ end
51
+
52
+ assert_raise Minitest::Assertion, "<something else> was expected but was <something>" do
53
+ assert_select_jquery :html, '#id' do
54
+ assert_select 'p', 'something else'
55
+ end
56
+ end
57
+ end
58
+
59
+ def test_target_as_argument
60
+ assert_nothing_raised do
61
+ assert_select_jquery :appendTo, '#id' do
62
+ assert_select 'p', 'something'
63
+ assert_select 'p', 'something else'
64
+ end
65
+ assert_select_jquery :prependTo, '#id' do
66
+ assert_select 'p', 'something'
67
+ end
68
+ end
69
+
70
+ assert_raise Minitest::Assertion, 'No JQuery call matches [:prependTo, "#wrong_id"]' do
71
+ assert_select_jquery :prependTo, '#wrong_id'
72
+ end
73
+ end
74
+
75
+ def test_argumentless
76
+ assert_nothing_raised do
77
+ assert_select_jquery :remove
78
+ assert_select_jquery :hide
79
+ end
80
+
81
+ assert_raise Minitest::Assertion, 'No JQuery call matches [:wrong_function]' do
82
+ assert_select_jquery :wrong_function
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,6 @@
1
+ require 'nokogiri'
2
+ require 'active_support'
3
+ require 'active_support/test_case'
4
+ require 'minitest/autorun'
5
+
6
+ ActiveSupport::TestCase.test_order = :random