role-rails 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/.gitignore +6 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +2 -11
  4. data/Rakefile +18 -35
  5. data/lib/role-rails.rb +1 -5
  6. data/lib/role-rails/engine.rb +1 -6
  7. data/lib/role-rails/version.rb +1 -1
  8. data/role-rails.gemspec +34 -56
  9. data/test/dummy/README.rdoc +261 -0
  10. data/test/dummy/Rakefile +7 -0
  11. data/test/dummy/app/assets/javascripts/application.js +13 -0
  12. data/test/dummy/app/assets/javascripts/control.jst.skim +5 -0
  13. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  14. data/test/dummy/app/controllers/application_controller.rb +6 -0
  15. data/test/dummy/app/helpers/application_helper.rb +2 -0
  16. data/test/dummy/app/mailers/.gitkeep +0 -0
  17. data/test/dummy/app/models/.gitkeep +0 -0
  18. data/test/dummy/app/views/application/index.html.slim +5 -0
  19. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  20. data/test/dummy/config.ru +4 -0
  21. data/test/dummy/config/application.rb +60 -0
  22. data/test/dummy/config/boot.rb +10 -0
  23. data/test/dummy/config/database.yml +3 -0
  24. data/test/dummy/config/environment.rb +5 -0
  25. data/test/dummy/config/environments/development.rb +37 -0
  26. data/test/dummy/config/environments/production.rb +67 -0
  27. data/test/dummy/config/environments/test.rb +37 -0
  28. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  29. data/test/dummy/config/initializers/inflections.rb +15 -0
  30. data/test/dummy/config/initializers/mime_types.rb +5 -0
  31. data/test/dummy/config/initializers/secret_token.rb +7 -0
  32. data/test/dummy/config/initializers/session_store.rb +8 -0
  33. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  34. data/test/dummy/config/locales/en.yml +5 -0
  35. data/test/dummy/config/routes.rb +3 -0
  36. data/test/dummy/lib/assets/.gitkeep +0 -0
  37. data/test/dummy/log/.gitkeep +0 -0
  38. data/test/dummy/public/404.html +26 -0
  39. data/test/dummy/public/422.html +26 -0
  40. data/test/dummy/public/500.html +25 -0
  41. data/test/dummy/public/favicon.ico +0 -0
  42. data/test/dummy/script/rails +6 -0
  43. data/test/helper.rb +20 -0
  44. data/test/integration/slim_family_engines_test.rb +23 -0
  45. data/vendor/assets/javascripts/jquery.role.js +17 -27
  46. data/vendor/assets/javascripts/jquery.role.min.js +1 -0
  47. data/vendor/assets/javascripts/role.js +17 -23
  48. data/vendor/assets/javascripts/role.min.js +1 -0
  49. data/vendor/role/.gitignore +1 -0
  50. data/vendor/role/Gemfile +9 -0
  51. data/vendor/role/Guardfile +2 -0
  52. data/vendor/role/Procfile +2 -0
  53. data/vendor/role/README.md +201 -0
  54. data/vendor/role/Rakefile +10 -0
  55. data/vendor/role/doc/yuno.png +0 -0
  56. data/vendor/role/lib/tasks/compress.rake +13 -0
  57. data/vendor/role/lib/tasks/touch.rake +3 -0
  58. data/vendor/role/spec/javascripts/fixtures/base.html +4 -0
  59. data/vendor/role/spec/javascripts/role_jquery_spec.coffee +52 -0
  60. data/vendor/role/spec/javascripts/support/jasmine.yml +15 -0
  61. data/vendor/role/spec/javascripts/support/jasmine_config.rb +23 -0
  62. data/vendor/role/spec/javascripts/support/jasmine_runner.rb +32 -0
  63. data/vendor/role/src/jquery.role.coffee +37 -0
  64. data/vendor/role/src/role.coffee +11 -0
  65. metadata +118 -18
