unpoly-rails 0.60.0 → 0.60.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of unpoly-rails might be problematic. Click here for more details.

@@ -372,7 +372,7 @@ up.motion = do ->
372
372
 
373
373
  scrollNew = ->
374
374
  # Don't animate the scrolling.
375
- scrollOptions = u.merge(options, behavior: 'instant')
375
+ scrollOptions = u.merge(options, scrollBehavior: 'auto')
376
376
  # Scroll newElement into position before we start the enter animation.
377
377
  up.viewport.scrollAfterInsertFragment(newElement, scrollOptions)
378
378
 
@@ -154,7 +154,7 @@ This fixes two edge cases you might or might not care about:
154
154
  2. Some browsers have a bug where the initial request method is used for all
155
155
  subsequently pushed states. That means if the user reloads the page on a later
156
156
  GET state, the browser will wrongly attempt a POST request.
157
- This issue affects Safari 9 and 10 (last tested in 2017-08).
157
+ This issue affects Safari 9-12 (last tested in 2019-03).
158
158
  Modern Firefoxes, Chromes and IE10+ don't have this behavior.
159
159
 
160
160
  In order to allow Unpoly to detect the HTTP method of the initial page load,
@@ -158,7 +158,7 @@ up.proxy = do ->
158
158
 
159
159
  \#\#\# Example
160
160
 
