role-rails 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,9 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in role-rails.gemspec
4
- gemspec
4
+ gemspec
5
+
6
+ gem 'coffee-rails', '~> 3.2.1'
7
+
8
+ gem 'slim'
9
+ gem 'skim'
@@ -1,7 +1,13 @@
1
1
  module RoleRails
2
2
  class Engine < ::Rails::Engine
3
3
  initializer "role-rails.register" do |app|
4
- defined?(Slim::Parser) && Slim::Parser.default_options[:shortcut].try(:[]=, '@', 'div role')
4
+ if defined?(Slim::Parser)
5
+ Slim::Parser.default_options[:shortcut].try(:[]=, '@', 'role')
6
+ end
7
+
8
+ if defined?(Slim::Engine)
9
+ Slim::Engine.default_options[:attr_delimiter].try(:[]=, 'role', ' ')
10
+ end
5
11
  end
6
12
  end
7
13
  end
@@ -1,3 +1,3 @@
1
1
  module RoleRails
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
@@ -2,4 +2,7 @@
2
2
  | Implicitly defined div tag
3
3
 
4
4
  div@explicitly_defined
5
- | Explicitly defined div tag
5
+ | Explicitly defined div tag
6
+
7
+ @foo@bar
8
+ | Multiple roles
@@ -2,11 +2,6 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require 'rails/all'
4
4
 
5
- require 'coffee-script'
6
- require 'slim'
7
- require 'skim'
8
- require 'role-rails'
9
-
10
5
  Bundler.require
11
6
 
12
7
  module Dummy
@@ -17,6 +17,7 @@ class SlimFamilyEnginesTest < ActionDispatch::IntegrationTest
17
17
 
18
18
  assert_tag :tag => 'div', :attributes => { :role => 'implicitly_defined' }
19
19
  assert_tag :tag => 'div', :attributes => { :role => 'explicitly_defined' }
20
+ assert_tag :tag => 'div', :attributes => { :role => 'foo bar' }
20
21
  end
21
22
  end
22
23
 
metadata CHANGED
@@ -1,111 +1,118 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: role-rails
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 2
8
- - 0
9
- version: 1.2.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.1
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Sasha Koss
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-03-23 00:00:00 +07:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rails
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 3
29
- - 1
30
- - 0
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
31
21
  version: 3.1.0
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: slim
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 1
43
- - 2
44
- - 0
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.1.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: slim
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
45
37
  version: 1.2.0
46
38
  type: :development
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: skim
50
39
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 0
57
- - 8
58
- - 1
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.2.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: skim
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
59
53
  version: 0.8.1
60
54
  type: :development
61
- version_requirements: *id003
62
- - !ruby/object:Gem::Dependency
63
- name: sqlite3
64
55
  prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- segments:
70
- - 0
71
- version: "0"
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.1
62
+ - !ruby/object:Gem::Dependency
63
+ name: sqlite3
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
72
70
  type: :development
73
- version_requirements: *id004
74
- - !ruby/object:Gem::Dependency
75
- name: shoulda
76
71
  prerelease: false
77
- requirement: &id005 !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- segments:
82
- - 0
83
- version: "0"
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: shoulda
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
84
86
  type: :development
85
- version_requirements: *id005
86
- - !ruby/object:Gem::Dependency
87
- name: bundler
88
87
  prerelease: false
89
- requirement: &id006 !ruby/object:Gem::Requirement
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- segments:
94
- - 1
95
- - 0
96
- - 0
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: bundler
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
97
101
  version: 1.0.0
98
102
  type: :development
99
- version_requirements: *id006
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 1.0.0
100
110
  description: jQuery plugin to provide easy way to handle DOM elements by role attribute
101
111
  email: koss@nocorp.me
102
112
  executables: []
103
-
104
113
  extensions: []
105
-
106
114
  extra_rdoc_files: []
107
-
108
- files:
115
+ files:
109
116
  - .gitignore