@@ -0,0 +1,52 @@
1
+ describe 'jQuery Role', ->
2
+
3
+ beforeEach ->
4
+ loadFixtures('base.html')
5
+
6
+ it 'should find elemenets by role using @ alias', ->
7
+ expect(
8
+ $('@some_role').get(0)
9
+ ).toBe(
10
+ $('[role="some_role"]').get(0)
11
+ )
12
+
13
+ it 'should allow to use multiply roles', ->
14
+ expect(
15
+ $('@role_one').get(0)
16
+ ).toBe(
17
+ $('#element_two').get(0)
18
+ )
19
+ expect(
20
+ $('@role_one@role_two').get(0)
21
+ ).toBe(
22
+ $('#element_two').get(0)
23
+ )
24
+ expect(
25
+ $('@role_one').get(0)
26
+ ).toBe(
27
+ $('#element_two').get(0)
28
+ )
29
+ expect(
30
+ $('@role_two').get(0)
31
+ ).toBe(
32
+ $('#element_two').get(0)
33
+ )
34
+
35
+ it 'should allow to combine roles with id and classes', ->
36
+ expect(
37
+ $('div#element_one.awesome_div@some_role').get(0)
38
+ ).toBe(
39
+ $('#element_one').get(0)
40
+ )
41
+
42
+ it 'should allow to use roles in nested selectors', ->
43
+ expect(
44
+ $('@role_one @role_three').get(0)
45
+ ).toBe(
46
+ $('#element_three').get(0)
47
+ )
48
+
49
+ it 'should work with $.fn.is', ->
50
+ expect( $('@some_role').is('@some_role') ).toBe(true)
51
+ expect( $('@role_one').is('@role_one') ).toBe(true)
52
+ expect( $('@role_two').is('@role_one') ).toBe(true)
@@ -0,0 +1,15 @@
1
+ src_dir: .
2
+
3
+ src_files:
4
+ - 'spec/javascripts/frameworks/jquery.js'
5
+ - 'lib/jquery.role.js'
6
+
7
+ helpers:
8
+ - 'helpers/**/*.js'
9
+
10
+ spec_dir: 'spec/javascripts'
11
+
12
+ spec_files:
13
+ - '*_spec.js'
14
+
15
+ stylesheets:
@@ -0,0 +1,23 @@
1
+ module Jasmine
2
+ class Config
3
+
4
+ # Add your overrides or custom config code here
5
+
6
+ end
7
+ end
8
+
9
+
10
+ # Note - this is necessary for rspec2, which has removed the backtrace
11
+ module Jasmine
12
+ class SpecBuilder
13
+ def declare_spec(parent, spec)
14
+ me = self
15
+ example_name = spec["name"]
16
+ @spec_ids << spec["id"]
17
+ backtrace = @example_locations[parent.description + " " + example_name]
18
+ parent.it example_name, {} do
19
+ me.report_spec(spec["id"])
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,32 @@
1
+ $:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
2
+
3
+ require 'rubygems'
4
+ require 'jasmine'
5
+ jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb'))
6
+ require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
7
+ if Jasmine::rspec2?
8
+ require 'rspec'
9
+ else
10
+ require 'spec'
11
+ end
12
+
13
+ jasmine_config = Jasmine::Config.new
14
+ spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
15
+
16
+ should_stop = false
17
+
18
+ if Jasmine::rspec2?
19
+ RSpec.configuration.after(:suite) do
20
+ spec_builder.stop if should_stop
21
+ end
22
+ else
23
+ Spec::Runner.configure do |config|
24
+ config.after(:suite) do
25
+ spec_builder.stop if should_stop
26
+ end
27
+ end
28
+ end
29
+
30
+ spec_builder.start
31
+ should_stop = true
32
+ spec_builder.declare_suites
@@ -0,0 +1,37 @@
1
+ # Role.js, jQuery adapter v1.0.2 ~ https://github.com/kossnocorp/role
2
+
3
+ do ($ = jQuery) ->
4
+
5
+ $.expr.match['ROLE'] = /@((?:[\w\u00c0-\uFFFF\-]|\\.)+)/
6
+
7
+ $.expr.preFilter['ROLE'] = (match) -> ' ' + match[1] + ' '
8
+
9
+ $.expr.filter['ROLE'] = (el, match) ->
10
+ el.getAttribute? and " #{el.getAttribute('role')} ".indexOf(match) != -1
11
+
12
+ for type of $.expr.match
13
+ $.expr.match[type] = new RegExp( $.expr.match[type].source + (/(?![^\[]*\])(?![^\(]*\))/.source) )
14
+ $.expr.leftMatch[type] = new RegExp(
15
+ /(^(?:.|\r|\n)*?)/.source +
16
+ $.expr.match[type].source.replace(
17
+ /\\(\d+)/g
18
+ (all, num) -> "\\" + (num - 0 + 1)
19
+ )
20
+ )
21
+
22
+ # Monkey patch for `$.find.matchesSelector`
23
+ #
24
+ # Usage of Element.mozMatchesSelector was been cause of bugs in Firefox 3.6
25
+ # https://developer.mozilla.org/en/DOM/Node.mozMatchesSelector
26
+ #
27
+ # Related issue: https://github.com/kossnocorp/role/issues/8
28
+ if not document.documentElement.matchesSelector? and document.documentElement.mozMatchesSelector?
29
+ matchesSelectorOrigin = $.find.matchesSelector
30
+ $.find.matchesSelector = (node, expr) ->
31
+ matchesSelectorOrigin(
32
+ node
33
+ expr.replace(
34
+ /(@[\w\-]+)/g
35
+ ($0) -> $0.replace( /^@([\w\-]+)$/, (__, $1) -> "[role~=\"#{$1}\"]" )
36
+ )
37
+ )
@@ -0,0 +1,11 @@
1
+ # Role.js, extension for querySelectorAll function v1.0.2 ~ https://github.com/kossnocorp/role
2
+
3
+ elements = []
4
+ elements << Document if Document?
5
+ elements << Element if Element?
6
+
7
+ for elm in elements
8
+ do (elm) ->
9
+ nativeQuery = elm::querySelectorAll
10
+ elm::querySelectorAll = (selector) ->
11
+ nativeQuery.call( @, selector.replace(/@(\w+)/g, "[role~=\"$1\"]") )
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 1.1.0
9
+ version: 1.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sasha Koss
@@ -39,12 +39,14 @@ dependencies:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  segments:
42
+ - 1
43
+ - 2
42
44
  - 0