161
- up.request('/search', params: { query: 'sunshine' }).then(function(response) {
161
+ up.request('/search', { params: { query: 'sunshine' } }).then(function(response) {
162
162
  console.log('The response text is %o', response.text)
163
163
  }).catch(function() {
164
164
  console.error('The request failed')
@@ -266,7 +266,7 @@ up.proxy = do ->
266
266
 
267
267
  \#\#\# Example
268
268
 
269
- up.request('/search', params: { query: 'sunshine' }).then(function(text) {
269
+ up.request('/search', { params: { query: 'sunshine' } }).then(function(text) {
270
270
  console.log('The response text is %o', text)
271
271
  }).catch(function() {
272
272
  console.error('The request failed')
@@ -82,7 +82,7 @@ up.syntax = do ->
82
82
  \#\#\# Cleaning up after yourself
83
83
 
84
84
  If your compiler returns a function, Unpoly will use this as a *destructor* to
85
- clean up if the element leaves the DOM. Note that in Unpoly the same DOM ad JavaScript environment
85
+ clean up if the element leaves the DOM. Note that in Unpoly the same DOM and JavaScript environment
86
86
  will persist through many page loads, so it's important to not create
87
87
  [memory leaks](https://makandracards.com/makandra/31325-how-to-create-memory-leaks-in-jquery).
88
88
 
@@ -126,7 +126,7 @@ up.syntax = do ->
126
126
  { "lat": 48.75, "lng": 11.45, "title": "Ingolstadt" }
127
127
  ]'></div>
128
128
 
129
- The JSON will parsed and handed to your compiler as a second argument:
129
+ The JSON will be parsed and handed to your compiler as a second argument:
130
130
 
131
131
  up.compiler('.google-map', function(element, pins) {
132
132
  var map = new google.maps.Map(element)
@@ -416,7 +416,7 @@ up.syntax = do ->
416
416
  { "lat": 48.75, "lng": 11.45, "title": "Ingolstadt" }
417
417
  ]'></div>
418
418
 
419
- The JSON will parsed and handed to your compiler as a second argument:
419
+ The JSON will be parsed and handed to your compiler as a second argument:
420
420
 
421
421
  up.compiler('.google-map', function(element, pins) {
422
422
  var map = new google.maps.Map(element)
@@ -18,7 +18,7 @@ layout, such as navigation bars or headers. Unpoly will respect these sticky
18
18
  elements when [revealing updated fragments](/up.reveal).
19
19
 
20
20
  You should also [tell Unpoly](/up.viewport.config#config.viewports) when your application has more than one viewport,
21
- you should so Unpoly can pick the right viewport to scroll for each fragment update.
21
+ so Unpoly can pick the right viewport to scroll for each fragment update.
22
22
 
23
23
 
24
24
  \#\#\# Bootstrap integration
@@ -4,6 +4,6 @@ module Unpoly
4
4
  # The current version of the unpoly-rails gem.
5
5
  # This version number is also used for releases of the Unpoly
6
6
  # frontend code.
7
- VERSION = '0.60.0'
7
+ VERSION = '0.60.1'
8
8
  end
9
9
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unpoly",
3
- "version": "0.60.0",
3
+ "version": "0.60.1",
4
4
  "description": "Unobtrusive JavaScript framework",
5
5
  "main": "dist/unpoly.js",
6
6
  "files": [
@@ -0,0 +1,5 @@
1
+ class CompilerTestController < ApplicationController
2
+
3
+ layout 'integration_test'
4
+
5
+ end
@@ -0,0 +1,9 @@
1
+ <script>
2
+ up.compiler('.timestamp', (element) => {
3
+ var now = new Date()
4
+ element.innerText = now
5
+ })
6
+ </script>
7
+
8
+ <div class="timestamp">
9
+ Uncompiled
@@ -72,6 +72,7 @@
72
72
  <li><%= link_to 'Scrolling behavior', '/scroll_test/long1' %></li>
73
73
  <li><%= link_to 'Animations', '/motion_test/animations' %></li>
74
74
  <li><%= link_to 'Transitions', '/motion_test/transitions' %></li>
75
+ <li><%= link_to 'Compilers', '/compiler_test/timestamp' %></li>
75
76
  </ul>
76
77
 
77
78
  </div>
@@ -15,6 +15,7 @@ Rails.application.routes.draw do
15
15
  get 'reveal_test/:action', controller: 'reveal_test'
16
16
  get 'scroll_test/:action', controller: 'scroll_test'
17
17
  get 'motion_test/:action', controller: 'motion_test'
18
+ get 'compiler_test/:action', controller: 'compiler_test'
18
19
 
19
20
  namespace :form_test do
20
21
  resource :basic, only: [:new, :create]
@@ -347,6 +347,15 @@ describe 'up.feedback', ->
347
347
  next =>
348
348
  expect($area).not.toHaveClass('up-active')
349
349
 
350
+ it 'removes .up-active when a link with [up-confirm] was not confirmed', asyncSpec (next) ->
351
+ $link = $fixture('a[href="/foo"][up-modal=".main"][up-confirm="Really follow?"]')
352
+ spyOn(up.browser, 'whenConfirmed').and.returnValue(Promise.reject('User aborted'))
353
+
354
+ Trigger.clickSequence($link)
355
+
356
+ next =>
357
+ expect($link).not.toHaveClass('up-active')
358
+
350
359
  it 'marks clicked modal openers as .up-active while the modal is loading', asyncSpec (next) ->
351
360
  $link = $fixture('a[href="/foo"][up-modal=".main"]')
352
361
  fixture('.main')
@@ -1965,6 +1965,30 @@ describe 'up.fragment', ->
1965
1965
  next =>
1966
1966
  expect(swapDirectlySpy).toHaveBeenCalled()
1967
1967
 
1968
+ describe 'with { scrollBehavior } option', ->
1969
+
1970
+ beforeEach ->
1971
+ up.viewport.knife.mock('reveal').and.callFake (element, options) =>
1972
+ @revealScrollBehavior = options.behavior ? options.scrollBehavior
1973
+
1974
+ it 'animates the revealing when prepending an element', asyncSpec (next) ->
1975
+ fixture('.element', text: 'version 1')
1976
+ up.extract('.element:before', '<div class="element">version 2</div>', reveal: true, scrollBehavior: 'smooth')
1977
+ next =>
1978
+ expect(@revealScrollBehavior).toEqual('smooth')
1979
+
1980
+ it 'animates the revealing when appending an element', asyncSpec (next) ->
1981
+ fixture('.element', text: 'version 1')
1982
+ up.extract('.element:after', '<div class="element">version 2</div>', reveal: true, scrollBehavior: 'smooth')
1983
+ next =>
1984
+ expect(@revealScrollBehavior).toEqual('smooth')
1985
+
1986
+ it 'does not animate the revealing when swapping out an element', asyncSpec (next) ->
1987
+ fixture('.element', text: 'version 1')
1988
+ up.extract('.element', '<div class="element">version 2</div>', reveal: true, scrollBehavior: 'smooth')
1989
+ next =>
1990
+ expect(@revealScrollBehavior).toEqual('auto')
1991
+
1968
1992
  describe 'handling of [up-keep] elements', ->
1969
1993
 
1970
1994
  squish = (string) ->
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.60.0
4
+ version: 0.60.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-24 00:00:00.000000000 Z
11
+ date: 2019-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -84,7 +84,6 @@ files:
84
84
  - design/positioning.txt
85
85
  - design/rename.txt
86
86
  - design/test_rejected_promise.txt
87
- - design/todo_jquery.txt
88
87
  - design/unpoly errors.txt
89
88
  - dist/unpoly-bootstrap3.css
90
89
  - dist/unpoly-bootstrap3.js
@@ -189,6 +188,7 @@ files:
189
188
  - spec_app/app/assets/stylesheets/jasmine_specs.sass
190
189
  - spec_app/app/controllers/application_controller.rb
191
190
  - spec_app/app/controllers/binding_test_controller.rb
191
+ - spec_app/app/controllers/compiler_test_controller.rb
192
192
  - spec_app/app/controllers/css_test_controller.rb
193
193
  - spec_app/app/controllers/error_test_controller.rb
194
194
  - spec_app/app/controllers/form_test/basics_controller.rb
@@ -204,6 +204,7 @@ files:
204
204
  - spec_app/app/helpers/application_helper.rb
205
205
  - spec_app/app/mailers/.keep
206
206
  - spec_app/app/models/concerns/.keep
207
+ - spec_app/app/views/compiler_test/timestamp.erb
207
208
  - spec_app/app/views/css_test/modal.erb
208
209
  - spec_app/app/views/css_test/modal_contents.erb
209
210
  - spec_app/app/views/css_test/modal_contents_wide.erb
@@ -1,13 +0,0 @@
1
- - PUBLISH
2
-
3
- - deploy cards with new version
4
-
5
- - deploy unpoly-guide
6
-
7
- - upgrade roca-style.org PR
8
- - better claim
9
- - no jquery
10
-
11
- - Update card with https://unpoly.com/up.util.parseUrl
12
- - https://makandracards.com/makandra/29377-the-easiest-way-to-parse-urls-with-javascript
13
-