110
117
  - .gitmodules
111
118
  - Gemfile
@@ -154,60 +161,38 @@ files:
154
161
  - vendor/assets/javascripts/jquery.role.min.js
155
162
  - vendor/assets/javascripts/role.js
156
163
  - 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
180
- has_rdoc: true
181
164
  homepage: https://github.com/kossnocorp/role-rails
182
- licenses:
165
+ licenses:
183
166
  - MIT
184
167
  post_install_message:
185
168
  rdoc_options: []
186
-
187
- require_paths:
169
+ require_paths:
188
170
  - lib
189
- required_ruby_version: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - ">="
192
- - !ruby/object:Gem::Version
193
- segments:
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ none: false
173
+ requirements:
174
+ - - ! '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ segments:
194
178
  - 0
195
- version: "0"
196
- required_rubygems_version: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - ">="
199
- - !ruby/object:Gem::Version
200
- segments:
179
+ hash: -3661075772796767822
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
+ none: false
182
+ requirements:
183
+ - - ! '>='
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ segments:
201
187
  - 0
202
- version: "0"
188
+ hash: -3661075772796767822
203
189
  requirements: []
204
-
205
190
  rubyforge_project: role-rails
206
- rubygems_version: 1.3.6
191
+ rubygems_version: 1.8.22
207
192
  signing_key:
208
193
  specification_version: 3
209
194
  summary: jQuery plugin to provide easy way to handle DOM elements by role attribute
210
- test_files:
195
+ test_files:
211
196
  - test/dummy/README.rdoc
212
197
  - test/dummy/Rakefile
213
198
  - test/dummy/app/assets/javascripts/application.js
@@ -1 +0,0 @@
1
- *.js
@@ -1,9 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'rake'
4
- gem 'foreman'
5
- gem 'jasmine', '1.1.0'
6
- gem 'guard-coffeescript'
7
- gem 'rb-fsevent'
8
- gem 'growl_notify'
9
- gem 'uglifier'
@@ -1,2 +0,0 @@
1
- guard 'coffeescript', :input => 'src', :output => 'lib'
2
- guard 'coffeescript', :input => 'spec/javascripts', :output => 'spec/javascripts'
@@ -1,2 +0,0 @@
1
- jasmine: rake jasmine
2
- guard: guard
@@ -1,201 +0,0 @@
1
- # jquery.role — jQuery plugin to provide easy way to handle DOM elements by role attribute
2
-
3
- This project uses [Semantic Versioning](http://semver.org/) for release numbering.
4
-
5
- Sponsored by [Evil Martians](http://evilmartians.com/).
6
-
7
- ## Downloads
8
-
9
- * [jquery.role.min.js](https://raw.github.com/kossnocorp/role/master/lib/jquery.role.min.js)
10
- * [role.min.js](https://raw.github.com/kossnocorp/role/master/lib/jquery.role.min.js)
11
- * [jquery.role.js](https://raw.github.com/kossnocorp/role/master/lib/jquery.role.js)
12
- * [role.js](https://raw.github.com/kossnocorp/role/master/lib/role.js)
13
- * [jquery.role.coffee](https://raw.github.com/kossnocorp/role/master/src/jquery.role.coffee)
14
- * [role.coffee](https://raw.github.com/kossnocorp/role/master/src/role.coffee)
15
-
16
- Also you can add jquery.role.js and role.js by bundle `role-rails` gem. For futher details see *installation* section below.
17
-
18
- ## Use `role` attribute FTW
19
-
20
- ```
21
- Use cases for a role attribute for HTML5, include:
22
-
23
- * accessibility,
24
- * device adaptation,
25
- * server-side processing, and
26
- * complex data description.
27
- ```
28
-
29
- This is a quote from [W3C Specification on Role attribute](http://www.w3.org/wiki/PF/XTech/HTML5/RoleAttribute#A_Role_Attribute_for_HTML5).
30
-
31
- In [Evil Martians](http://evilmartians.com/) we came up with a way to use this attribute for our own purposes.
32
-
33
- Say you have to update your website page design. HTML markup is done and you have to apply it to the existing site. Of course this marvelous page is crammed with Javascript code tied to an existing structure.
34
-
35
- ``` javascript
36
- $('.list .item img')
37
- .mouseenter(function () {
38
- $(this).rotateTo(30, 300)
39
- })
40
- .mouseleave(function () {
41
- $(this).rotateTo(0, 300)
42
- });
43
- ```
44
-
45
- Obviously, you'll have to rewrite all the selectors for the new layout. And it would be nice if you had to fix only one (or even ten) of these selectors. In reality, most likely, there will be several dozen of them.
46
-
47
- Another issue is that refactoring process requires you to change the names or a number of classes. You'll have to muddle through every JS file to find all classes you are going to change.
48
-
49
- And, of course, in both cases the end result is absolutely unpredictable, because layout alone is not enougn to figure out if a class is actualy used in JS.
50
-
51
- The `.js-class_name` prefix use may seem like a good idea, except that someone will surely add styles to this class in a future... Let alone the difficulty to spot, among a large of number of classes, one with a prefix.
52
-
53
- In order to avoid this problems, we can "attach" JS to DOM elements by a `role` attribute.
54
-
55
- It's a lot safer then prefixes, beacause it's much harder to attach styles to `role` and it feals morally difficult to break the `role` use convention.
56
-
57
- With the use of `role`, layout update becomes very straightforward: you just have to add roles to a new element, and if you are not tied to the "magic numbers" -- it will work with no further hassle.
58
-
59
- To make life easier (shoutout to [@alex_chrome](https://twitter.com/#!/alex_chrome) for the great idea) we also extended jQuery selector syntax:
60
-
61
- ``` javascript
62
- $('@list @item @image')
63
- .mouseenter(function () {
64
- $(this).rotateTo(30, 300)
65
- })
66
- .mouseleave(function () {
67
- $(this).rotateTo(0, 300)
68
- });
69
- ```
70
-
71
- `$('@list @item @image')` is the same as `$('[role="list"] [role="item] [role="image"]')` and you can use "multirole": `$('@list@coupons')`.
72
-
73
- In addition to the jQuery plug-in, I also wrote a version that extends `querySelectorAll` of [Zepto.js](http://zeptojs.com/) with a Role functionality.
74
-
75
- Using of 'role' in a query may work a bit slower compared to usual selectors, but it's neglectable even in a large number of queries.
76
-
77
- In addition to `role`, I sometimes use `id`, but only in very extraodinary cases — because if there is only single element on a page today, it may happen that there will be a few tomorrow, even if that wasn't planned.
78
-
79
- ## Usage
80
-
81
- ### Using selectors
82
-
83
- You can use shortcut `@` in jQuery selectors to find elements with roles.
84
-
85
- Will select all elements in document with `role="ajax-link"`:
86
-
87
- ``` js
88
- $('@ajax-link')
89
- ```
90
-
91
- Also you can combinate roles:
92
-
93
- `<form role="from login_form"></form>`:
94
-
95
- ``` js
96
- $('@form@login_form')
97
- ```
98
-
99
- Will select all forms with "form" as role `<form role="from login_form"></form><form role="from registration_form"></form>`:
100
-
101
- ``` js
102
- $('@form')
103
- ```
104
-
105
- You can combine role with other selectors, but that is not recommended:
106
-
107
- `<form class="dark" role="login_form" method="post"></form>`:
108
-
109
- ``` js
110
- $('form.dark@login_form[method=post]')
111
- ```
112
-
113
- ## Installation
114
-
115
- Coming soon.
116
-
117
- ## Roadmap
118
-
119
- ### 1.1.0
120
-
121
- * Turn on configurable attribute shortcuts for Slim in role-rails (#14)
122
-
123
- ### 1.2.0
124
-
125
- * Add `@role_name.some_class` shortcut to Haml
126
-
127
- ### 1.3.0
128
-
129
- * Optional usage of `data-role` instead `role`.
130
- * Better docs
131
-
132
- ### 1.4.0
133
-
134
- * Optimization
135
- * More tests
136
-
137
- ## Changelog
138
-
139
- ### 1.0.2 (March 14, 2012)
140
-
141
- * Fixes problem in Internet Explorer 8 in jquery.role.js and role.js (issue #11) (thanks @igor-alexandrov for help)
142
-
143
- ### 1.0.1 (January 27, 2012)
144
-
145
- * Fixes problem with multiple roles in Firefox 8 and later (issue #9)
146
-
147
- ### 1.0.0 (December 26, 2011)
148
-
149
- * Remove depricated function
150
- * Rewrite in CoffeeScript
151
-
152
- ### 0.4.1 (December 8, 2011)
153
-
154
- * Fix issue #8
155
-
156
- ### 0.4.0 (December 8, 2011)
157
-
158
- * Added specs for jQuery Role
159
- * Selectors performance improvement for modern browsers (also covers #6)
160
- * Role extension for querySelectorAll function (`src/role.coffee`)
161
-
162
- ### 0.3.2 (June 2, 2011)
163
-
164
- * Reverted changes made in 0.3.1 because issue #6
165
-
166
- ### 0.3.1 (May 24, 2011)
167
-
168
- * Selectors performance improvement for modern browsers
169
-
170
- ### 0.3.0 (May 23, 2011)
171
-
172
- * Added native Sizzle selectors support (`$('@ajax_link')`)
173
-
174
- ### 0.2.0 (May 20, 2011)
175
-
176
- * Added mechanism to pick roles by element id
177
-
178
- ### 0.1.0 (May 05, 2011)
179
-
180
- * Initial release
181
-
182
- ## Contributors
183
-
184
- Original idea by @kossnocorp and @ai.
185
-
186
- * @kossnocorp
187
- * @chrome
188
-
189
- Special thanks to @skfd and @yaroslav for helping with this README.
190
-
191
- ## License
192
-
193
- The MIT License
194
-
195
- Copyright (c) 2011 Sasha Koss
196
-
197
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
198
-
199
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
200
-
201
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,10 +0,0 @@
1
- Dir['lib/tasks/*.rake'].sort.each { |r| load r }
2
-
3
- begin
4
- require 'jasmine'
5
- load 'jasmine/tasks/jasmine.rake'
6
- rescue LoadError
7
- task :jasmine do
8
- abort "Jasmine is not available. In order to run jasmine, you must: (sudo) gem install jasmine"
9
- end
10
- end
Binary file
@@ -1,13 +0,0 @@
1
- require 'uglifier'
2
-
3
- task :uglify do
4
- ['jquery.role', 'role'].each do |file_name|
5
- base_name = File.join('lib', file_name)
6
- File.write(
7
- base_name + '.min.js',
8
- Uglifier.new.compile(
9
- File.read(base_name + '.js')
10
- )
11
- )
12
- end
13
- end
@@ -1,3 +0,0 @@
1
- task :touch do
2
- puts `find . -name "*.coffee" -exec touch {} \+`
3
- end
@@ -1,4 +0,0 @@
1
- <div id="element_one" class="awesome_div" role="some_role"></div>
2
- <div id="element_two" role="role_one role_two">
3
- <div id="element_three" role="role_three"></div>
4
- </div>
@@ -1,52 +0,0 @@
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)
@@ -1,15 +0,0 @@
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:
@@ -1,23 +0,0 @@
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
@@ -1,32 +0,0 @@
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
@@ -1,37 +0,0 @@
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
- )
@@ -1,11 +0,0 @@
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\"]") )