43
- version: "0"
45
+ version: 1.2.0
44
46
  type: :development
45
47
  version_requirements: *id002
46
48
  - !ruby/object:Gem::Dependency
47
- name: sqlite3
49
+ name: skim
48
50
  prerelease: false
49
51
  requirement: &id003 !ruby/object:Gem::Requirement
50
52
  requirements:
@@ -52,11 +54,13 @@ dependencies:
52
54
  - !ruby/object:Gem::Version
53
55
  segments:
54
56
  - 0
55
- version: "0"
57
+ - 8
58
+ - 1
59
+ version: 0.8.1
56
60
  type: :development
57
61
  version_requirements: *id003
58
62
  - !ruby/object:Gem::Dependency
59
- name: shoulda
63
+ name: sqlite3
60
64
  prerelease: false
61
65
  requirement: &id004 !ruby/object:Gem::Requirement
62
66
  requirements:
@@ -68,31 +72,29 @@ dependencies:
68
72
  type: :development
69
73
  version_requirements: *id004
70
74
  - !ruby/object:Gem::Dependency
71
- name: bundler
75
+ name: shoulda
72
76
  prerelease: false
73
77
  requirement: &id005 !ruby/object:Gem::Requirement
74
78
  requirements:
75
- - - ~>
79
+ - - ">="
76
80
  - !ruby/object:Gem::Version
77
81
  segments:
78
- - 1
79
- - 0
80
82
  - 0
81
- version: 1.0.0
83
+ version: "0"
82
84
  type: :development
83
85
  version_requirements: *id005
84
86
  - !ruby/object:Gem::Dependency
85
- name: jeweler
87
+ name: bundler
86
88
  prerelease: false
87
89
  requirement: &id006 !ruby/object:Gem::Requirement
88
90
  requirements:
89
- - - ~>
91
+ - - ">="
90
92
  - !ruby/object:Gem::Version
91
93
  segments:
92
94
  - 1
93
- - 6
94
- - 4
95
- version: 1.6.4
95
+ - 0
96
+ - 0
97
+ version: 1.0.0
96
98
  type: :development
97
99
  version_requirements: *id006
98
100
  description: jQuery plugin to provide easy way to handle DOM elements by role attribute
@@ -104,14 +106,77 @@ extensions: []
104
106
  extra_rdoc_files: []
105
107
 
106
108
  files:
109
+ - .gitignore
110
+ - .gitmodules
107
111
  - Gemfile
108
112
  - Rakefile
109
113
  - lib/role-rails.rb
110
114
  - lib/role-rails/engine.rb
111
115
  - lib/role-rails/version.rb
112
116
  - role-rails.gemspec
117
+ - test/dummy/README.rdoc
118
+ - test/dummy/Rakefile
119
+ - test/dummy/app/assets/javascripts/application.js
120
+ - test/dummy/app/assets/javascripts/control.jst.skim
121
+ - test/dummy/app/assets/stylesheets/application.css
122
+ - test/dummy/app/controllers/application_controller.rb
123
+ - test/dummy/app/helpers/application_helper.rb
124
+ - test/dummy/app/mailers/.gitkeep
125
+ - test/dummy/app/models/.gitkeep
126
+ - test/dummy/app/views/application/index.html.slim
127
+ - test/dummy/app/views/layouts/application.html.erb
128
+ - test/dummy/config.ru
129
+ - test/dummy/config/application.rb
130
+ - test/dummy/config/boot.rb
131
+ - test/dummy/config/database.yml
132
+ - test/dummy/config/environment.rb
133
+ - test/dummy/config/environments/development.rb
134
+ - test/dummy/config/environments/production.rb
135
+ - test/dummy/config/environments/test.rb
136
+ - test/dummy/config/initializers/backtrace_silencers.rb
137
+ - test/dummy/config/initializers/inflections.rb
138
+ - test/dummy/config/initializers/mime_types.rb
139
+ - test/dummy/config/initializers/secret_token.rb
140
+ - test/dummy/config/initializers/session_store.rb
141
+ - test/dummy/config/initializers/wrap_parameters.rb
142
+ - test/dummy/config/locales/en.yml
143
+ - test/dummy/config/routes.rb
144
+ - test/dummy/lib/assets/.gitkeep
145
+ - test/dummy/log/.gitkeep
146
+ - test/dummy/public/404.html
147
+ - test/dummy/public/422.html
148
+ - test/dummy/public/500.html
149
+ - test/dummy/public/favicon.ico
150
+ - test/dummy/script/rails
151
+ - test/helper.rb
152
+ - test/integration/slim_family_engines_test.rb
113
153
  - vendor/assets/javascripts/jquery.role.js
