unpoly-rails 0.25.2 → 0.26.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.

@@ -1,15 +1,21 @@
1
1
  .up-error
2
- background-color: #e10
2
+ background-color: #c30
3
3
  color: white
4
- padding: 5px
4
+ padding: 10px
5
5
  font-family: arial, helvetica, sans-serif
6
- font-weight: bold
7
6
  font-size: 14px
8
7
  line-height: 18px
9
8
  position: fixed
10
9
  left: 0
11
- top: 0
10
+ bottom: 0
12
11
  max-width: 100%
13
12
  box-sizing: border-box
14
13
  z-index: 99999999
15
-
14
+
15
+ .up-error-variable
16
+ background-color: rgba(0, 0, 0, 0.3)
17
+ padding: 1px 3px
18
+ border-radius: 2px
19
+ font-weight: normal
20
+ max-width: 100px
21
+ overflow: hidden
@@ -10,6 +10,7 @@ $background-color: #111
10
10
  color: white
11
11
  padding: 6px 9px
12
12
  white-space: nowrap
13
+ pointer-events: none
13
14
 
14
15
  &:after
15
16
  content: ''
@@ -23,7 +24,8 @@ $background-color: #111
23
24
  margin-top: -$distance-from-trigger
24
25
  &:after
25
26
  border-top-color: $background-color
26
- bottom: -$corner-size * 2
27
+ border-bottom-width: 0
28
+ bottom: -$corner-size
27
29
  left: 50%
28
30
  margin-left: -$corner-size
29
31
 
@@ -31,7 +33,8 @@ $background-color: #111
31
33
  margin-left: -$distance-from-trigger
32
34
  &:after
33
35
  border-left-color: $background-color
34
- right: -$corner-size * 2
36
+ border-right-width: 0
37
+ right: -$corner-size
35
38
  top: 50%
36
39
  margin-top: -$corner-size
37
40
 
@@ -39,7 +42,8 @@ $background-color: #111
39
42
  margin-left: $distance-from-trigger
40
43
  &:after
41
44
  border-right-color: $background-color
42
- left: -$corner-size * 2
45
+ border-left-width: 0
46
+ left: -$corner-size
43
47
  top: 50%
44
48
  margin-top: -$corner-size
45
49
 
@@ -47,6 +51,7 @@ $background-color: #111
47
51
  margin-top: $distance-from-trigger
48
52
  &:after
49
53
  border-bottom-color: $background-color
50
- top: -$corner-size * 2
54
+ border-top-width: 0
55
+ top: -$corner-size
51
56
  left: 50%
52
57
  margin-left: -$corner-size
@@ -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.25.2'
7
+ VERSION = '0.26.0'
8
8
  end
9
9
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- unpoly-rails (0.25.1)
4
+ unpoly-rails (0.26.0)
5
5
  rails (>= 3)
6
6
 
7
7
  GEM
@@ -0,0 +1,2 @@
1
+ beforeEach ->
2
+ up.log.enable()
@@ -2,7 +2,6 @@ beforeEach ->
2
2
  jasmine.addMatchers
3
3
  toHaveRequestMethod: (util, customEqualityTesters) ->
4
4
  compare: (request, expectedMethod) ->
5
- console.log("real is %o, wrapped is %o", request.method, request.data()['_method'])
6
5
  realMethodMatches = (request.method == expectedMethod)
7
6
  wrappedMethodMatches = util.equals(request.data()['_method'], [expectedMethod], customEqualityTesters)
8
7
  pass: realMethodMatches || wrappedMethodMatches
