unpoly-rails 0.26.2 → 0.27.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -1
- data/dist/unpoly.js +704 -446
- data/dist/unpoly.min.js +3 -3
- data/lib/assets/javascripts/unpoly/browser.js.coffee +18 -9
- data/lib/assets/javascripts/unpoly/bus.js.coffee +28 -1
- data/lib/assets/javascripts/unpoly/flow.js.coffee +1 -1
- data/lib/assets/javascripts/unpoly/history.js.coffee +54 -22
- data/lib/assets/javascripts/unpoly/link.js.coffee +1 -1
- data/lib/assets/javascripts/unpoly/log.js.coffee +19 -12
- data/lib/assets/javascripts/unpoly/modal.js.coffee +119 -124
- data/lib/assets/javascripts/unpoly/motion.js.coffee +1 -0
- data/lib/assets/javascripts/unpoly/navigation.js.coffee +2 -6
- data/lib/assets/javascripts/unpoly/popup.js.coffee +136 -126
- data/lib/assets/javascripts/unpoly/proxy.js.coffee +0 -2
- data/lib/assets/javascripts/unpoly/syntax.js.coffee +1 -1
- data/lib/assets/javascripts/unpoly/tooltip.js.coffee +101 -46
- data/lib/assets/javascripts/unpoly/util.js.coffee +76 -7
- data/lib/unpoly/rails/version.rb +1 -1
- data/spec_app/Gemfile.lock +1 -1
- data/spec_app/app/assets/stylesheets/integration_test.sass +4 -0
- data/spec_app/app/assets/stylesheets/jasmine_specs.sass +5 -0
- data/spec_app/app/views/css_test/modal.erb +3 -0
- data/spec_app/app/views/css_test/modal_contents.erb +5 -0
- data/spec_app/app/views/css_test/popup.erb +11 -11
- data/spec_app/app/views/css_test/tooltip.erb +12 -5
- data/spec_app/app/views/pages/start.erb +4 -0
- data/spec_app/spec/javascripts/helpers/reset_up.js.coffee +2 -3
- data/spec_app/spec/javascripts/up/flow_spec.js.coffee +97 -88
- data/spec_app/spec/javascripts/up/history_spec.js.coffee +100 -1
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +18 -16
- data/spec_app/spec/javascripts/up/modal_spec.js.coffee +102 -97
- data/spec_app/spec/javascripts/up/motion_spec.js.coffee +89 -75
- data/spec_app/spec/javascripts/up/navigation_spec.js.coffee +17 -5
- data/spec_app/spec/javascripts/up/popup_spec.js.coffee +89 -70
- data/spec_app/spec/javascripts/up/util_spec.js.coffee +23 -0
- metadata +4 -2
@@ -52,7 +52,7 @@ up.util = (($) ->
|
|
52
52
|
Whether to include an `#hash` anchor in the normalized URL
|
53
53
|
@param {Boolean} [options.search=true]
|
54
54
|
Whether to include a `?query` string in the normalized URL
|
55
|
-
@param {Boolean} [options.stripTrailingSlash=
|
55
|
+
@param {Boolean} [options.stripTrailingSlash=true]
|
56
56
|
Whether to strip a trailing slash from the pathname
|
57
57
|
@internal
|
58
58
|
###
|
@@ -65,7 +65,7 @@ up.util = (($) ->
|
|
65
65
|
# We have seen this in IE11 and W3Schools claims it happens in IE9 or earlier
|
66
66
|
# http://www.w3schools.com/jsref/prop_anchor_pathname.asp
|
67
67
|
pathname = "/#{pathname}" unless pathname[0] == '/'
|
68
|
-
pathname = pathname.replace(/\/$/, '')
|
68
|
+
pathname = pathname.replace(/\/$/, '') unless options?.stripTrailingSlash == false
|
69
69
|
normalized += pathname
|
70
70
|
normalized += anchor.hash if options?.hash == true
|
71
71
|
normalized += anchor.search unless options?.search == false
|
@@ -566,7 +566,7 @@ up.util = (($) ->
|
|
566
566
|
copy = (object) ->
|
567
567
|
if isArray(object)
|
568
568
|
object.slice()
|
569
|
-
else
|
569
|
+
else if isHash(object)
|
570
570
|
extend({}, object)
|
571
571
|
|
572
572
|
###*
|
@@ -827,7 +827,9 @@ up.util = (($) ->
|
|
827
827
|
scrollbarWidth = memoize ->
|
828
828
|
# This is how Bootstrap does it also:
|
829
829
|
# https://github.com/twbs/bootstrap/blob/c591227602996c542b9fd0cb65cff3cc9519bdd5/dist/js/bootstrap.js#L1187
|
830
|
-
$outer = $('<div>')
|
830
|
+
$outer = $('<div>')
|
831
|
+
$outer.attr('up-viewport', '')
|
832
|
+
$outer.css
|
831
833
|
position: 'absolute'
|
832
834
|
top: '0'
|
833
835
|
left: '0'
|
@@ -948,7 +950,7 @@ up.util = (($) ->
|
|
948
950
|
The timing function that controls the animation's acceleration.
|
949
951
|
See [W3C documentation](http://www.w3.org/TR/css3-transitions/#transition-timing-function)
|
950
952
|
for a list of pre-defined timing functions.
|
951
|
-
@return
|
953
|
+
@return {Deferred}
|
952
954
|
A promise for the animation's end.
|
953
955
|
@internal
|
954
956
|
###
|
@@ -963,6 +965,13 @@ up.util = (($) ->
|
|
963
965
|
easing: 'ease'
|
964
966
|
)
|
965
967
|
|
968
|
+
if opts.duration == 0
|
969
|
+
# In case the duration is zero we 1) spare ourselves all the trouble below,
|
970
|
+
# and 2) return a deferred that actually resolve, since a CSS transition with
|
971
|
+
# a zero duration never fires a transitionEnd event.
|
972
|
+
$element.css(lastFrame)
|
973
|
+
return resolvedDeferred()
|
974
|
+
|
966
975
|
# We don't finish an existing animation here, since the public API
|
967
976
|
# we expose as `up.motion.animate` already does this.
|
968
977
|
deferred = $.Deferred()
|
@@ -1497,9 +1506,12 @@ up.util = (($) ->
|
|
1497
1506
|
@function up.util.config
|
1498
1507
|
@internal
|
1499
1508
|
###
|
1500
|
-
config = (
|
1509
|
+
config = (blueprint = {}) ->
|
1501
1510
|
hash = {}
|
1502
|
-
hash.reset = ->
|
1511
|
+
hash.reset = ->
|
1512
|
+
newOptions = blueprint
|
1513
|
+
newOptions = newOptions() if isFunction(newOptions)
|
1514
|
+
extend(hash, newOptions)
|
1503
1515
|
hash.reset()
|
1504
1516
|
Object.preventExtensions(hash)
|
1505
1517
|
hash
|
@@ -1748,6 +1760,62 @@ up.util = (($) ->
|
|
1748
1760
|
# This is by far the fastest way to do this
|
1749
1761
|
not jQuery.contains(document.documentElement, element)
|
1750
1762
|
|
1763
|
+
###*
|
1764
|
+
Given a function that will return a promise, returns a proxy function
|
1765
|
+
with an additional `.promise` attribute.
|
1766
|
+
|
1767
|
+
When the proxy is called, the inner function is called.
|
1768
|
+
The proxy's `.promise` attribute is available even before the function is called
|
1769
|
+
and will resolve when the inner function's returned promise resolves.
|
1770
|
+
|
1771
|
+
@function up.util.previewable
|
1772
|
+
@internal
|
1773
|
+
###
|
1774
|
+
previewable = (fun) ->
|
1775
|
+
deferred = $.Deferred()
|
1776
|
+
preview = (args...) ->
|
1777
|
+
fun(args...).then ->
|
1778
|
+
deferred.resolve()
|
1779
|
+
preview.promise = deferred.promise()
|
1780
|
+
preview
|
1781
|
+
|
1782
|
+
###*
|
1783
|
+
A linear task queue whose (2..n)th tasks can be changed at any time.
|
1784
|
+
|
1785
|
+
@function up.util.DivertibleChain
|
1786
|
+
@internal
|
1787
|
+
###
|
1788
|
+
class DivertibleChain
|
1789
|
+
|
1790
|
+
constructor: ->
|
1791
|
+
@reset()
|
1792
|
+
|
1793
|
+
reset: =>
|
1794
|
+
@queue = []
|
1795
|
+
@currentTask = undefined
|
1796
|
+
|
1797
|
+
promise: =>
|
1798
|
+
promises = map @allTasks(), (task) -> task.promise
|
1799
|
+
$.when(promises...)
|
1800
|
+
|
1801
|
+
allTasks: =>
|
1802
|
+
tasks = []
|
1803
|
+
tasks.push(@currentTask) if @currentTask
|
1804
|
+
tasks = tasks.concat(@queue)
|
1805
|
+
tasks
|
1806
|
+
|
1807
|
+
poke: =>
|
1808
|
+
unless @currentTask # don't start a new task while we're still running one
|
1809
|
+
if @currentTask = @queue.shift()
|
1810
|
+
promise = @currentTask()
|
1811
|
+
promise.always =>
|
1812
|
+
@currentTask = undefined
|
1813
|
+
@poke()
|
1814
|
+
|
1815
|
+
asap: (newTasks...) =>
|
1816
|
+
@queue = map(newTasks, previewable)
|
1817
|
+
@poke()
|
1818
|
+
|
1751
1819
|
isDetached: isDetached
|
1752
1820
|
requestDataAsArray: requestDataAsArray
|
1753
1821
|
requestDataAsQuery: requestDataAsQuery
|
@@ -1853,6 +1921,7 @@ up.util = (($) ->
|
|
1853
1921
|
whenReady: whenReady
|
1854
1922
|
identity: identity
|
1855
1923
|
escapeHtml: escapeHtml
|
1924
|
+
DivertibleChain: DivertibleChain
|
1856
1925
|
|
1857
1926
|
)($)
|
1858
1927
|
|
data/lib/unpoly/rails/version.rb
CHANGED
data/spec_app/Gemfile.lock
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
<div class="
|
1
|
+
<div class="fixed-top-bar">
|
2
|
+
<a class="button" href="/css_test/popup_contents?1" up-popup=".contents" up-position="top-left">Top-left popup</a>
|
3
|
+
<a class="button" href="/css_test/popup_contents?2" up-popup=".contents" up-position="top-right">Top-right popup</a>
|
4
|
+
<a class="button" href="/css_test/popup_contents?3" up-popup=".contents" up-position="bottom-right">Bottom-right popup</a>
|
5
|
+
<a class="button" href="/css_test/popup_contents?4" up-popup=".contents" up-position="bottom-left">Bottom-left popup</a>
|
2
6
|
</div>
|
3
7
|
|
4
|
-
<div class="
|
5
|
-
<a class="button" href="/css_test/popup_contents" up-popup=".contents" up-position="top-left">Top-left popup</a>
|
8
|
+
<div class="spacer">
|
6
9
|
</div>
|
7
10
|
|
8
11
|
<div class="example">
|
9
|
-
<a class="button" href="/css_test/popup_contents" up-popup=".contents" up-position="top-
|
12
|
+
<a class="button" href="/css_test/popup_contents?5" up-popup=".contents" up-position="top-left">Top-left popup</a>
|
10
13
|
</div>
|
11
14
|
|
12
15
|
<div class="example">
|
13
|
-
<a class="button" href="/css_test/popup_contents" up-popup=".contents" up-position="
|
16
|
+
<a class="button" href="/css_test/popup_contents?6" up-popup=".contents" up-position="top-right">Top-right popup</a>
|
14
17
|
</div>
|
15
18
|
|
16
19
|
<div class="example">
|
17
|
-
<a class="button" href="/css_test/popup_contents" up-popup=".contents" up-position="bottom-
|
20
|
+
<a class="button" href="/css_test/popup_contents?7" up-popup=".contents" up-position="bottom-right">Bottom-right popup</a>
|
18
21
|
</div>
|
19
22
|
|
20
|
-
<div class="
|
21
|
-
<a class="button" href="/css_test/popup_contents" up-popup=".contents" up-position="
|
22
|
-
<a class="button" href="/css_test/popup_contents" up-popup=".contents" up-position="top-right">Top-right popup</a>
|
23
|
-
<a class="button" href="/css_test/popup_contents" up-popup=".contents" up-position="bottom-right">Bottom-right popup</a>
|
24
|
-
<a class="button" href="/css_test/popup_contents" up-popup=".contents" up-position="bottom-left">Bottom-left popup</a>
|
23
|
+
<div class="example">
|
24
|
+
<a class="button" href="/css_test/popup_contents?8" up-popup=".contents" up-position="bottom-left">Bottom-left popup</a>
|
25
25
|
</div>
|
@@ -1,3 +1,13 @@
|
|
1
|
+
<div class="fixed-top-bar">
|
2
|
+
<a class="button" href="#" up-tooltip="Tooltip text" up-position="top">Top tooltip</a>
|
3
|
+
<a class="button" href="#" up-tooltip="Tooltip text" up-position="bottom">Bottom tooltip</a>
|
4
|
+
<a class="button" href="#" up-tooltip="Tooltip text" up-position="left">Left tooltip</a>
|
5
|
+
<a class="button" href="#" up-tooltip="Tooltip text" up-position="right">Right tooltip</a>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="spacer">
|
9
|
+
</div>
|
10
|
+
|
1
11
|
<div class="example">
|
2
12
|
<a class="button" href="#" up-tooltip="Tooltip text" up-position="top">Top tooltip</a>
|
3
13
|
</div>
|
@@ -14,9 +24,6 @@
|
|
14
24
|
<a class="button" href="#" up-tooltip="Tooltip text" up-position="right">Right tooltip</a>
|
15
25
|
</div>
|
16
26
|
|
17
|
-
<div class="
|
18
|
-
|
19
|
-
<a class="button" href="#" up-tooltip="Tooltip text" up-position="bottom">Bottom tooltip</a>
|
20
|
-
<a class="button" href="#" up-tooltip="Tooltip text" up-position="left">Left tooltip</a>
|
21
|
-
<a class="button" href="#" up-tooltip="Tooltip text" up-position="right">Right tooltip</a>
|
27
|
+
<div class="example">
|
28
|
+
<% 1.upto(100) do |i| %><a class="button" href="#" up-tooltip="Tooltip <%= i %>"><%= i %></a><% end %>
|
22
29
|
</div>
|
@@ -161,7 +161,6 @@ describe 'up.flow', ->
|
|
161
161
|
it 'adds params from a { data } option to the URL of a GET request', ->
|
162
162
|
promise = up.replace('.middle', '/path', data: { 'foo-key': 'foo value', 'bar-key': 'bar value' })
|
163
163
|
@respond()
|
164
|
-
console.log("EXPECTATION COMING UP AGAINST %o", location.pathname)
|
165
164
|
expect(location.href).toEndWith('/path?foo-key=foo%20value&bar-key=bar%20value')
|
166
165
|
|
167
166
|
describe 'if a URL is given as { history } option', ->
|
@@ -599,75 +598,85 @@ describe 'up.flow', ->
|
|
599
598
|
|
600
599
|
describe 'with { transition } option', ->
|
601
600
|
|
602
|
-
|
603
|
-
affix('.element').text('version 1')
|
604
|
-
up.extract('.element', '<div class="element">version 2</div>', transition: 'cross-fade', duration: 200)
|
601
|
+
describeCapability 'canCssTransition', ->
|
605
602
|
|
606
|
-
|
607
|
-
|
608
|
-
|
603
|
+
it 'morphs between the old and new element', (done) ->
|
604
|
+
affix('.element').text('version 1')
|
605
|
+
up.extract('.element', '<div class="element">version 2</div>', transition: 'cross-fade', duration: 200)
|
609
606
|
|
610
|
-
|
611
|
-
|
612
|
-
|
607
|
+
$ghost1 = $('.element.up-ghost:contains("version 1")')
|
608
|
+
expect($ghost1).toHaveLength(1)
|
609
|
+
expect(u.opacity($ghost1)).toBeAround(1.0, 0.1)
|
613
610
|
|
614
|
-
|
615
|
-
expect(
|
616
|
-
expect(u.opacity($ghost2)).toBeAround(
|
617
|
-
done()
|
618
|
-
|
619
|
-
it 'marks the old fragment and its ghost as .up-destroying during the transition', ->
|
620
|
-
affix('.element').text('version 1')
|
621
|
-
up.extract('.element', '<div class="element">version 2</div>', transition: 'cross-fade', duration: 200)
|
622
|
-
|
623
|
-
$version1 = $('.element:not(.up-ghost):contains("version 1")')
|
624
|
-
$version1Ghost = $('.element.up-ghost:contains("version 1")')
|
625
|
-
expect($version1).toHaveLength(1)
|
626
|
-
expect($version1Ghost).toHaveLength(1)
|
627
|
-
expect($version1).toHaveClass('up-destroying')
|
628
|
-
expect($version1Ghost).toHaveClass('up-destroying')
|
629
|
-
|
630
|
-
$version2 = $('.element:not(.up-ghost):contains("version 2")')
|
631
|
-
$version2Ghost = $('.element.up-ghost:contains("version 2")')
|
632
|
-
expect($version2).toHaveLength(1)
|
633
|
-
expect($version2Ghost).toHaveLength(1)
|
634
|
-
expect($version2).not.toHaveClass('up-destroying')
|
635
|
-
expect($version2Ghost).not.toHaveClass('up-destroying')
|
636
|
-
|
637
|
-
it 'cancels an existing transition by instantly jumping to the last frame', ->
|
638
|
-
affix('.element').text('version 1')
|
639
|
-
up.extract('.element', '<div class="element">version 2</div>', transition: 'cross-fade', duration: 200)
|
640
|
-
|
641
|
-
$ghost1 = $('.element.up-ghost:contains("version 1")')
|
642
|
-
expect($ghost1).toHaveLength(1)
|
643
|
-
expect($ghost1.css('opacity')).toBeAround(1.0, 0.1)
|
644
|
-
|
645
|
-
$ghost2 = $('.element.up-ghost:contains("version 2")')
|
646
|
-
expect($ghost2).toHaveLength(1)
|
647
|
-
expect($ghost2.css('opacity')).toBeAround(0.0, 0.1)
|
648
|
-
|
649
|
-
up.extract('.element', '<div class="element">version 3</div>', transition: 'cross-fade', duration: 200)
|
611
|
+
$ghost2 = $('.element.up-ghost:contains("version 2")')
|
612
|
+
expect($ghost2).toHaveLength(1)
|
613
|
+
expect(u.opacity($ghost2)).toBeAround(0.0, 0.1)
|
650
614
|
|
651
|
-
|
652
|
-
|
615
|
+
u.setTimer 190, ->
|
616
|
+
expect(u.opacity($ghost1)).toBeAround(0.0, 0.3)
|
617
|
+
expect(u.opacity($ghost2)).toBeAround(1.0, 0.3)
|
618
|
+
done()
|
653
619
|
|
654
|
-
|
655
|
-
|
656
|
-
|
620
|
+
it 'marks the old fragment and its ghost as .up-destroying during the transition', ->
|
621
|
+
affix('.element').text('version 1')
|
622
|
+
up.extract('.element', '<div class="element">version 2</div>', transition: 'cross-fade', duration: 200)
|
623
|
+
|
624
|
+
$version1 = $('.element:not(.up-ghost):contains("version 1")')
|
625
|
+
$version1Ghost = $('.element.up-ghost:contains("version 1")')
|
626
|
+
expect($version1).toHaveLength(1)
|
627
|
+
expect($version1Ghost).toHaveLength(1)
|
628
|
+
expect($version1).toHaveClass('up-destroying')
|
629
|
+
expect($version1Ghost).toHaveClass('up-destroying')
|
630
|
+
|
631
|
+
$version2 = $('.element:not(.up-ghost):contains("version 2")')
|
632
|
+
$version2Ghost = $('.element.up-ghost:contains("version 2")')
|
633
|
+
expect($version2).toHaveLength(1)
|
634
|
+
expect($version2Ghost).toHaveLength(1)
|
635
|
+
expect($version2).not.toHaveClass('up-destroying')
|
636
|
+
expect($version2Ghost).not.toHaveClass('up-destroying')
|
637
|
+
|
638
|
+
it 'cancels an existing transition by instantly jumping to the last frame', ->
|
639
|
+
affix('.element').text('version 1')
|
640
|
+
up.extract('.element', '<div class="element">version 2</div>', transition: 'cross-fade', duration: 200)
|
641
|
+
|
642
|
+
$ghost1 = $('.element.up-ghost:contains("version 1")')
|
643
|
+
expect($ghost1).toHaveLength(1)
|
644
|
+
expect($ghost1.css('opacity')).toBeAround(1.0, 0.1)
|
645
|
+
|
646
|
+
$ghost2 = $('.element.up-ghost:contains("version 2")')
|
647
|
+
expect($ghost2).toHaveLength(1)
|
648
|
+
expect($ghost2.css('opacity')).toBeAround(0.0, 0.1)
|
649
|
+
|
650
|
+
up.extract('.element', '<div class="element">version 3</div>', transition: 'cross-fade', duration: 200)
|
651
|
+
|
652
|
+
$ghost1 = $('.element.up-ghost:contains("version 1")')
|
653
|
+
expect($ghost1).toHaveLength(0)
|
654
|
+
|
655
|
+
$ghost2 = $('.element.up-ghost:contains("version 2")')
|
656
|
+
expect($ghost2).toHaveLength(1)
|
657
|
+
expect($ghost2.css('opacity')).toBeAround(1.0, 0.1)
|
658
|
+
|
659
|
+
$ghost3 = $('.element.up-ghost:contains("version 3")')
|
660
|
+
expect($ghost3).toHaveLength(1)
|
661
|
+
expect($ghost3.css('opacity')).toBeAround(0.0, 0.1)
|
662
|
+
|
663
|
+
it 'delays the resolution of the returned promise until the transition is over', (done) ->
|
664
|
+
affix('.element').text('version 1')
|
665
|
+
resolution = jasmine.createSpy()
|
666
|
+
promise = up.extract('.element', '<div class="element">version 2</div>', transition: 'cross-fade', duration: 30)
|
667
|
+
promise.then(resolution)
|
668
|
+
expect(resolution).not.toHaveBeenCalled()
|
669
|
+
u.setTimer 70, ->
|
670
|
+
expect(resolution).toHaveBeenCalled()
|
671
|
+
done()
|
657
672
|
|
658
|
-
|
659
|
-
expect($ghost3).toHaveLength(1)
|
660
|
-
expect($ghost3.css('opacity')).toBeAround(0.0, 0.1)
|
673
|
+
describeFallback 'canCssTransition', ->
|
661
674
|
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
expect(resolution).not.toHaveBeenCalled()
|
668
|
-
u.setTimer 70, ->
|
669
|
-
expect(resolution).toHaveBeenCalled()
|
670
|
-
done()
|
675
|
+
it 'immediately swaps the old and new elements', ->
|
676
|
+
affix('.element').text('version 1')
|
677
|
+
up.extract('.element', '<div class="element">version 2</div>', transition: 'cross-fade', duration: 200)
|
678
|
+
expect($('.element')).toHaveText('version 2')
|
679
|
+
expect($('.up-ghost')).toHaveLength(0)
|
671
680
|
|
672
681
|
describe 'handling of [up-keep] elements', ->
|
673
682
|
|
@@ -802,9 +811,7 @@ describe 'up.flow', ->
|
|
802
811
|
<div class="keeper" up-keep>old-text</div>
|
803
812
|
"""
|
804
813
|
|
805
|
-
console.log '*** before hello ***'
|
806
814
|
up.hello($container)
|
807
|
-
console.log '*** after hello ***'
|
808
815
|
expect(compiler.calls.count()).toEqual(1)
|
809
816
|
|
810
817
|
up.extract '.container', """
|
@@ -893,29 +900,31 @@ describe 'up.flow', ->
|
|
893
900
|
expect(keptListener).toHaveBeenCalledWith($keeper, { key: 'value1' })
|
894
901
|
expect(keptListener).toHaveBeenCalledWith($keeper, { key: 'value2' })
|
895
902
|
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
<div class='
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
903
|
+
describeCapability 'canCssTransition', ->
|
904
|
+
|
905
|
+
it "doesn't let the discarded element appear in a transition", (done) ->
|
906
|
+
oldTextDuringTransition = undefined
|
907
|
+
newTextDuringTransition = undefined
|
908
|
+
transition = ($old, $new) ->
|
909
|
+
oldTextDuringTransition = squish($old.text())
|
910
|
+
newTextDuringTransition = squish($new.text())
|
911
|
+
u.resolvedDeferred()
|
912
|
+
$container = affix('.container')
|
913
|
+
$container.html """
|
914
|
+
<div class='foo'>old-foo</div>
|
915
|
+
<div class='bar' up-keep>old-bar</div>
|
916
|
+
"""
|
917
|
+
newHtml = """
|
918
|
+
<div class='container'>
|
919
|
+
<div class='foo'>new-foo</div>
|
920
|
+
<div class='bar' up-keep>new-bar</div>
|
921
|
+
</div>
|
922
|
+
"""
|
923
|
+
promise = up.extract('.container', newHtml, transition: transition)
|
924
|
+
promise.then ->
|
925
|
+
expect(oldTextDuringTransition).toEqual('old-foo old-bar')
|
926
|
+
expect(newTextDuringTransition).toEqual('new-foo old-bar')
|
927
|
+
done()
|
919
928
|
|
920
929
|
describe 'up.destroy', ->
|
921
930
|
|