154
+ - vendor/assets/javascripts/jquery.role.min.js
114
155
  - vendor/assets/javascripts/role.js
156
+ - vendor/assets/javascripts/role.min.js
157
+ - vendor/role/.gitignore
158
+ - vendor/role/Gemfile
159
+ - vendor/role/Gemfile.lock
160
+ - vendor/role/Guardfile
161
+ - vendor/role/Procfile
162
+ - vendor/role/README.md
163
+ - vendor/role/Rakefile
164
+ - vendor/role/doc/yuno.png
165
+ - vendor/role/lib/jquery.role.js
166
+ - vendor/role/lib/jquery.role.min.js
167
+ - vendor/role/lib/role.js
168
+ - vendor/role/lib/role.min.js
169
+ - vendor/role/lib/tasks/compress.rake
170
+ - vendor/role/lib/tasks/touch.rake
171
+ - vendor/role/spec/javascripts/fixtures/base.html
172
+ - vendor/role/spec/javascripts/frameworks/jquery.js
173
+ - vendor/role/spec/javascripts/helpers/jasmine.jquery.js
174
+ - vendor/role/spec/javascripts/role_jquery_spec.coffee
175
+ - vendor/role/spec/javascripts/support/jasmine.yml
176
+ - vendor/role/spec/javascripts/support/jasmine_config.rb
177
+ - vendor/role/spec/javascripts/support/jasmine_runner.rb
178
+ - vendor/role/src/jquery.role.coffee
179
+ - vendor/role/src/role.coffee
115
180
  has_rdoc: true
116
181
  homepage: https://github.com/kossnocorp/role-rails
117
182
  licenses:
@@ -142,5 +207,40 @@ rubygems_version: 1.3.6
142
207
  signing_key:
143
208
  specification_version: 3
144
209
  summary: jQuery plugin to provide easy way to handle DOM elements by role attribute
145
- test_files: []
146
-
210
+ test_files:
211
+ - test/dummy/README.rdoc
212
+ - test/dummy/Rakefile
213
+ - test/dummy/app/assets/javascripts/application.js
214
+ - test/dummy/app/assets/javascripts/control.jst.skim
215
+ - test/dummy/app/assets/stylesheets/application.css
216
+ - test/dummy/app/controllers/application_controller.rb
217
+ - test/dummy/app/helpers/application_helper.rb
218
+ - test/dummy/app/mailers/.gitkeep
219
+ - test/dummy/app/models/.gitkeep
220
+ - test/dummy/app/views/application/index.html.slim
221
+ - test/dummy/app/views/layouts/application.html.erb
222
+ - test/dummy/config.ru
223
+ - test/dummy/config/application.rb
224
+ - test/dummy/config/boot.rb
225
+ - test/dummy/config/database.yml
226
+ - test/dummy/config/environment.rb
227
+ - test/dummy/config/environments/development.rb
228
+ - test/dummy/config/environments/production.rb
229
+ - test/dummy/config/environments/test.rb
230
+ - test/dummy/config/initializers/backtrace_silencers.rb
231
+ - test/dummy/config/initializers/inflections.rb
232
+ - test/dummy/config/initializers/mime_types.rb
233
+ - test/dummy/config/initializers/secret_token.rb
234
+ - test/dummy/config/initializers/session_store.rb
235
+ - test/dummy/config/initializers/wrap_parameters.rb
236
+ - test/dummy/config/locales/en.yml
237
+ - test/dummy/config/routes.rb
238
+ - test/dummy/lib/assets/.gitkeep
239
+ - test/dummy/log/.gitkeep
240
+ - test/dummy/public/404.html
241
+ - test/dummy/public/422.html
242
+ - test/dummy/public/500.html
243
+ - test/dummy/public/favicon.ico
244
+ - test/dummy/script/rails
245
+ - test/helper.rb
246
+ - test/integration/slim_family_engines_test.rb