upjs-rails 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,7 +41,31 @@ describe 'up.magic', ->
41
41
 
42
42
  up.destroy('.container')
43
43
  expect(destructor).toHaveBeenCalled()
44
-
44
+
45
+ it 'parses an up-data attribute as JSON and passes the parsed object as a second argument to the initializer', ->
46
+
47
+ observeArgs = jasmine.createSpy()
48
+ up.awaken '.child', ($element, data) ->
49
+ observeArgs($element.attr('class'), data)
50
+
51
+ data = { key1: 'value1', key2: 'value2' }
52
+
53
+ $tag = affix(".child").attr('up-data', JSON.stringify(data))
54
+ up.ready($tag)
55
+
56
+ expect(observeArgs).toHaveBeenCalledWith('child', data)
57
+
58
+ it 'passes an empty object as a second argument to the initializer if there is no up-data attribute', ->
59
+
60
+ observeArgs = jasmine.createSpy()
61
+ up.awaken '.child', ($element, data) ->
62
+ observeArgs($element.attr('class'), data)
63
+
64
+ up.ready(affix(".child"))
65
+
66
+ expect(observeArgs).toHaveBeenCalledWith('child', {})
67
+
68
+
45
69
  describe 'up.ready', ->
46
70
 
47
71
  it 'should have tests'
@@ -19,7 +19,7 @@ describe 'up.navigation', ->
19
19
  jasmine.Ajax.requests.mostRecent().respondWith
20
20
  status: 200
21
21
  contentType: 'text/html'
22
- responseHeaders: { 'X-Up-Current-Location': '/foo/' }
22
+ responseHeaders: { 'X-Up-Location': '/foo/' }
23
23
  responseText: '<div class="main">new-text</div>'
24
24
  expect($link).toHaveClass('up-current')
25
25
 
@@ -31,7 +31,7 @@ describe 'up.navigation', ->
31
31
  jasmine.Ajax.requests.mostRecent().respondWith
32
32
  status: 200
33
33
  contentType: 'text/html'
34
- responseHeaders: { 'X-Up-Current-Location': '/foo' }
34
+ responseHeaders: { 'X-Up-Location': '/foo' }
35
35
  responseText: '<div class="main">new-text</div>'
36
36
  expect($link).toHaveClass('up-current')
37
37
 
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.3.3
4
+ version: 0.4.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: 2015-04-29 00:00:00.000000000 Z
11
+ date: 2015-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -131,10 +131,12 @@ files:
131
131
  - lib/assets/javascripts/up/motion.js.coffee
132
132
  - lib/assets/javascripts/up/navigation.js.coffee
133
133
  - lib/assets/javascripts/up/popup.js.coffee
134
+ - lib/assets/javascripts/up/proxy.js.coffee
134
135
  - lib/assets/javascripts/up/tooltip.js.coffee
135
136
  - lib/assets/javascripts/up/util.js.coffee
136
137
  - lib/assets/stylesheets/up.css
137
138
  - lib/assets/stylesheets/up/close.css.sass
139
+ - lib/assets/stylesheets/up/error.css.sass
138
140
  - lib/assets/stylesheets/up/follow.css.sass
139
141
  - lib/assets/stylesheets/up/modal.css.sass
140
142
  - lib/assets/stylesheets/up/popup.css.sass