unpoly-rails 0.34.2 → 0.35.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.
Potentially problematic release.
This version of unpoly-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -2
- data/lib/assets/javascripts/unpoly/browser.coffee +41 -48
- data/lib/assets/javascripts/unpoly/bus.coffee +2 -1
- data/lib/assets/javascripts/unpoly/dom.coffee +2 -1
- data/lib/assets/javascripts/unpoly/form.coffee +4 -18
- data/lib/assets/javascripts/unpoly/motion.coffee +2 -4
- data/lib/assets/javascripts/unpoly/protocol.coffee +15 -8
- data/lib/assets/javascripts/unpoly/util.coffee +21 -40
- data/lib/unpoly/rails/version.rb +1 -1
- data/spec_app/Gemfile.lock +1 -1
- data/spec_app/spec/javascripts/helpers/to_have_request_method.js.coffee +9 -1
- data/spec_app/spec/javascripts/up/dom_spec.js.coffee +109 -92
- data/spec_app/spec/javascripts/up/form_spec.js.coffee +7 -23
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +16 -18
- data/spec_app/spec/javascripts/up/modal_spec.js.coffee +42 -46
- data/spec_app/spec/javascripts/up/motion_spec.js.coffee +249 -295
- data/spec_app/spec/javascripts/up/popup_spec.js.coffee +27 -29
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +3 -5
- data/spec_app/spec/javascripts/up/util_spec.js.coffee +1 -0
- metadata +2 -2
@@ -85,46 +85,44 @@ describe 'up.popup', ->
|
|
85
85
|
|
86
86
|
describe 'opening a popup while another modal is open', ->
|
87
87
|
|
88
|
-
|
88
|
+
it 'closes the current popup and wait for its close animation to finish before starting the open animation of a second popup', (done) ->
|
89
|
+
$span = affix('span')
|
90
|
+
up.popup.config.openAnimation = 'fade-in'
|
91
|
+
up.popup.config.openDuration = 5
|
92
|
+
up.popup.config.closeAnimation = 'fade-out'
|
93
|
+
up.popup.config.closeDuration = 60
|
89
94
|
|
90
|
-
|
91
|
-
|
92
|
-
up.
|
93
|
-
up.popup.config.openDuration = 5
|
94
|
-
up.popup.config.closeAnimation = 'fade-out'
|
95
|
-
up.popup.config.closeDuration = 60
|
95
|
+
events = []
|
96
|
+
u.each ['up:popup:open', 'up:popup:opened', 'up:popup:close', 'up:popup:closed'], (event) ->
|
97
|
+
up.on event, -> events.push(event)
|
96
98
|
|
97
|
-
|
98
|
-
u.each ['up:popup:open', 'up:popup:opened', 'up:popup:close', 'up:popup:closed'], (event) ->
|
99
|
-
up.on event, -> events.push(event)
|
99
|
+
up.popup.attach($span, { target: '.target', html: '<div class="target">response1</div>' })
|
100
100
|
|
101
|
-
|
101
|
+
# First popup is starting opening animation
|
102
|
+
expect(events).toEqual ['up:popup:open']
|
103
|
+
expect($('.target')).toHaveText('response1')
|
102
104
|
|
103
|
-
|
104
|
-
|
105
|
+
u.setTimer 80, ->
|
106
|
+
# First popup has completed opening animation
|
107
|
+
expect(events).toEqual ['up:popup:open', 'up:popup:opened']
|
105
108
|
expect($('.target')).toHaveText('response1')
|
106
109
|
|
107
|
-
|
108
|
-
|
109
|
-
expect(events).toEqual ['up:popup:open', 'up:popup:opened']
|
110
|
-
expect($('.target')).toHaveText('response1')
|
111
|
-
|
112
|
-
# We open another popup, which will cause the first modal to start closing
|
113
|
-
up.popup.attach($span, { target: '.target', html: '<div class="target">response2</div>' })
|
110
|
+
# We open another popup, which will cause the first modal to start closing
|
111
|
+
up.popup.attach($span, { target: '.target', html: '<div class="target">response2</div>' })
|
114
112
|
|
115
|
-
|
113
|
+
u.setTimer 20, ->
|
116
114
|
|
117
|
-
|
118
|
-
|
119
|
-
|
115
|
+
# Second popup is still waiting for first popup's closing animation to finish.
|
116
|
+
expect(events).toEqual ['up:popup:open', 'up:popup:opened', 'up:popup:close']
|
117
|
+
expect($('.target')).toHaveText('response1')
|
120
118
|
|
121
|
-
|
119
|
+
u.setTimer 200, ->
|
122
120
|
|
123
|
-
|
124
|
-
|
125
|
-
|
121
|
+
# First popup has finished closing, second popup has finished opening.
|
122
|
+
expect(events).toEqual ['up:popup:open', 'up:popup:opened', 'up:popup:close', 'up:popup:closed', 'up:popup:open', 'up:popup:opened']
|
123
|
+
expect($('.target')).toHaveText('response2')
|
126
124
|
|
127
|
-
|
125
|
+
done()
|
128
126
|
|
129
127
|
describe 'up.popup.coveredUrl', ->
|
130
128
|
|
@@ -388,11 +388,9 @@ describe 'up.proxy', ->
|
|
388
388
|
promise = up.proxy.get(url: '/foo', data: { key: 'value' })
|
389
389
|
expect(promise).toBeUndefined()
|
390
390
|
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
promise = up.proxy.get(url: '/foo', data: new FormData())
|
395
|
-
expect(promise).toBeUndefined()
|
391
|
+
it "returns undefined if the given request's { data } is a FormData object", ->
|
392
|
+
promise = up.proxy.get(url: '/foo', data: new FormData())
|
393
|
+
expect(promise).toBeUndefined()
|
396
394
|
|
397
395
|
describe 'up.proxy.set', ->
|
398
396
|
|
@@ -110,6 +110,7 @@ describe 'up.util', ->
|
|
110
110
|
element = up.util.createElementFromHtml(string)
|
111
111
|
|
112
112
|
expect(element.querySelector('head title').textContent).toEqual('document title')
|
113
|
+
expect(element.querySelector('body').getAttribute('data-env')).toEqual('production')
|
113
114
|
expect(element.querySelectorAll('body div').length).toBe(2)
|
114
115
|
expect(element.querySelectorAll('body div')[0].textContent).toEqual('line 1')
|
115
116
|
expect(element.querySelectorAll('body div')[1].textContent).toEqual('line 2')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unpoly-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.35.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: 2017-
|
11
|
+
date: 2017-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|