upjs-rails 0.16.0 → 0.17.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,53 @@
1
+ describe 'up.rails', ->
2
+
3
+ u = up.util
4
+
5
+ upAttributes = ['up-follow', 'up-target', 'up-modal', 'up-popup']
6
+
7
+ describe '[data-method]', ->
8
+
9
+ beforeEach ->
10
+ @oldRails = $.rails
11
+
12
+ afterEach ->
13
+ $.rails = @oldRails
14
+
15
+ describe 'when Rails UJS is loaded', ->
16
+
17
+ beforeEach ->
18
+ $.rails = {}
19
+
20
+ u.each upAttributes, (upAttribute) ->
21
+ describe "on an [#{upAttribute}] element", ->
22
+
23
+ it "is transformed to an up-method attribute so the element isn't handled a second time by Rails UJS", ->
24
+ $element = affix("span[#{upAttribute}][data-method=\"put\"]")
25
+ up.hello($element)
26
+ expect($element.attr('data-method')).toBeUndefined()
27
+ expect($element.attr('up-method')).toEqual('put')
28
+
29
+ it "does not overwrite an existing up-method attribute, but gets deleted", ->
30
+ $element = affix("span[#{upAttribute}][up-method=\"patch\"][data-method=\"put\"]")
31
+ up.hello($element)
32
+ expect($element.attr('data-method')).toBeUndefined()
33
+ expect($element.attr('up-method')).toEqual('patch')
34
+
35
+ describe 'on an element without Up.js attributes', ->
36
+
37
+ it "is not changed", ->
38
+ $element = affix("span[data-method=\"put\"]")
39
+ up.hello($element)
40
+ expect($element.attr('data-method')).toEqual('put')
41
+
42
+ describe 'when Rails UJS is not loaded', ->
43
+
44
+ beforeEach ->
45
+ $.rails = undefined
46
+
47
+ u.each upAttributes, (upAttribute) ->
48
+ describe "on an [#{upAttribute}] element", ->
49
+
50
+ it "is not changed", ->
51
+ $element = affix("span[#{upAttribute}][data-method=\"put\"]")
52
+ up.hello($element)
53
+ expect($element.attr('data-method')).toEqual('put')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-15 00:00:00.000000000 Z
11
+ date: 2016-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,6 +108,7 @@ files:
108
108
  - lib/assets/javascripts/up/navigation.js.coffee
109
109
  - lib/assets/javascripts/up/popup.js.coffee
110
110
  - lib/assets/javascripts/up/proxy.js.coffee
111
+ - lib/assets/javascripts/up/rails.js.coffee
111
112
  - lib/assets/javascripts/up/syntax.js.coffee
112
113
  - lib/assets/javascripts/up/tooltip.js.coffee
113
114
  - lib/assets/javascripts/up/util.js.coffee
@@ -195,6 +196,7 @@ files:
195
196
  - spec_app/spec/javascripts/helpers/mock_ajax.js.coffee
196
197
  - spec_app/spec/javascripts/helpers/mock_clock.js.coffee
197
198
  - spec_app/spec/javascripts/helpers/remove_body_margin.js.coffee
199
+ - spec_app/spec/javascripts/helpers/reset_knife.js.coffee
198
200
  - spec_app/spec/javascripts/helpers/reset_path.js.coffee
199
201
  - spec_app/spec/javascripts/helpers/reset_up.js.coffee
200
202
  - spec_app/spec/javascripts/helpers/restore_body_scroll.js.coffee
@@ -215,6 +217,7 @@ files:
215
217
  - spec_app/spec/javascripts/up/navigation_spec.js.coffee
216
218
  - spec_app/spec/javascripts/up/popup_spec.js.coffee
217
219
  - spec_app/spec/javascripts/up/proxy_spec.js.coffee
220
+ - spec_app/spec/javascripts/up/rails_spec.js.coffee
218
221
  - spec_app/spec/javascripts/up/syntax_spec.js.coffee
219
222
  - spec_app/spec/javascripts/up/tooltip_spec.js.coffee
220
223
  - spec_app/spec/javascripts/up/util_spec.js.coffee