unpoly-rails 0.57.0 → 0.60.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of unpoly-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +393 -1
- data/Gemfile.lock +5 -2
- data/README.md +1 -1
- data/README_RAILS.md +1 -1
- data/Rakefile +10 -1
- data/design/es6.js +32 -0
- data/design/ie11.txt +9 -0
- data/design/measure_jquery/element_list.js +41 -0
- data/design/measure_jquery/up.on_vs_addEventListener.js +56 -0
- data/design/todo_jquery.txt +13 -0
- data/dist/unpoly-bootstrap3.js +8 -8
- data/dist/unpoly-bootstrap3.min.js +1 -1
- data/dist/unpoly.css +22 -20
- data/dist/unpoly.js +6990 -5336
- data/dist/unpoly.min.css +1 -1
- data/dist/unpoly.min.js +4 -4
- data/lib/assets/javascripts/unpoly-bootstrap3/viewport-ext.coffee +5 -0
- data/lib/assets/javascripts/unpoly.coffee +8 -6
- data/lib/assets/javascripts/unpoly/browser.coffee.erb +23 -118
- data/lib/assets/javascripts/unpoly/classes/body_shifter.coffee +36 -0
- data/lib/assets/javascripts/unpoly/classes/cache.coffee +4 -4
- data/lib/assets/javascripts/unpoly/classes/compile_pass.coffee +45 -39
- data/lib/assets/javascripts/unpoly/classes/config.coffee +9 -0
- data/lib/assets/javascripts/unpoly/classes/css_transition.coffee +18 -27
- data/lib/assets/javascripts/unpoly/classes/divertible_chain.coffee +39 -0
- data/lib/assets/javascripts/unpoly/classes/event_listener.coffee +116 -0
- data/lib/assets/javascripts/unpoly/classes/extract_cascade.coffee +8 -8
- data/lib/assets/javascripts/unpoly/classes/extract_plan.coffee +19 -19
- data/lib/assets/javascripts/unpoly/classes/field_observer.coffee +54 -31
- data/lib/assets/javascripts/unpoly/classes/{focus_tracker.coffee → focus_follower.coffee} +2 -2
- data/lib/assets/javascripts/unpoly/classes/follow_variant.coffee +25 -25
- data/lib/assets/javascripts/unpoly/classes/html_parser.coffee +4 -11
- data/lib/assets/javascripts/unpoly/classes/motion_controller.coffee +157 -0
- data/lib/assets/javascripts/unpoly/classes/params.coffee.erb +525 -0
- data/lib/assets/javascripts/unpoly/classes/record.coffee +8 -2
- data/lib/assets/javascripts/unpoly/classes/rect.js +21 -0
- data/lib/assets/javascripts/unpoly/classes/request.coffee +41 -35
- data/lib/assets/javascripts/unpoly/classes/response.coffee +7 -3
- data/lib/assets/javascripts/unpoly/classes/reveal_motion.coffee +102 -0
- data/lib/assets/javascripts/unpoly/classes/scroll_motion.coffee +67 -0
- data/lib/assets/javascripts/unpoly/classes/selector.coffee +60 -0
- data/lib/assets/javascripts/unpoly/classes/tether.coffee +105 -0
- data/lib/assets/javascripts/unpoly/classes/url_set.coffee +12 -7
- data/lib/assets/javascripts/unpoly/element.coffee.erb +1126 -0
- data/lib/assets/javascripts/unpoly/event.coffee.erb +437 -0
- data/lib/assets/javascripts/unpoly/feedback.coffee +73 -94
- data/lib/assets/javascripts/unpoly/form.coffee.erb +188 -181
- data/lib/assets/javascripts/unpoly/{dom.coffee.erb → fragment.coffee.erb} +250 -283
- data/lib/assets/javascripts/unpoly/framework.coffee +67 -0
- data/lib/assets/javascripts/unpoly/history.coffee +29 -28
- data/lib/assets/javascripts/unpoly/legacy.coffee +60 -0
- data/lib/assets/javascripts/unpoly/link.coffee.erb +127 -119
- data/lib/assets/javascripts/unpoly/log.coffee +99 -19
- data/lib/assets/javascripts/unpoly/modal.coffee.erb +95 -118
- data/lib/assets/javascripts/unpoly/motion.coffee.erb +158 -138
- data/lib/assets/javascripts/unpoly/namespace.coffee.erb +0 -5
- data/lib/assets/javascripts/unpoly/popup.coffee.erb +119 -102
- data/lib/assets/javascripts/unpoly/protocol.coffee +11 -15
- data/lib/assets/javascripts/unpoly/proxy.coffee +62 -65
- data/lib/assets/javascripts/unpoly/radio.coffee +3 -5
- data/lib/assets/javascripts/unpoly/rails.coffee +8 -9
- data/lib/assets/javascripts/unpoly/syntax.coffee.erb +173 -125
- data/lib/assets/javascripts/unpoly/toast.coffee +25 -24
- data/lib/assets/javascripts/unpoly/tooltip.coffee +89 -79
- data/lib/assets/javascripts/unpoly/util.coffee.erb +579 -1074
- data/lib/assets/javascripts/unpoly/{layout.coffee.erb → viewport.coffee.erb} +334 -264
- data/lib/assets/stylesheets/unpoly/dom.sass +1 -1
- data/lib/assets/stylesheets/unpoly/layout.sass +2 -0
- data/lib/assets/stylesheets/unpoly/popup.sass +0 -1
- data/lib/assets/stylesheets/unpoly/tooltip.sass +17 -12
- data/lib/unpoly/rails/version.rb +1 -1
- data/package.json +1 -2
- data/spec_app/Gemfile +2 -1
- data/spec_app/Gemfile.lock +38 -27
- data/spec_app/app/assets/javascripts/integration_test.coffee +1 -0
- data/spec_app/app/assets/javascripts/jasmine_specs.coffee +1 -2
- data/spec_app/app/assets/stylesheets/integration_test.sass +14 -1
- data/spec_app/app/controllers/scroll_test_controller.rb +5 -0
- data/spec_app/app/views/css_test/modal.erb +6 -6
- data/spec_app/app/views/css_test/popup.erb +44 -18
- data/spec_app/app/views/css_test/tooltip.erb +23 -4
- data/spec_app/app/views/error_test/trigger.erb +1 -1
- data/spec_app/app/views/form_test/basics/new.erb +1 -3
- data/spec_app/app/views/pages/start.erb +9 -2
- data/spec_app/app/views/reveal_test/long1.erb +1 -1
- data/spec_app/app/views/reveal_test/long2.erb +1 -1
- data/spec_app/app/views/reveal_test/within_document_viewport.erb +24 -0
- data/spec_app/app/views/reveal_test/within_overflowing_div_viewport.erb +28 -0
- data/spec_app/app/views/scroll_test/long1.erb +30 -0
- data/spec_app/config/routes.rb +1 -0
- data/spec_app/spec/javascripts/helpers/agent_detector.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/async_sequence.js.coffee +1 -0
- data/spec_app/spec/javascripts/helpers/browser_switches.js.coffee +17 -5
- data/spec_app/spec/javascripts/helpers/enable_logging.js.coffee +1 -1
- data/spec_app/spec/javascripts/helpers/fixture.js.coffee +25 -0
- data/spec_app/spec/javascripts/helpers/jquery_no_conflict.js +1 -0
- data/spec_app/spec/javascripts/helpers/last_request.js.coffee +1 -0
- data/spec_app/spec/javascripts/helpers/mock_ajax.js.coffee +1 -1
- data/spec_app/spec/javascripts/helpers/parse_form_data.js.coffee +2 -2
- data/spec_app/spec/javascripts/helpers/protect_jasmine_runner.coffee +4 -1
- data/spec_app/spec/javascripts/helpers/remove_body_margin.js.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/reset_history.js.coffee +2 -1
- data/spec_app/spec/javascripts/helpers/reset_knife.js.coffee +2 -2
- data/spec_app/spec/javascripts/helpers/reset_up.js.coffee +18 -11
- data/spec_app/spec/javascripts/helpers/restore_body_scroll.js.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/show_lib_versions.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/spec_util.coffee +47 -0
- data/spec_app/spec/javascripts/helpers/to_be_around.js.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/to_be_array.coffee +5 -0
- data/spec_app/spec/javascripts/helpers/to_be_attached.coffee +6 -2
- data/spec_app/spec/javascripts/helpers/to_be_blank.js.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/to_be_detached.coffee +6 -2
- data/spec_app/spec/javascripts/helpers/to_be_element.js.coffee +8 -0
- data/spec_app/spec/javascripts/helpers/to_be_error.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/to_be_given.js.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/to_be_hidden.js.coffee +8 -0
- data/spec_app/spec/javascripts/helpers/to_be_missing.js.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/to_be_present.js.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/to_be_scrolled_to.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/to_be_visible.js.coffee +9 -0
- data/spec_app/spec/javascripts/helpers/to_contain.js.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/to_end_with.js.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/to_equal_jquery.js.coffee +1 -2
- data/spec_app/spec/javascripts/helpers/to_equal_node_list.coffee +7 -0
- data/spec_app/spec/javascripts/helpers/to_equal_via_is_equal.js.coffee +7 -0
- data/spec_app/spec/javascripts/helpers/to_have_class.js.coffee +10 -0
- data/spec_app/spec/javascripts/helpers/to_have_descendant.js.coffee +10 -0
- data/spec_app/spec/javascripts/helpers/to_have_length.js.coffee +8 -0
- data/spec_app/spec/javascripts/helpers/to_have_opacity.coffee +7 -3
- data/spec_app/spec/javascripts/helpers/to_have_own_property.js.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/to_have_request_method.js.coffee +1 -0
- data/spec_app/spec/javascripts/helpers/to_have_text.js.coffee +9 -0
- data/spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee +0 -21
- data/spec_app/spec/javascripts/helpers/to_match_list.coffee +14 -0
- data/spec_app/spec/javascripts/helpers/to_match_selector.coffee +3 -0
- data/spec_app/spec/javascripts/helpers/to_match_text.js.coffee +4 -1
- data/spec_app/spec/javascripts/helpers/to_match_url.coffee +1 -0
- data/spec_app/spec/javascripts/helpers/trigger.js.coffee +91 -7
- data/spec_app/spec/javascripts/helpers/wait_until_dom_ready.js.coffee +3 -0
- data/spec_app/spec/javascripts/up/browser_spec.js.coffee +23 -90
- data/spec_app/spec/javascripts/up/classes/cache_spec.js.coffee +3 -0
- data/spec_app/spec/javascripts/up/classes/config_spec.coffee +24 -0
- data/spec_app/spec/javascripts/up/classes/divertible_chain_spec.coffee +45 -0
- data/spec_app/spec/javascripts/up/classes/focus_tracker_spec.coffee +5 -2
- data/spec_app/spec/javascripts/up/classes/params_spec.coffee +557 -0
- data/spec_app/spec/javascripts/up/classes/request_spec.coffee +7 -4
- data/spec_app/spec/javascripts/up/classes/scroll_motion_spec.js.coffee +51 -0
- data/spec_app/spec/javascripts/up/classes/store/memory_spec.js.coffee +3 -0
- data/spec_app/spec/javascripts/up/classes/store/session_spec.js.coffee +3 -2
- data/spec_app/spec/javascripts/up/element_spec.coffee +897 -0
- data/spec_app/spec/javascripts/up/event_spec.js.coffee +496 -0
- data/spec_app/spec/javascripts/up/feedback_spec.js.coffee +69 -48
- data/spec_app/spec/javascripts/up/form_spec.js.coffee +252 -194
- data/spec_app/spec/javascripts/up/{dom_spec.js.coffee → fragment_spec.js.coffee} +381 -388
- data/spec_app/spec/javascripts/up/history_spec.js.coffee +21 -19
- data/spec_app/spec/javascripts/up/jquery_spec.js.coffee +4 -0
- data/spec_app/spec/javascripts/up/legacy_spec.js.coffee +27 -0
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +163 -160
- data/spec_app/spec/javascripts/up/log_spec.js.coffee +85 -12
- data/spec_app/spec/javascripts/up/modal_spec.js.coffee +141 -123
- data/spec_app/spec/javascripts/up/motion_spec.js.coffee +117 -113
- data/spec_app/spec/javascripts/up/popup_spec.js.coffee +60 -77
- data/spec_app/spec/javascripts/up/protocol_spec.js.coffee +1 -0
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +85 -78
- data/spec_app/spec/javascripts/up/radio_spec.js.coffee +29 -22
- data/spec_app/spec/javascripts/up/rails_spec.js.coffee +14 -13
- data/spec_app/spec/javascripts/up/spec_spec.js.coffee +9 -0
- data/spec_app/spec/javascripts/up/syntax_spec.js.coffee +96 -66
- data/spec_app/spec/javascripts/up/toast_spec.js.coffee +37 -0
- data/spec_app/spec/javascripts/up/tooltip_spec.js.coffee +31 -47
- data/spec_app/spec/javascripts/up/util_spec.js.coffee +725 -562
- data/spec_app/spec/javascripts/up/{layout_spec.js.coffee → viewport_spec.js.coffee} +175 -149
- metadata +57 -19
- data/lib/assets/javascripts/unpoly-bootstrap3/layout-ext.coffee +0 -5
- data/lib/assets/javascripts/unpoly/bus.coffee.erb +0 -518
- data/lib/assets/javascripts/unpoly/classes/extract_step.coffee +0 -4
- data/lib/assets/javascripts/unpoly/classes/motion_tracker.coffee +0 -125
- data/lib/assets/javascripts/unpoly/params.coffee.erb +0 -522
- data/spec_app/spec/javascripts/helpers/append_fixture.js.coffee +0 -8
- data/spec_app/spec/javascripts/up/bus_spec.js.coffee +0 -210
- data/spec_app/spec/javascripts/up/namespace_spec.js.coffee +0 -9
- data/spec_app/spec/javascripts/up/params_spec.coffee +0 -768
- data/spec_app/vendor/asset-libs/jasmine-fixture-1.3.4/jasmine-fixture.js +0 -433
- data/spec_app/vendor/asset-libs/jasmine-jquery-2.1.1/.bower.json +0 -26
- data/spec_app/vendor/asset-libs/jasmine-jquery-2.1.1/jasmine-jquery.js +0 -838
@@ -9,11 +9,14 @@
|
|
9
9
|
<%= link_to 'Jasmine specs with jQuery 3', '/specs?jquery=3' %>
|
10
10
|
<ul>
|
11
11
|
<% %w[
|
12
|
-
up.
|
12
|
+
up.browser
|
13
|
+
up.element
|
14
|
+
up.event
|
13
15
|
up.feedback
|
14
16
|
up.form
|
17
|
+
up.fragment
|
15
18
|
up.history
|
16
|
-
up.
|
19
|
+
up.legacy
|
17
20
|
up.link
|
18
21
|
up.log
|
19
22
|
up.modal
|
@@ -26,6 +29,7 @@
|
|
26
29
|
up.toast
|
27
30
|
up.tooltip
|
28
31
|
up.util
|
32
|
+
up.viewport
|
29
33
|
].each do |mod| %>
|
30
34
|
<li><%= link_to mod, "/specs?spec=#{mod}" %></li>
|
31
35
|
<% end %>
|
@@ -62,7 +66,10 @@
|
|
62
66
|
<li><%= link_to 'Fragment update', '/replace_test/page1' %></li>
|
63
67
|
<li><%= link_to 'Hash links (without Unpoly)', '/hash_test/vanilla#one' %></li>
|
64
68
|
<li><%= link_to 'Hash links (with Unpoly)', '/hash_test/unpoly#one' %></li>
|
69
|
+
<li><%= link_to 'Revealing content in an overflowing <div> ', '/reveal_test/within_overflowing_div_viewport' %></li>
|
70
|
+
<li><%= link_to 'Revealing content in the document viewport ', '/reveal_test/within_document_viewport' %></li>
|
65
71
|
<li><%= link_to 'Revealing long pages', '/reveal_test/long1' %></li>
|
72
|
+
<li><%= link_to 'Scrolling behavior', '/scroll_test/long1' %></li>
|
66
73
|
<li><%= link_to 'Animations', '/motion_test/animations' %></li>
|
67
74
|
<li><%= link_to 'Transitions', '/motion_test/transitions' %></li>
|
68
75
|
</ul>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class="fixed-top-bar" up-fixed="top" style="margin: 25px">
|
2
|
+
<span class="button" onclick="up.reveal('.small', { behavior: 'smooth' })">Reveal .small</span>
|
3
|
+
<span class="button" onclick="up.reveal('.large', { behavior: 'smooth' })">Reveal .large</span>
|
4
|
+
<span class="button" onclick="up.viewport.config.revealPadding += 25">Increase padding</span>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="fixed-bottom-bar" up-fixed="bottom" style="margin: 25px">
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div style="height: 1000px; background-color: rgba(0, 0, 255, 0.2)">
|
11
|
+
above
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="example small" style="background-color: rgba(255, 0, 0, 0.4); height: 50px">
|
15
|
+
.small
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="example large" style="background-color: rgba(0, 255, 0, 0.4); height: 2000px">
|
19
|
+
.large
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div style="height: 1000px; background-color: rgba(0, 0, 255, 0.2)">
|
23
|
+
below
|
24
|
+
</div>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<div class="fixed-top-bar" up-fixed="top" style="margin: 25px">
|
2
|
+
<span class="button" onclick="up.reveal('.small', { behavior: 'smooth' })">Reveal .small</span>
|
3
|
+
<span class="button" onclick="up.reveal('.large', { behavior: 'smooth' })">Reveal .large</span>
|
4
|
+
<span class="button" onclick="up.viewport.config.revealPadding += 25">Increase padding</span>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="fixed-bottom-bar" up-fixed="bottom" style="margin: 25px">
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div up-viewport style="overflow-y: scroll; width: 300px; height: 100vh">
|
11
|
+
|
12
|
+
<div style="height: 1000px; background-color: rgba(0, 0, 255, 0.2)">
|
13
|
+
above
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="example small" style="background-color: rgba(255, 0, 0, 0.4); height: 50px">
|
17
|
+
.small
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="example large" style="background-color: rgba(0, 255, 0, 0.4); height: 2000px">
|
21
|
+
.large
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div style="height: 1000px; background-color: rgba(0, 0, 255, 0.2)">
|
25
|
+
below
|
26
|
+
</div>
|
27
|
+
|
28
|
+
</div>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<div class="example">
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<a class="button" href="#" onclick="up.scroll(document.scrollingElement, document.getElementById('bottom').offsetTop, { behavior: 'smooth' }); return false">Scroll down with Unpoly</a>
|
5
|
+
<a class="button" href="#" onclick="document.scrollingElement.scrollTo({ top: document.getElementById('bottom').offsetTop, behavior: 'smooth' }); return false">Scroll down with native</a>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<h2>Long page</h2>
|
9
|
+
|
10
|
+
<div style="height: 2000px" id="content">
|
11
|
+
Content height:
|
12
|
+
<a href="#" onclick="document.getElementById('content').style.height = '100px'; return false">100px</a>
|
13
|
+
<a href="#" onclick="document.getElementById('content').style.height = '300px'; return false">300px</a>
|
14
|
+
<a href="#" onclick="document.getElementById('content').style.height = '600px'; return false">600px</a>
|
15
|
+
<a href="#" onclick="document.getElementById('content').style.height = '1000px'; return false">1000px</a>
|
16
|
+
<a href="#" onclick="document.getElementById('content').style.height = '3000px'; return false">3000px</a>
|
17
|
+
<a href="#" onclick="document.getElementById('content').style.height = '10000px'; return false">10000px</a>
|
18
|
+
<a href="#" onclick="document.getElementById('content').style.height = '90000px'; return false">90000px</a>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<p id="bottom">
|
22
|
+
<a class="button" href="#" onclick="up.scroll(document.scrollingElement, 0, { behavior: 'smooth' }); return false">Scroll up with Unpoly</a>
|
23
|
+
<a class="button" href="#" onclick="document.scrollingElement.scrollTo({ top: 0, behavior: 'smooth' }); return false">Scroll up with native</a>
|
24
|
+
</p>
|
25
|
+
|
26
|
+
<div style="height: 3000px">
|
27
|
+
<!-- rest -->
|
28
|
+
</div>
|
29
|
+
|
30
|
+
</div>
|
data/spec_app/config/routes.rb
CHANGED
@@ -13,6 +13,7 @@ Rails.application.routes.draw do
|
|
13
13
|
get 'replace_test/:action', controller: 'replace_test'
|
14
14
|
get 'hash_test/:action', controller: 'hash_test'
|
15
15
|
get 'reveal_test/:action', controller: 'reveal_test'
|
16
|
+
get 'scroll_test/:action', controller: 'scroll_test'
|
16
17
|
get 'motion_test/:action', controller: 'motion_test'
|
17
18
|
|
18
19
|
namespace :form_test do
|
@@ -1,9 +1,21 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
u = up.util
|
2
|
+
$ = jQuery
|
3
|
+
|
4
|
+
window.describeCapability = (capabilities, examples) ->
|
5
|
+
capabilities = u.wrapList(capabilities)
|
6
|
+
allSupported = u.every capabilities, (c) ->
|
7
|
+
if fn = up.browser[c]
|
8
|
+
fn()
|
9
|
+
else
|
10
|
+
u.fail("Unknown capability: up.browser.#{c}()")
|
11
|
+
up.browser[c]()
|
12
|
+
if allSupported
|
3
13
|
examples()
|
4
14
|
|
5
|
-
window.describeFallback = (
|
6
|
-
|
15
|
+
window.describeFallback = (capabilities, examples) ->
|
16
|
+
capabilities = u.wrapList(capabilities)
|
17
|
+
describe "(in a browser without #{capabilities.join(', ')})", ->
|
7
18
|
beforeEach ->
|
8
|
-
|
19
|
+
u.each capabilities, (c) ->
|
20
|
+
spyOn(up.browser, c).and.returnValue(false)
|
9
21
|
examples()
|
@@ -1,2 +1,2 @@
|
|
1
1
|
beforeEach ->
|
2
|
-
up.log.
|
2
|
+
up.log.disable()
|
@@ -0,0 +1,25 @@
|
|
1
|
+
e = up.element
|
2
|
+
$ = jQuery
|
3
|
+
|
4
|
+
fixturesContainer = undefined
|
5
|
+
|
6
|
+
ensureContainerExists = ->
|
7
|
+
fixturesContainer ||= e.affix(document.body, '.fixtures')
|
8
|
+
|
9
|
+
afterEach ->
|
10
|
+
if fixturesContainer
|
11
|
+
e.remove(fixturesContainer)
|
12
|
+
fixturesContainer = undefined
|
13
|
+
|
14
|
+
appendFixture = (args...) ->
|
15
|
+
container = ensureContainerExists()
|
16
|
+
e.affix(container, args...)
|
17
|
+
|
18
|
+
$appendFixture = (args...) ->
|
19
|
+
$(appendFixture(args...))
|
20
|
+
|
21
|
+
window.fixture = appendFixture
|
22
|
+
window.$fixture = $appendFixture
|
23
|
+
|
24
|
+
# A lot of legacy tests require this jQuery function
|
25
|
+
$.fn.affix = (args...) -> $(e.affix(this[0], args...))
|
@@ -0,0 +1 @@
|
|
1
|
+
jQuery.noConflict();
|
@@ -6,10 +6,10 @@ beforeEach ->
|
|
6
6
|
|
7
7
|
parse: (params) ->
|
8
8
|
if up.browser.canInspectFormData()
|
9
|
-
array = up.params.toArray(
|
9
|
+
array = new up.Params(params).toArray()
|
10
10
|
else if params.originalArray
|
11
11
|
# In browser that don't support FormData#entries(),
|
12
|
-
# up.
|
12
|
+
# up.Params#toArray() stores the original array with the generated
|
13
13
|
# FormData object.
|
14
14
|
array = params.originalArray
|
15
15
|
else
|
@@ -1,5 +1,8 @@
|
|
1
|
+
u = up.util
|
2
|
+
$ = jQuery
|
3
|
+
|
1
4
|
beforeEach ->
|
2
|
-
up.
|
5
|
+
up.fragment.config.fallbacks = ['.default-fallback']
|
3
6
|
up.history.config.popTargets = ['.default-fallback']
|
4
7
|
$element = $('<div class="default-fallback"></div>')
|
5
8
|
$element.appendTo(document.body)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
u = up.util
|
2
|
+
$ = jQuery
|
2
3
|
|
3
4
|
replaceStateHelperCount = 0
|
4
5
|
|
@@ -7,7 +8,7 @@ beforeAll ->
|
|
7
8
|
@titleBeforeSuite = document.title
|
8
9
|
|
9
10
|
afterAll (done) ->
|
10
|
-
up.util.
|
11
|
+
up.util.task =>
|
11
12
|
history.replaceState?({ fromResetPathHelper: true }, '', @hrefBeforeSuite)
|
12
13
|
document.title = @titleBeforeSuite
|
13
14
|
done()
|
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
afterEach ->
|
2
|
+
Knife.reset()
|
@@ -1,18 +1,25 @@
|
|
1
|
+
u = up.util
|
2
|
+
$ = jQuery
|
3
|
+
|
1
4
|
afterEach (done) ->
|
2
5
|
# If the spec has installed the Jasmine clock, uninstall it so
|
3
6
|
# the timeout below will actually happen.
|
4
7
|
jasmine.clock().uninstall()
|
5
8
|
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
+
# Most pending promises will wait for an animation to finish.
|
10
|
+
promise = up.motion.finish()
|
11
|
+
|
12
|
+
u.always promise, ->
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
|
14
|
+
# Wait one more frame so pending callbacks have a chance to run.
|
15
|
+
# Pending callbacks might change the URL or cause errors that bleed into
|
16
|
+
# the next example.
|
17
|
+
up.util.task =>
|
18
|
+
up.framework.reset()
|
19
|
+
up.browser.popCookie(up.protocol.config.methodCookie)
|
13
20
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
21
|
+
# Give async reset behavior another frame to play out,
|
22
|
+
# then start the next example.
|
23
|
+
up.util.task ->
|
24
|
+
$('.up-toast').remove()
|
25
|
+
done()
|
@@ -0,0 +1,47 @@
|
|
1
|
+
u = up.util
|
2
|
+
e = up.element
|
3
|
+
$ = jQuery
|
4
|
+
|
5
|
+
up.specUtil = do ->
|
6
|
+
|
7
|
+
###**
|
8
|
+
Returns whether the given element has been detached from the DOM
|
9
|
+
(or whether it was never attached).
|
10
|
+
|
11
|
+
@function up.util.isDetached
|
12
|
+
@internal
|
13
|
+
###
|
14
|
+
isDetached = (element) ->
|
15
|
+
element = e.get(element)
|
16
|
+
# This is by far the fastest way to do this
|
17
|
+
not $.contains(document.documentElement, element)
|
18
|
+
|
19
|
+
isAttached = (element) ->
|
20
|
+
!isDetached(element)
|
21
|
+
|
22
|
+
isVisible = (element) ->
|
23
|
+
$(element).is(':visible')
|
24
|
+
|
25
|
+
isHidden = (element) ->
|
26
|
+
$(element).is(':hidden')
|
27
|
+
|
28
|
+
###**
|
29
|
+
@function up.util.promiseTimer
|
30
|
+
@internal
|
31
|
+
###
|
32
|
+
promiseTimer = (ms) ->
|
33
|
+
timeout = undefined
|
34
|
+
promise = new Promise (resolve, reject) ->
|
35
|
+
timeout = u.timer(ms, resolve)
|
36
|
+
promise.cancel = -> clearTimeout(timeout)
|
37
|
+
promise
|
38
|
+
|
39
|
+
|
40
|
+
isDetached: isDetached
|
41
|
+
isAttached: isAttached
|
42
|
+
isVisible: isVisible
|
43
|
+
isHidden: isHidden
|
44
|
+
promiseTimer: promiseTimer
|
45
|
+
|
46
|
+
|
47
|
+
|
@@ -1,5 +1,9 @@
|
|
1
|
+
u = up.util
|
2
|
+
$ = jQuery
|
3
|
+
|
1
4
|
beforeEach ->
|
2
5
|
jasmine.addMatchers
|
3
6
|
toBeAttached: (util, customEqualityTesters) ->
|
4
|
-
compare: (
|
5
|
-
|
7
|
+
compare: (element) ->
|
8
|
+
element = up.element.get(element)
|
9
|
+
pass: element && up.specUtil.isAttached(element)
|