unpoly-rails 0.61.1 → 1.0.1
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 +56 -1
- data/Gemfile +0 -1
- data/Gemfile.lock +1 -7
- data/README.md +7 -6
- data/Rakefile +10 -1
- data/dist/unpoly.js +85 -55
- data/dist/unpoly.min.js +4 -4
- data/lib/assets/javascripts/unpoly/classes/body_shifter.coffee +21 -12
- data/lib/assets/javascripts/unpoly/classes/follow_variant.coffee +11 -3
- data/lib/assets/javascripts/unpoly/classes/params.coffee.erb +1 -0
- data/lib/assets/javascripts/unpoly/classes/request.coffee +1 -0
- data/lib/assets/javascripts/unpoly/element.coffee.erb +8 -5
- data/lib/assets/javascripts/unpoly/event.coffee.erb +1 -1
- data/lib/assets/javascripts/unpoly/form.coffee.erb +16 -1
- data/lib/assets/javascripts/unpoly/fragment.coffee.erb +1 -0
- data/lib/assets/javascripts/unpoly/framework.coffee +7 -9
- data/lib/assets/javascripts/unpoly/log.coffee +7 -2
- data/lib/assets/javascripts/unpoly/modal.coffee.erb +2 -0
- data/lib/assets/javascripts/unpoly/motion.coffee.erb +1 -1
- data/lib/assets/javascripts/unpoly/protocol.coffee +2 -0
- data/lib/assets/javascripts/unpoly/syntax.coffee.erb +2 -3
- data/lib/assets/javascripts/unpoly/util.coffee.erb +2 -1
- data/lib/unpoly/rails/version.rb +1 -1
- data/package.json +1 -1
- data/spec_app/Gemfile +0 -1
- data/spec_app/Gemfile.lock +1 -7
- data/spec_app/app/views/compiler_test/timestamp.erb +1 -0
- data/spec_app/app/views/css_test/modal.erb +1 -1
- data/spec_app/app/views/css_test/popup.erb +1 -1
- data/spec_app/spec/javascripts/up/fragment_spec.js.coffee +27 -1
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +7 -2
- data/spec_app/spec/javascripts/up/modal_spec.js.coffee +23 -1
- data/spec_app/spec/javascripts/up/popup_spec.js.coffee +2 -1
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +8 -0
- data/spec_app/spec/javascripts/up/util_spec.js.coffee +14 -0
- metadata +3 -3
@@ -928,9 +928,14 @@ describe 'up.link', ->
|
|
928
928
|
Trigger.mouseup(@$link)
|
929
929
|
next => expect(@followSpy).not.toHaveBeenCalled()
|
930
930
|
|
931
|
-
it 'does nothing on click', asyncSpec (next)->
|
931
|
+
it 'does nothing on click if there was an earlier mousedown event', asyncSpec (next)->
|
932
|
+
Trigger.mousedown(@$link)
|
932
933
|
Trigger.click(@$link)
|
933
|
-
next => expect(@followSpy
|
934
|
+
next => expect(@followSpy.calls.count()).toBe(1)
|
935
|
+
|
936
|
+
it 'does follow a link on click if there was never a mousedown event (e.g. if the user pressed enter)', asyncSpec (next) ->
|
937
|
+
Trigger.click(@$link)
|
938
|
+
next => expect(@followSpy.calls.mostRecent().args[0]).toEqual(@$link[0])
|
934
939
|
|
935
940
|
# IE does not call JavaScript and always performs the default action on right clicks
|
936
941
|
unless AgentDetector.isIE() || AgentDetector.isEdge()
|
@@ -532,8 +532,9 @@ describe 'up.modal', ->
|
|
532
532
|
next => expect(@followSpy).not.toHaveBeenCalled()
|
533
533
|
|
534
534
|
it 'does nothing on click', asyncSpec (next) ->
|
535
|
+
Trigger.mousedown(@$link)
|
535
536
|
Trigger.click(@$link)
|
536
|
-
next => expect(@followSpy
|
537
|
+
next => expect(@followSpy.calls.count()).toBe(1)
|
537
538
|
|
538
539
|
# IE does not call JavaScript and always performs the default action on right clicks
|
539
540
|
unless AgentDetector.isIE() || AgentDetector.isEdge()
|
@@ -562,6 +563,27 @@ describe 'up.modal', ->
|
|
562
563
|
next =>
|
563
564
|
expect(@lastRequest().method).toEqual 'POST'
|
564
565
|
|
566
|
+
describe 'with [up-cache] modifier', ->
|
567
|
+
it 'honours the given setting', asyncSpec (next) ->
|
568
|
+
$link = $fixture('a[href="/path"][up-modal=".target"][up-cache="false"]')
|
569
|
+
Trigger.clickSequence($link)
|
570
|
+
|
571
|
+
next =>
|
572
|
+
@respondWith('<div class="target">modal content 1</div>')
|
573
|
+
|
574
|
+
next =>
|
575
|
+
expect('.up-modal .target').toHaveText('modal content 1')
|
576
|
+
history.back()
|
577
|
+
|
578
|
+
next =>
|
579
|
+
Trigger.clickSequence($link)
|
580
|
+
|
581
|
+
next =>
|
582
|
+
@respondWith('<div class="target">modal content 2</div>')
|
583
|
+
|
584
|
+
next =>
|
585
|
+
expect('.up-modal .target').toHaveText('modal content 2')
|
586
|
+
|
565
587
|
it 'adds a history entry and allows the user to use the back button', asyncSpec (next) ->
|
566
588
|
up.motion.config.enabled = false
|
567
589
|
up.history.config.enabled = true
|
@@ -232,8 +232,9 @@ describe 'up.popup', ->
|
|
232
232
|
next => expect(@attachSpy).not.toHaveBeenCalled()
|
233
233
|
|
234
234
|
it 'does nothing on click', asyncSpec (next) ->
|
235
|
+
Trigger.mousedown(@$link)
|
235
236
|
Trigger.click(@$link)
|
236
|
-
next => expect(@attachSpy
|
237
|
+
next => expect(@attachSpy.calls.count()).toBe(1)
|
237
238
|
|
238
239
|
# IE does not call JavaScript and always performs the default action on right clicks
|
239
240
|
unless AgentDetector.isIE() || AgentDetector.isEdge()
|
@@ -38,6 +38,14 @@ describe 'up.proxy', ->
|
|
38
38
|
expect(request.requestHeaders['X-Up-Target']).toEqual('.target')
|
39
39
|
expect(request.requestHeaders['X-Up-Fail-Target']).toEqual('.fail-target')
|
40
40
|
|
41
|
+
it "sends Unpoly's version as an X-Up-Version request header", asyncSpec (next) ->
|
42
|
+
up.request(url: '/foo')
|
43
|
+
|
44
|
+
next =>
|
45
|
+
versionHeader = @lastRequest().requestHeaders['X-Up-Version']
|
46
|
+
expect(versionHeader).toBePresent()
|
47
|
+
expect(versionHeader).toEqual(up.version)
|
48
|
+
|
41
49
|
it 'resolves to a Response object that contains information about the response and request', (done) ->
|
42
50
|
promise = up.request(
|
43
51
|
url: '/url'
|
@@ -1418,3 +1418,17 @@ describe 'up.util', ->
|
|
1418
1418
|
it 'returns false (and does not crash) for undefined', ->
|
1419
1419
|
value = undefined
|
1420
1420
|
expect(up.util.isJQuery(value)).toBe(false)
|
1421
|
+
|
1422
|
+
describe 'up.util.escapeHtml', ->
|
1423
|
+
|
1424
|
+
it 'escapes double quotes', ->
|
1425
|
+
result = up.util.escapeHtml('before"after')
|
1426
|
+
expect(result).toEqual('before"after')
|
1427
|
+
|
1428
|
+
it 'escapes single quotes', ->
|
1429
|
+
result = up.util.escapeHtml("before'after")
|
1430
|
+
expect(result).toEqual('before'after')
|
1431
|
+
|
1432
|
+
it 'escapes angle brackets', ->
|
1433
|
+
result = up.util.escapeHtml('before<script>after')
|
1434
|
+
expect(result).toEqual('before<script>after')
|
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: 1.0.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:
|
11
|
+
date: 2021-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -400,7 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
400
400
|
- !ruby/object:Gem::Version
|
401
401
|
version: '0'
|
402
402
|
requirements: []
|
403
|
-
rubygems_version: 3.
|
403
|
+
rubygems_version: 3.2.16
|
404
404
|
signing_key:
|
405
405
|
specification_version: 4
|
406
406
|
summary: Rails bindings for Unpoly, the unobtrusive JavaScript framework
|