page_specific_js 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6235e122ff7b781435ac47d7b0cd0c79b93432c0
4
+ data.tar.gz: 4213c3bf73a72147008550a81a3d7f5ff4c26633
5
+ SHA512:
6
+ metadata.gz: 28d40a72bbdce6b3df0daf26ffe61e690f2bd71a038ed02b8c393808eb9dfe17a0f878f59ab1d4e69d04bc3ba63130102ceb0308161bd9dd0c355d866aa392a8
7
+ data.tar.gz: 6bce9da2027756e9ec07b643d29857ccc8aee464de9f008a2e96fb8e4f2d622501123e8707d645e69a8e40e3f041753ed325d27177ca115085f4d7516471fe28
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ page_specific_js
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p247
@@ -1,3 +1,3 @@
1
1
  module PageSpecificJs
2
- VERSION = "0.0.3"
2
+ VERSION = '0.0.4'
3
3
  end
@@ -26,6 +26,9 @@ DummyApplication = {
26
26
  allActions: function() {},
27
27
  someactionAction: function() {
28
28
  console.debug('someactionAction was called');
29
+ },
30
+ dashedActionAction: function() {
31
+ // should be invoked for action "dashed-action"
29
32
  }
30
33
  }
31
34
  }
@@ -157,4 +160,17 @@ describe("PageSpecific", function() {
157
160
  expect(DummyApplication.PageSpecific.TestTwoController.someactionAction).toHaveBeenCalled();
158
161
  });
159
162
  });
163
+
164
+ describe("when the action has a dash in it", function() {
165
+ beforeEach(function() {
166
+ $('body').attr('data-controller_name', 'test_two_controller');
167
+ $('body').attr('data-action_name', 'dashed-action');
168
+ });
169
+
170
+ it("should convert the dashed action to camelcase and call the controller+action specific method", function() {
171
+ spyOn(DummyApplication.PageSpecific.TestTwoController, 'dashedActionAction');
172
+ PageSpecific.init(DummyApplication);
173
+ expect(DummyApplication.PageSpecific.TestTwoController.dashedActionAction).toHaveBeenCalled();
174
+ });
175
+ });
160
176
  });
@@ -52,7 +52,7 @@ PageSpecific = {
52
52
  },
53
53
 
54
54
  camelize: function(str, lowerFirstChar) {
55
- var newStr = str.replace(/_(.)/g, function(match, firstChar) {
55
+ var newStr = str.replace(/[_-](.)/g, function(match, firstChar) {
56
56
  return firstChar.toUpperCase();
57
57
  });
58
58
  if (lowerFirstChar) {
metadata CHANGED
@@ -1,39 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page_specific_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sam Pierson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-20 00:00:00.000000000Z
11
+ date: 2013-08-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
- requirement: &70168186858560 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *70168186858560
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: jasmine
27
- requirement: &70168186857920 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :development
34
35
  prerelease: false
35
- version_requirements: *70168186857920
36
- description: ! " It allows you to target JS to run on all pages,\n for
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: " It allows you to target JS to run on all pages,\n for
37
42
  a particular action on all pages (e.g. index),\n for all actions
38
43
  for a specific controller,\n or for one specific controller/action
39
44
  (i.e. a single page).\n "
@@ -44,7 +49,8 @@ extensions: []
44
49
  extra_rdoc_files: []
45
50
  files:
46
51
  - .gitignore
47
- - .rvmrc
52
+ - .ruby-gemset
53
+ - .ruby-version
48
54
  - Gemfile
49
55
  - README.md
50
56
  - Rakefile
@@ -62,27 +68,26 @@ files:
62
68
  - vendor/assets/javascripts/page_specific.js
63
69
  homepage: ''
64
70
  licenses: []
71
+ metadata: {}
65
72
  post_install_message:
66
73
  rdoc_options: []
67
74
  require_paths:
68
75
  - lib
69
76
  required_ruby_version: !ruby/object:Gem::Requirement
70
- none: false
71
77
  requirements:
72
- - - ! '>='
78
+ - - '>='
73
79
  - !ruby/object:Gem::Version
74
80
  version: '0'
75
81
  required_rubygems_version: !ruby/object:Gem::Requirement
76
- none: false
77
82
  requirements:
78
- - - ! '>='
83
+ - - '>='
79
84
  - !ruby/object:Gem::Version
80
85
  version: '0'
81
86
  requirements: []
82
87
  rubyforge_project: page_specific_js
83
- rubygems_version: 1.8.10
88
+ rubygems_version: 2.0.5
84
89
  signing_key:
85
- specification_version: 3
90
+ specification_version: 4
86
91
  summary: Page-specific JavaScript framework for Rails
87
92
  test_files:
88
93
  - spec/javascripts/fixtures/.gitkeep
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use --create 1.9.2@page_specific_js