upjs-rails 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dist/up.css +5 -1
- data/dist/up.js +239 -95
- data/dist/up.min.css +1 -1
- data/dist/up.min.js +1 -1
- data/lib/assets/javascripts/up.js.coffee +6 -2
- data/lib/assets/javascripts/up/browser.js.coffee +52 -0
- data/lib/assets/javascripts/up/flow.js.coffee +9 -2
- data/lib/assets/javascripts/up/form.js.coffee +4 -0
- data/lib/assets/javascripts/up/history.js.coffee +10 -6
- data/lib/assets/javascripts/up/magic.js.coffee +4 -0
- data/lib/assets/javascripts/up/marker.js.coffee +4 -2
- data/lib/assets/javascripts/up/modal.js.coffee +1 -1
- data/lib/assets/javascripts/up/motion.js.coffee +28 -26
- data/lib/assets/javascripts/up/popup.js.coffee +1 -1
- data/lib/assets/javascripts/up/util.js.coffee +99 -38
- data/lib/assets/stylesheets/up/modal.css.sass +7 -2
- data/lib/upjs/rails/version.rb +1 -1
- data/spec_app/spec/javascripts/helpers/reset_path.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/flow_spec.js.coffee +90 -68
- data/spec_app/spec/javascripts/up/form_spec.js.coffee +90 -77
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +35 -24
- data/spec_app/spec/javascripts/up/navigation_spec.js.coffee +52 -50
- metadata +2 -2
@@ -9,55 +9,57 @@ describe 'up.navigation', ->
|
|
9
9
|
expect($currentLink).toHaveClass('up-current')
|
10
10
|
expect($otherLink).not.toHaveClass('up-current')
|
11
11
|
|
12
|
-
|
13
|
-
$link = affix('a[href="/foo"][up-target=".main"]')
|
14
|
-
affix('.main')
|
15
|
-
jasmine.Ajax.install()
|
16
|
-
$link.click()
|
17
|
-
jasmine.Ajax.requests.mostRecent().respondWith
|
18
|
-
status: 200
|
19
|
-
contentType: 'text/html'
|
20
|
-
responseHeaders: { 'X-Up-Current-Location': '/foo/' }
|
21
|
-
responseText: '<div class="main">new-text</div>'
|
22
|
-
expect($link).toHaveClass('up-current')
|
23
|
-
|
24
|
-
it 'marks a link as .up-current if it links to the current URL, but has an extra trailing slash', ->
|
25
|
-
$link = affix('a[href="/foo/"][up-target=".main"]')
|
26
|
-
affix('.main')
|
27
|
-
jasmine.Ajax.install()
|
28
|
-
$link.click()
|
29
|
-
jasmine.Ajax.requests.mostRecent().respondWith
|
30
|
-
status: 200
|
31
|
-
contentType: 'text/html'
|
32
|
-
responseHeaders: { 'X-Up-Current-Location': '/foo' }
|
33
|
-
responseText: '<div class="main">new-text</div>'
|
34
|
-
expect($link).toHaveClass('up-current')
|
12
|
+
if up.browser.canPushState()
|
35
13
|
|
36
|
-
|
14
|
+
it 'marks a link as .up-current if it links to the current URL, but is missing a trailing slash', ->
|
15
|
+
$link = affix('a[href="/foo"][up-target=".main"]')
|
16
|
+
affix('.main')
|
17
|
+
jasmine.Ajax.install()
|
18
|
+
$link.click()
|
19
|
+
jasmine.Ajax.requests.mostRecent().respondWith
|
20
|
+
status: 200
|
21
|
+
contentType: 'text/html'
|
22
|
+
responseHeaders: { 'X-Up-Current-Location': '/foo/' }
|
23
|
+
responseText: '<div class="main">new-text</div>'
|
24
|
+
expect($link).toHaveClass('up-current')
|
37
25
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
26
|
+
it 'marks a link as .up-current if it links to the current URL, but has an extra trailing slash', ->
|
27
|
+
$link = affix('a[href="/foo/"][up-target=".main"]')
|
28
|
+
affix('.main')
|
29
|
+
jasmine.Ajax.install()
|
30
|
+
$link.click()
|
31
|
+
jasmine.Ajax.requests.mostRecent().respondWith
|
32
|
+
status: 200
|
33
|
+
contentType: 'text/html'
|
34
|
+
responseHeaders: { 'X-Up-Current-Location': '/foo' }
|
35
|
+
responseText: '<div class="main">new-text</div>'
|
36
|
+
expect($link).toHaveClass('up-current')
|
37
|
+
|
38
|
+
it 'changes .up-current marks as the URL changes'
|
39
|
+
|
40
|
+
it 'marks clicked linked as .up-active until the request finishes', ->
|
41
|
+
$link = affix('a[href="/foo"][up-target=".main"]')
|
42
|
+
affix('.main')
|
43
|
+
jasmine.Ajax.install()
|
44
|
+
$link.click()
|
45
|
+
expect($link).toHaveClass('up-active')
|
46
|
+
jasmine.Ajax.requests.mostRecent().respondWith
|
47
|
+
status: 200
|
48
|
+
contentType: 'text/html'
|
49
|
+
responseText: '<div class="main">new-text</div>'
|
50
|
+
expect($link).not.toHaveClass('up-active')
|
51
|
+
expect($link).toHaveClass('up-current')
|
52
|
+
|
53
|
+
it 'prefers to mark an enclosing [up-follow] click area', ->
|
54
|
+
$area = affix('div[up-follow] a[href="/foo"][up-target=".main"]')
|
55
|
+
$link = $area.find('a')
|
56
|
+
affix('.main')
|
57
|
+
jasmine.Ajax.install()
|
58
|
+
$link.click()
|
59
|
+
expect($area).toHaveClass('up-active')
|
60
|
+
jasmine.Ajax.requests.mostRecent().respondWith
|
61
|
+
status: 200
|
62
|
+
contentType: 'text/html'
|
63
|
+
responseText: '<div class="main">new-text</div>'
|
64
|
+
expect($area).toHaveClass('up-current')
|
65
|
+
|
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.
|
4
|
+
version: 0.3.2
|
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-
|
11
|
+
date: 2015-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|