@@ -0,0 +1,3 @@
1
+ beforeAll (done) ->
2
+ $(done)
3
+
@@ -0,0 +1,46 @@
1
+ describe 'up.log', ->
2
+
3
+ describe 'Javascript functions', ->
4
+
5
+ describe 'up.log.puts', ->
6
+
7
+ it 'sends a log message to the developer console iff the log is enabled', ->
8
+ spyOn(up.browser, 'puts')
9
+
10
+ up.log.disable()
11
+ up.log.puts('message')
12
+ expect(up.browser.puts).not.toHaveBeenCalled()
13
+
14
+ up.log.enable()
15
+ up.log.puts('message')
16
+ expect(up.browser.puts).toHaveBeenCalledWith('log', '[UP] message')
17
+
18
+ describe 'up.log.debug', ->
19
+
20
+ it 'sends a debug message to the developer console iff the log is enabled', ->
21
+ spyOn(up.browser, 'puts')
22
+
23
+ up.log.disable()
24
+ up.log.debug('message')
25
+ expect(up.browser.puts).not.toHaveBeenCalled()
26
+
27
+ up.log.enable()
28
+ up.log.debug('message')
29
+ expect(up.browser.puts).toHaveBeenCalledWith('debug', '[UP] message')
30
+
31
+ describe 'up.log.error', ->
32
+
33
+ it 'sends an error message to the developer console regardless whether the log is enabled or not', ->
34
+ spyOn(up.browser, 'puts')
35
+
36
+ up.log.disable()
37
+ up.log.error('message1')
38
+ expect(up.browser.puts).toHaveBeenCalledWith('error', '[UP] message1')
39
+
40
+ up.log.enable()
41
+ up.log.error('message2')
42
+ expect(up.browser.puts.calls.allArgs()).toEqual [
43
+ ['error', '[UP] message1'],
44
+ ['error', '[UP] message2']
45
+ ]
46
+
@@ -6,13 +6,25 @@ describe 'up.popup', ->
6
6
 
7
7
  describe 'up.popup.attach', ->
8
8
 
9
- it "loads this link's destination in a popup when clicked", ->
10
- $link = affix('a[href="/path/to"][up-popup=".middle"]').text('link')
11
- $link.css
12
- position: 'fixed'
9
+ beforeEach ->
10
+ jasmine.addMatchers
11
+ toSitBelow: (util, customEqualityTesters) ->
12
+ compare: ($popup, $link) ->
13
+ pass: ->
14
+ popupDims = u.measure($popup, full: true)
15
+ linkDims = u.measure($link, full: true)
16
+ expect(popupDims.right).toBeAround(linkDims.right, 1)
17
+ expect(popupDims.top).toBeAround(linkDims.top + linkDims.height, 1)
18
+
19
+ it "loads this link's destination in a popup positioned under the given link", ->
20
+ $container = affix('.container')
21
+ $container.css
22
+ position: 'absolute'
13
23
  left: '100px'
14
24
  top: '50px'
15
25
 
26
+ $link = $container.affix('a[href="/path/to"][up-popup=".middle"]').text('link')
27
+
16
28
  up.popup.attach($link)
17
29
 
18
30
  expect(@lastRequest().url).toMatch /\/path\/to$/
@@ -29,11 +41,21 @@ describe 'up.popup', ->
29
41
  expect($popup.find('.before')).not.toExist()
30
42
  expect($popup.find('.after')).not.toExist()
31
43
 
32
- popupDims = u.measure($popup, full: true)
33
- linkDims = u.measure($link, full: true)
44
+ expect($popup.css('position')).toEqual('absolute')
45
+ expect($popup).toSitBelow($link)
34
46
 
35
- expect(popupDims.right).toBeAround(linkDims.right, 1)
36
- expect(popupDims.top).toBeAround(linkDims.top + linkDims.height, 1)
47
+ it 'gives the popup { position: "fixed" } if the given link is fixed', ->
48
+ $container = affix('.container')
49
+ $container.css
50
+ position: 'fixed'
51
+ left: '100px'
52
+ top: '50px'
53
+ $link = $container.affix('a[href="/path/to"][up-popup=".content"]').text('link')
54
+ up.popup.attach($link)
55
+ @respondWith('<div class="content">popup-content</div>')
56
+ $popup = $('.up-popup')
57
+ expect($popup.css('position')).toEqual('fixed')
58
+ expect($popup).toSitBelow($link)
37
59
 
38
60
  it 'does not explode if the popup was closed before the response was received', ->
39
61
  $span = affix('span')
@@ -2,6 +2,23 @@ describe 'up.util', ->
2
2
 
3
3
  describe 'Javascript functions', ->
4
4
 
5
+ describe 'up.util.isFixed', ->
6
+
7
+ it 'returns true if the given element or one of its ancestors has a "fixed" CSS position', ->
8
+ $grandGrandParent = affix('.grand-parent')
9
+ $grandParent = $grandGrandParent.affix('.grand-parent')
10
+ $parent = $grandParent.affix('.parent')
11
+ $child = $parent.affix('.child')
12
+ $grandParent.css(position: 'fixed')
13
+ expect(up.util.isFixed($child)).toBe(true)
14
+ expect(up.util.isFixed($parent)).toBe(true)
15
+ expect(up.util.isFixed($grandParent)).toBe(true)
16
+ expect(up.util.isFixed($grandGrandParent)).toBe(false)
17
+
18
+ it 'returns false if the given element and its ancestors all have a non-"fixed" CSS position', ->
19
+ $element = affix('.element')
20
+ expect(up.util.isFixed($element)).toBe(false)
21
+
5
22
  describe 'up.util.setTimer', ->
6
23
 
7
24
  it 'calls the given function after waiting the given milliseconds', ->
@@ -20,7 +37,7 @@ describe 'up.util', ->
20
37
  up.util.setTimer(0, callback)
21
38
  expect(callback).toHaveBeenCalled()
22
39
 
23
- # describe 'up.util.argNames', ->
40
+ # describe 'up.util.argNames', ->
24
41
  #
25
42
  # it 'returns an array of argument names for the given function', ->
26
43
  # fun = ($element, data) ->
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.25.2
4
+ version: 0.26.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: 2016-05-11 00:00:00.000000000 Z
11
+ date: 2016-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -101,7 +101,7 @@ files:
101
101
  - lib/assets/javascripts/unpoly/link.js.coffee
102
102
  - lib/assets/javascripts/unpoly/log.js.coffee
103
103
  - lib/assets/javascripts/unpoly/modal.js.coffee
104
- - lib/assets/javascripts/unpoly/module.js.coffee
104
+ - lib/assets/javascripts/unpoly/module.js.coffee.erb
105
105
  - lib/assets/javascripts/unpoly/motion.js.coffee
106
106
  - lib/assets/javascripts/unpoly/navigation.js.coffee
107
107
  - lib/assets/javascripts/unpoly/popup.js.coffee
@@ -195,6 +195,7 @@ files:
195
195
  - spec_app/spec/controllers/binding_test_controller_spec.rb
196
196
  - spec_app/spec/javascripts/helpers/append_fixture.js.coffee
197
197
  - spec_app/spec/javascripts/helpers/browser_switches.js.coffee
198
+ - spec_app/spec/javascripts/helpers/enable_logging.js.coffee
198
199
  - spec_app/spec/javascripts/helpers/index.js.coffee
199
200
  - spec_app/spec/javascripts/helpers/knife.js.coffee
200
201
  - spec_app/spec/javascripts/helpers/last_request.js.coffee
@@ -216,6 +217,7 @@ files:
216
217
  - spec_app/spec/javascripts/helpers/to_equal_jquery.js.coffee
217
218
  - spec_app/spec/javascripts/helpers/to_have_request_method.js.coffee
218
219
  - spec_app/spec/javascripts/helpers/trigger.js.coffee
220
+ - spec_app/spec/javascripts/helpers/wait_until_dom_ready.js.coffee
219
221
  - spec_app/spec/javascripts/support/jasmine.yml
220
222
  - spec_app/spec/javascripts/up/bus_spec.js.coffee
221
223
  - spec_app/spec/javascripts/up/flow_spec.js.coffee
@@ -223,6 +225,7 @@ files:
223
225
  - spec_app/spec/javascripts/up/history_spec.js.coffee
224
226
  - spec_app/spec/javascripts/up/layout_spec.js.coffee
225
227
  - spec_app/spec/javascripts/up/link_spec.js.coffee
228
+ - spec_app/spec/javascripts/up/log_spec.js.coffee
226
229
  - spec_app/spec/javascripts/up/modal_spec.js.coffee
227
230
  - spec_app/spec/javascripts/up/motion_spec.js.coffee
228
231
  - spec_app/spec/javascripts/up/navigation_spec.js.coffee
@@ -1,4 +0,0 @@
1
- ###*
2
- @module up
3
- ###
4
- window.up = {}