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.
@@ -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
- it 'marks a link as .up-current if it links to the current URL, but is missing a trailing slash', ->
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
- it 'changes .up-current marks as the URL changes'
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
- it 'marks clicked linked as .up-active until the request finishes', ->
39
- $link = affix('a[href="/foo"][up-target=".main"]')
40
- affix('.main')
41
- jasmine.Ajax.install()
42
- $link.click()
43
- expect($link).toHaveClass('up-active')
44
- jasmine.Ajax.requests.mostRecent().respondWith
45
- status: 200
46
- contentType: 'text/html'
47
- responseText: '<div class="main">new-text</div>'
48
- expect($link).not.toHaveClass('up-active')
49
- expect($link).toHaveClass('up-current')
50
-
51
- it 'prefers to mark an enclosing [up-follow] click area', ->
52
- $area = affix('div[up-follow] a[href="/foo"][up-target=".main"]')
53
- $link = $area.find('a')
54
- affix('.main')
55
- jasmine.Ajax.install()
56
- $link.click()
57
- expect($area).toHaveClass('up-active')
58
- jasmine.Ajax.requests.mostRecent().respondWith
59
- status: 200
60
- contentType: 'text/html'
61
- responseText: '<div class="main">new-text</div>'
62
- expect($area).toHaveClass('up-current')
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.0
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-03-24 00:00:00.000000000 Z
11
+ date: 2015-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails